Skip to content

Commit

Permalink
Merge pull request #993 from makeplane/stage-release
Browse files Browse the repository at this point in the history
promote: stage-release to prod
  • Loading branch information
vamsi committed May 2, 2023
2 parents d2a58bf + e3d4329 commit 563bb12
Show file tree
Hide file tree
Showing 342 changed files with 7,628 additions and 4,037 deletions.
10 changes: 7 additions & 3 deletions apiserver/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ DJANGO_SETTINGS_MODULE="plane.settings.production"
DATABASE_URL=postgres://plane:xyzzyspoon@db:5432/plane
# Cache
REDIS_URL=redis://redis:6379/
# SMPT
# SMTP
EMAIL_HOST=""
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
# AWS
EMAIL_PORT="587"
EMAIL_USE_TLS="1"
EMAIL_FROM="Team Plane <team@mailer.plane.so>"
# AWS
AWS_REGION=""
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
AWS_S3_BUCKET_NAME=""
AWS_S3_ENDPOINT_URL=""
# FE
WEB_URL="localhost/"
# OAUTH
Expand All @@ -21,4 +25,4 @@ DISABLE_COLLECTSTATIC=1
DOCKERIZED=1
# GPT Envs
OPENAI_API_KEY=0
GPT_ENGINE=0
GPT_ENGINE=0
36 changes: 35 additions & 1 deletion apiserver/back_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
import random
from django.contrib.auth.hashers import make_password
from plane.db.models import ProjectIdentifier
from plane.db.models import Issue, IssueComment, User, Project, ProjectMember, Label
from plane.db.models import (
Issue,
IssueComment,
User,
Project,
ProjectMember,
Label,
Integration,
)


# Update description and description html values for old descriptions
Expand Down Expand Up @@ -174,3 +182,29 @@ def update_label_color():
except Exception as e:
print(e)
print("Failed")


def create_slack_integration():
try:
_ = Integration.objects.create(provider="slack", network=2, title="Slack")
print("Success")
except Exception as e:
print(e)
print("Failed")


def update_integration_verified():
try:
integrations = Integration.objects.all()
updated_integrations = []
for integration in integrations:
integration.verified = True
updated_integrations.append(integration)

Integration.objects.bulk_update(
updated_integrations, ["verified"], batch_size=10
)
print("Sucess")
except Exception as e:
print(e)
print("Failed")
3 changes: 2 additions & 1 deletion apiserver/plane/api/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@
GithubRepositorySerializer,
GithubRepositorySyncSerializer,
GithubCommentSyncSerializer,
SlackProjectSyncSerializer,
)

from .importer import ImporterSerializer

from .page import PageSerializer, PageBlockSerializer, PageFavoriteSerializer

from .estimate import EstimateSerializer, EstimatePointSerializer
from .estimate import EstimateSerializer, EstimatePointSerializer, EstimateReadSerializer
13 changes: 13 additions & 0 deletions apiserver/plane/api/serializers/estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@ class Meta:
"workspace",
"project",
]


class EstimateReadSerializer(BaseSerializer):
points = EstimatePointSerializer(read_only=True, many=True)

class Meta:
model = Estimate
fields = "__all__"
read_only_fields = [
"points",
"name",
"description",
]
1 change: 1 addition & 0 deletions apiserver/plane/api/serializers/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
GithubIssueSyncSerializer,
GithubCommentSyncSerializer,
)
from .slack import SlackProjectSyncSerializer
14 changes: 14 additions & 0 deletions apiserver/plane/api/serializers/integration/slack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Module imports
from plane.api.serializers import BaseSerializer
from plane.db.models import SlackProjectSync


class SlackProjectSyncSerializer(BaseSerializer):
class Meta:
model = SlackProjectSync
fields = "__all__"
read_only_fields = [
"project",
"workspace",
"workspace_integration",
]
81 changes: 41 additions & 40 deletions apiserver/plane/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
StateViewSet,
## End States
# Estimates
EstimateViewSet,
EstimatePointViewSet,
ProjectEstimatePointEndpoint,
BulkEstimatePointEndpoint,
## End Estimates
Expand Down Expand Up @@ -133,6 +131,7 @@
GithubIssueSyncViewSet,
GithubCommentSyncViewSet,
BulkCreateGithubIssueSyncEndpoint,
SlackProjectSyncViewSet,
## End Integrations
# Importer
ServiceIssueImportSummaryEndpoint,
Expand All @@ -146,6 +145,9 @@
# Gpt
GPTIntegrationEndpoint,
## End Gpt
# Release Notes
ReleaseNotesEndpoint,
## End Release Notes
)


Expand Down Expand Up @@ -507,62 +509,34 @@
name="project-state",
),
# End States ##
# States
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/",
EstimateViewSet.as_view(
{
"get": "list",
"post": "create",
}
),
name="project-estimates",
),
# Estimates
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/<uuid:pk>/",
EstimateViewSet.as_view(
{
"get": "retrieve",
"put": "update",
"patch": "partial_update",
"delete": "destroy",
}
),
name="project-estimates",
"workspaces/<str:slug>/projects/<uuid:project_id>/project-estimates/",
ProjectEstimatePointEndpoint.as_view(),
name="project-estimate-points",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/<uuid:estimate_id>/estimate-points/",
EstimatePointViewSet.as_view(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/",
BulkEstimatePointEndpoint.as_view(
{
"get": "list",
"post": "create",
}
),
name="project-estimate-points",
name="bulk-create-estimate-points",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/<uuid:estimate_id>/estimate-points/<uuid:pk>/",
EstimatePointViewSet.as_view(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/<uuid:estimate_id>/",
BulkEstimatePointEndpoint.as_view(
{
"get": "retrieve",
"put": "update",
"patch": "partial_update",
"delete": "destroy",
}
),
name="project-estimates",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/project-estimates/",
ProjectEstimatePointEndpoint.as_view(),
name="project-estimate-points",
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/estimates/<uuid:estimate_id>/bulk-estimate-points/",
BulkEstimatePointEndpoint.as_view(),
name="bulk-create-estimate-points",
),
# End States ##
# End Estimates ##
# Shortcuts
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/shortcuts/",
Expand Down Expand Up @@ -1237,6 +1211,26 @@
),
),
## End Github Integrations
# Slack Integration
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/workspace-integrations/<uuid:workspace_integration_id>/project-slack-sync/",
SlackProjectSyncViewSet.as_view(
{
"post": "create",
"get": "list",
}
),
),
path(
"workspaces/<str:slug>/projects/<uuid:project_id>/workspace-integrations/<uuid:workspace_integration_id>/project-slack-sync/<uuid:pk>/",
SlackProjectSyncViewSet.as_view(
{
"delete": "destroy",
"get": "retrieve",
}
),
),
## End Slack Integration
## End Integrations
# Importer
path(
Expand Down Expand Up @@ -1284,4 +1278,11 @@
name="importer",
),
## End Gpt
# Release Notes
path(
"release-notes/",
ReleaseNotesEndpoint.as_view(),
name="release-notes",
),
## End Release Notes
]
6 changes: 4 additions & 2 deletions apiserver/plane/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
GithubCommentSyncViewSet,
GithubRepositoriesEndpoint,
BulkCreateGithubIssueSyncEndpoint,
SlackProjectSyncViewSet,
)

from .importer import (
Expand Down Expand Up @@ -133,8 +134,9 @@
from .gpt import GPTIntegrationEndpoint

from .estimate import (
EstimateViewSet,
EstimatePointViewSet,
ProjectEstimatePointEndpoint,
BulkEstimatePointEndpoint,
)


from .release import ReleaseNotesEndpoint
4 changes: 2 additions & 2 deletions apiserver/plane/api/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rest_framework.filters import SearchFilter
from rest_framework.permissions import IsAuthenticated
from rest_framework.exceptions import NotFound

from sentry_sdk import capture_exception
from django_filters.rest_framework import DjangoFilterBackend

# Module imports
Expand Down Expand Up @@ -39,7 +39,7 @@ def get_queryset(self):
try:
return self.model.objects.all()
except Exception as e:
print(e)
capture_exception(e)
raise APIException("Please check the view", status.HTTP_400_BAD_REQUEST)

def dispatch(self, request, *args, **kwargs):
Expand Down
42 changes: 40 additions & 2 deletions apiserver/plane/api/views/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ def perform_create(self, serializer):
project_id=self.kwargs.get("project_id"), owned_by=self.request.user
)

def perform_destroy(self, instance):
cycle_issues = list(
CycleIssue.objects.filter(cycle_id=self.kwargs.get("pk")).values_list(
"issue", flat=True
)
)
issue_activity.delay(
type="cycle.activity.deleted",
requested_data=json.dumps(
{
"cycle_id": str(self.kwargs.get("pk")),
"issues": [str(issue_id) for issue_id in cycle_issues],
}
),
actor_id=str(self.request.user.id),
issue_id=str(self.kwargs.get("pk", None)),
project_id=str(self.kwargs.get("project_id", None)),
current_instance=None,
)

return super().perform_destroy(instance)

def get_queryset(self):
subquery = CycleFavorite.objects.filter(
user=self.request.user,
Expand Down Expand Up @@ -181,6 +203,22 @@ def perform_create(self, serializer):
cycle_id=self.kwargs.get("cycle_id"),
)

def perform_destroy(self, instance):
issue_activity.delay(
type="cycle.activity.deleted",
requested_data=json.dumps(
{
"cycle_id": str(self.kwargs.get("cycle_id")),
"issues": [str(instance.issue_id)],
}
),
actor_id=str(self.request.user.id),
issue_id=str(self.kwargs.get("pk", None)),
project_id=str(self.kwargs.get("project_id", None)),
current_instance=None,
)
return super().perform_destroy(instance)

def get_queryset(self):
return self.filter_queryset(
super()
Expand Down Expand Up @@ -286,9 +324,9 @@ def create(self, request, slug, project_id, cycle_id):

# Get all CycleIssues already created
cycle_issues = list(CycleIssue.objects.filter(issue_id__in=issues))
records_to_update = []
update_cycle_issue_activity = []
record_to_create = []
records_to_update = []

for issue in issues:
cycle_issue = [
Expand Down Expand Up @@ -333,7 +371,7 @@ def create(self, request, slug, project_id, cycle_id):

# Capture Issue Activity
issue_activity.delay(
type="issue.activity.updated",
type="cycle.activity.created",
requested_data=json.dumps({"cycles_list": issues}),
actor_id=str(self.request.user.id),
issue_id=str(self.kwargs.get("pk", None)),
Expand Down

1 comment on commit 563bb12

@vercel
Copy link

@vercel vercel bot commented on 563bb12 May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane – ./apps/app

plane-git-master-plane.vercel.app
plane-theta.vercel.app
plane-plane.vercel.app
app.plane.so

Please sign in to comment.