2022-11-29 21:17:42 +00:00
|
|
|
# Python imports
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
import json
|
2023-03-15 17:54:44 +00:00
|
|
|
import random
|
2023-04-20 12:44:24 +00:00
|
|
|
from itertools import chain
|
2022-11-29 21:17:42 +00:00
|
|
|
|
|
|
|
# Django imports
|
2023-05-26 08:21:09 +00:00
|
|
|
from django.db.models import (
|
|
|
|
Prefetch,
|
|
|
|
OuterRef,
|
|
|
|
Func,
|
|
|
|
F,
|
|
|
|
Q,
|
|
|
|
Count,
|
|
|
|
Case,
|
|
|
|
Value,
|
|
|
|
CharField,
|
|
|
|
When,
|
2023-07-11 08:06:31 +00:00
|
|
|
Exists,
|
2023-06-24 12:22:12 +00:00
|
|
|
Max,
|
2023-09-04 09:08:39 +00:00
|
|
|
IntegerField,
|
2023-05-26 08:21:09 +00:00
|
|
|
)
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
from django.core.serializers.json import DjangoJSONEncoder
|
2023-03-27 18:06:13 +00:00
|
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from django.views.decorators.gzip import gzip_page
|
2023-09-02 14:13:17 +00:00
|
|
|
from django.db import IntegrityError
|
2023-05-25 04:54:20 +00:00
|
|
|
from django.conf import settings
|
2023-09-13 06:55:10 +00:00
|
|
|
from django.db import IntegrityError
|
2023-05-26 08:21:09 +00:00
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
# Third Party imports
|
|
|
|
from rest_framework.response import Response
|
|
|
|
from rest_framework import status
|
2023-04-04 18:47:55 +00:00
|
|
|
from rest_framework.parsers import MultiPartParser, FormParser
|
2023-08-31 18:38:40 +00:00
|
|
|
from rest_framework.permissions import AllowAny, IsAuthenticated
|
2022-11-29 21:17:42 +00:00
|
|
|
from sentry_sdk import capture_exception
|
|
|
|
|
|
|
|
# Module imports
|
|
|
|
from . import BaseViewSet, BaseAPIView
|
|
|
|
from plane.api.serializers import (
|
|
|
|
IssueCreateSerializer,
|
|
|
|
IssueActivitySerializer,
|
|
|
|
IssueCommentSerializer,
|
|
|
|
IssuePropertySerializer,
|
|
|
|
LabelSerializer,
|
|
|
|
IssueSerializer,
|
|
|
|
LabelSerializer,
|
2023-02-14 14:38:04 +00:00
|
|
|
IssueFlatSerializer,
|
2023-02-27 20:39:22 +00:00
|
|
|
IssueLinkSerializer,
|
2023-03-25 18:26:53 +00:00
|
|
|
IssueLiteSerializer,
|
2023-04-04 18:47:55 +00:00
|
|
|
IssueAttachmentSerializer,
|
2023-07-11 08:06:31 +00:00
|
|
|
IssueSubscriberSerializer,
|
|
|
|
ProjectMemberLiteSerializer,
|
2023-07-31 05:12:17 +00:00
|
|
|
IssueReactionSerializer,
|
|
|
|
CommentReactionSerializer,
|
2023-08-11 13:57:44 +00:00
|
|
|
IssueVoteSerializer,
|
2023-09-13 06:55:10 +00:00
|
|
|
IssueRelationSerializer,
|
2023-08-29 09:30:26 +00:00
|
|
|
IssuePublicSerializer,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
from plane.api.permissions import (
|
2023-07-26 12:22:35 +00:00
|
|
|
WorkspaceEntityPermission,
|
2022-11-29 21:17:42 +00:00
|
|
|
ProjectEntityPermission,
|
|
|
|
WorkSpaceAdminPermission,
|
|
|
|
ProjectMemberPermission,
|
2023-07-11 08:06:31 +00:00
|
|
|
ProjectLitePermission,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
from plane.db.models import (
|
|
|
|
Project,
|
|
|
|
Issue,
|
|
|
|
IssueActivity,
|
|
|
|
IssueComment,
|
|
|
|
IssueProperty,
|
|
|
|
Label,
|
2023-02-17 11:34:12 +00:00
|
|
|
IssueLink,
|
2023-04-04 18:47:55 +00:00
|
|
|
IssueAttachment,
|
2023-04-20 12:44:24 +00:00
|
|
|
State,
|
2023-07-11 08:06:31 +00:00
|
|
|
IssueSubscriber,
|
|
|
|
ProjectMember,
|
2023-07-31 05:12:17 +00:00
|
|
|
IssueReaction,
|
|
|
|
CommentReaction,
|
2023-08-11 13:57:44 +00:00
|
|
|
ProjectDeployBoard,
|
|
|
|
IssueVote,
|
2023-09-13 06:55:10 +00:00
|
|
|
IssueRelation,
|
2023-08-30 06:45:08 +00:00
|
|
|
ProjectPublicMember,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
2023-01-30 19:16:59 +00:00
|
|
|
from plane.bgtasks.issue_activites_task import issue_activity
|
2023-02-18 10:13:47 +00:00
|
|
|
from plane.utils.grouper import group_results
|
2023-03-15 17:55:09 +00:00
|
|
|
from plane.utils.issue_filters import issue_filters
|
2023-08-29 08:04:38 +00:00
|
|
|
from plane.bgtasks.export_task import issue_export_task
|
2022-11-29 21:17:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IssueViewSet(BaseViewSet):
|
|
|
|
def get_serializer_class(self):
|
|
|
|
return (
|
|
|
|
IssueCreateSerializer
|
|
|
|
if self.action in ["create", "update", "partial_update"]
|
|
|
|
else IssueSerializer
|
|
|
|
)
|
|
|
|
|
|
|
|
model = Issue
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
search_fields = [
|
|
|
|
"name",
|
|
|
|
]
|
|
|
|
|
|
|
|
filterset_fields = [
|
|
|
|
"state__name",
|
|
|
|
"assignees__id",
|
|
|
|
"workspace__id",
|
|
|
|
]
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(project_id=self.kwargs.get("project_id"))
|
|
|
|
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
def perform_update(self, serializer):
|
|
|
|
requested_data = json.dumps(self.request.data, cls=DjangoJSONEncoder)
|
2023-01-30 19:16:59 +00:00
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
if current_instance is not None:
|
2023-01-30 19:16:59 +00:00
|
|
|
issue_activity.delay(
|
2023-04-06 17:26:36 +00:00
|
|
|
type="issue.activity.updated",
|
|
|
|
requested_data=requested_data,
|
|
|
|
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=json.dumps(
|
|
|
|
IssueSerializer(current_instance).data, cls=DjangoJSONEncoder
|
|
|
|
),
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
return super().perform_update(serializer)
|
|
|
|
|
2023-02-22 14:10:57 +00:00
|
|
|
def perform_destroy(self, instance):
|
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
|
|
|
if current_instance is not None:
|
|
|
|
issue_activity.delay(
|
2023-04-06 17:26:36 +00:00
|
|
|
type="issue.activity.deleted",
|
|
|
|
requested_data=json.dumps(
|
|
|
|
{"issue_id": str(self.kwargs.get("pk", None))}
|
|
|
|
),
|
|
|
|
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=json.dumps(
|
|
|
|
IssueSerializer(current_instance).data, cls=DjangoJSONEncoder
|
|
|
|
),
|
2023-02-22 14:10:57 +00:00
|
|
|
)
|
|
|
|
return super().perform_destroy(instance)
|
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
2023-06-16 13:27:17 +00:00
|
|
|
Issue.issue_objects.annotate(
|
|
|
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
2023-01-26 06:11:11 +00:00
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("state")
|
|
|
|
.select_related("parent")
|
|
|
|
.prefetch_related("assignees")
|
|
|
|
.prefetch_related("labels")
|
2023-07-31 05:12:17 +00:00
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"issue_reactions",
|
|
|
|
queryset=IssueReaction.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
|
2023-03-27 18:06:13 +00:00
|
|
|
@method_decorator(gzip_page)
|
2022-11-29 21:17:42 +00:00
|
|
|
def list(self, request, slug, project_id):
|
|
|
|
try:
|
2023-03-15 17:55:09 +00:00
|
|
|
filters = issue_filters(request.query_params, "GET")
|
2023-03-21 20:03:56 +00:00
|
|
|
|
2023-06-23 16:48:03 +00:00
|
|
|
# Custom ordering for priority and state
|
2023-09-12 07:36:49 +00:00
|
|
|
priority_order = ["urgent", "high", "medium", "low", "none"]
|
2023-06-23 16:48:03 +00:00
|
|
|
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]
|
2023-05-26 08:21:09 +00:00
|
|
|
|
|
|
|
order_by_param = request.GET.get("order_by", "-created_at")
|
|
|
|
|
2023-02-18 06:52:17 +00:00
|
|
|
issue_queryset = (
|
|
|
|
self.get_queryset()
|
2023-03-15 17:55:09 +00:00
|
|
|
.filter(**filters)
|
2023-07-17 07:47:11 +00:00
|
|
|
.annotate(cycle_id=F("issue_cycle__cycle_id"))
|
|
|
|
.annotate(module_id=F("issue_module__module_id"))
|
2023-04-11 13:17:36 +00:00
|
|
|
.annotate(
|
|
|
|
link_count=IssueLink.objects.filter(issue=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
attachment_count=IssueAttachment.objects.filter(
|
|
|
|
issue=OuterRef("id")
|
|
|
|
)
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
2023-02-18 06:52:17 +00:00
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
|
2023-06-23 16:48:03 +00:00
|
|
|
# Priority Ordering
|
|
|
|
if order_by_param == "priority" or order_by_param == "-priority":
|
|
|
|
priority_order = (
|
|
|
|
priority_order
|
|
|
|
if order_by_param == "priority"
|
|
|
|
else priority_order[::-1]
|
|
|
|
)
|
2023-05-26 08:21:09 +00:00
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
priority_order=Case(
|
|
|
|
*[
|
|
|
|
When(priority=p, then=Value(i))
|
|
|
|
for i, p in enumerate(priority_order)
|
|
|
|
],
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("priority_order")
|
2023-06-24 12:22:12 +00:00
|
|
|
|
2023-06-23 16:48:03 +00:00
|
|
|
# State Ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"state__name",
|
|
|
|
"state__group",
|
|
|
|
"-state__name",
|
|
|
|
"-state__group",
|
|
|
|
]:
|
|
|
|
state_order = (
|
|
|
|
state_order
|
|
|
|
if order_by_param in ["state__name", "state__group"]
|
|
|
|
else state_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
state_order=Case(
|
|
|
|
*[
|
|
|
|
When(state__group=state_group, then=Value(i))
|
|
|
|
for i, state_group in enumerate(state_order)
|
|
|
|
],
|
|
|
|
default=Value(len(state_order)),
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("state_order")
|
2023-06-24 12:22:12 +00:00
|
|
|
# assignee and label ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"labels__name",
|
|
|
|
"-labels__name",
|
|
|
|
"assignees__first_name",
|
|
|
|
"-assignees__first_name",
|
|
|
|
]:
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
max_values=Max(
|
|
|
|
order_by_param[1::]
|
|
|
|
if order_by_param.startswith("-")
|
|
|
|
else order_by_param
|
|
|
|
)
|
|
|
|
).order_by(
|
|
|
|
"-max_values" if order_by_param.startswith("-") else "max_values"
|
|
|
|
)
|
2023-05-26 08:21:09 +00:00
|
|
|
else:
|
|
|
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
|
|
|
|
2023-03-25 18:26:53 +00:00
|
|
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
2023-02-27 20:39:22 +00:00
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
## Grouping the results
|
|
|
|
group_by = request.GET.get("group_by", False)
|
2023-09-13 12:38:56 +00:00
|
|
|
sub_group_by = request.GET.get("sub_group_by", False)
|
|
|
|
if sub_group_by and sub_group_by == group_by:
|
|
|
|
return Response(
|
|
|
|
{"error": "Group by and sub group by cannot be same"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
if group_by:
|
2023-02-18 10:13:47 +00:00
|
|
|
return Response(
|
2023-09-13 12:38:56 +00:00
|
|
|
group_results(issues, group_by, sub_group_by), status=status.HTTP_200_OK
|
2023-02-18 10:13:47 +00:00
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
|
2023-02-18 06:52:17 +00:00
|
|
|
return Response(issues, status=status.HTTP_200_OK)
|
2022-11-29 21:17:42 +00:00
|
|
|
|
|
|
|
except Exception as e:
|
2023-07-28 09:05:45 +00:00
|
|
|
capture_exception(e)
|
2022-11-29 21:17:42 +00:00
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def create(self, request, slug, project_id):
|
|
|
|
try:
|
2023-07-24 06:53:34 +00:00
|
|
|
project = Project.objects.get(pk=project_id)
|
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
serializer = IssueCreateSerializer(
|
2023-07-24 06:53:34 +00:00
|
|
|
data=request.data,
|
|
|
|
context={
|
|
|
|
"project_id": project_id,
|
|
|
|
"workspace_id": project.workspace_id,
|
|
|
|
"default_assignee_id": project.default_assignee_id,
|
|
|
|
},
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if serializer.is_valid():
|
|
|
|
serializer.save()
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
|
|
|
|
# Track the issue
|
2023-02-22 14:10:57 +00:00
|
|
|
issue_activity.delay(
|
2023-04-06 17:26:36 +00:00
|
|
|
type="issue.activity.created",
|
|
|
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(request.user.id),
|
|
|
|
issue_id=str(serializer.data.get("id", None)),
|
|
|
|
project_id=str(project_id),
|
|
|
|
current_instance=None,
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
|
|
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
|
|
|
|
except Project.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Project was not found"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
|
|
|
|
2023-03-25 18:26:53 +00:00
|
|
|
def retrieve(self, request, slug, project_id, pk=None):
|
|
|
|
try:
|
2023-06-16 13:27:17 +00:00
|
|
|
issue = Issue.issue_objects.get(
|
2023-03-25 18:26:53 +00:00
|
|
|
workspace__slug=slug, project_id=project_id, pk=pk
|
|
|
|
)
|
|
|
|
return Response(IssueSerializer(issue).data, status=status.HTTP_200_OK)
|
|
|
|
except Issue.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue Does not exist"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
|
2022-12-13 18:06:30 +00:00
|
|
|
class UserWorkSpaceIssues(BaseAPIView):
|
2023-03-27 18:06:13 +00:00
|
|
|
@method_decorator(gzip_page)
|
2022-12-13 18:06:30 +00:00
|
|
|
def get(self, request, slug):
|
|
|
|
try:
|
2023-07-26 12:22:35 +00:00
|
|
|
filters = issue_filters(request.query_params, "GET")
|
|
|
|
# Custom ordering for priority and state
|
2023-09-12 07:36:49 +00:00
|
|
|
priority_order = ["urgent", "high", "medium", "low", "none"]
|
2023-07-26 12:22:35 +00:00
|
|
|
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]
|
|
|
|
|
|
|
|
order_by_param = request.GET.get("order_by", "-created_at")
|
|
|
|
|
|
|
|
issue_queryset = (
|
2023-06-20 04:57:21 +00:00
|
|
|
Issue.issue_objects.filter(
|
2023-09-04 09:08:39 +00:00
|
|
|
(
|
|
|
|
Q(assignees__in=[request.user])
|
|
|
|
| Q(created_by=request.user)
|
|
|
|
| Q(issue_subscribers__subscriber=request.user)
|
|
|
|
),
|
2023-07-26 12:22:35 +00:00
|
|
|
workspace__slug=slug,
|
2023-06-20 04:57:21 +00:00
|
|
|
)
|
2023-01-26 06:11:11 +00:00
|
|
|
.annotate(
|
2023-06-16 13:27:17 +00:00
|
|
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
2023-01-26 06:11:11 +00:00
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
2023-01-16 20:20:27 +00:00
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("state")
|
|
|
|
.select_related("parent")
|
|
|
|
.prefetch_related("assignees")
|
|
|
|
.prefetch_related("labels")
|
2023-07-26 12:22:35 +00:00
|
|
|
.order_by(order_by_param)
|
2023-04-17 08:33:19 +00:00
|
|
|
.annotate(
|
|
|
|
link_count=IssueLink.objects.filter(issue=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
attachment_count=IssueAttachment.objects.filter(
|
|
|
|
issue=OuterRef("id")
|
|
|
|
)
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
2023-08-11 07:13:00 +00:00
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"issue_reactions",
|
|
|
|
queryset=IssueReaction.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
2023-07-26 12:22:35 +00:00
|
|
|
.filter(**filters)
|
2023-08-16 09:10:10 +00:00
|
|
|
).distinct()
|
2023-07-26 12:22:35 +00:00
|
|
|
|
|
|
|
# Priority Ordering
|
|
|
|
if order_by_param == "priority" or order_by_param == "-priority":
|
|
|
|
priority_order = (
|
|
|
|
priority_order
|
|
|
|
if order_by_param == "priority"
|
|
|
|
else priority_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
priority_order=Case(
|
|
|
|
*[
|
|
|
|
When(priority=p, then=Value(i))
|
|
|
|
for i, p in enumerate(priority_order)
|
|
|
|
],
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("priority_order")
|
|
|
|
|
|
|
|
# State Ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"state__name",
|
|
|
|
"state__group",
|
|
|
|
"-state__name",
|
|
|
|
"-state__group",
|
|
|
|
]:
|
|
|
|
state_order = (
|
|
|
|
state_order
|
|
|
|
if order_by_param in ["state__name", "state__group"]
|
|
|
|
else state_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
state_order=Case(
|
|
|
|
*[
|
|
|
|
When(state__group=state_group, then=Value(i))
|
|
|
|
for i, state_group in enumerate(state_order)
|
|
|
|
],
|
|
|
|
default=Value(len(state_order)),
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("state_order")
|
|
|
|
# assignee and label ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"labels__name",
|
|
|
|
"-labels__name",
|
|
|
|
"assignees__first_name",
|
|
|
|
"-assignees__first_name",
|
|
|
|
]:
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
max_values=Max(
|
|
|
|
order_by_param[1::]
|
|
|
|
if order_by_param.startswith("-")
|
|
|
|
else order_by_param
|
|
|
|
)
|
|
|
|
).order_by(
|
|
|
|
"-max_values" if order_by_param.startswith("-") else "max_values"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
|
|
|
|
|
|
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
|
|
|
|
|
|
|
## Grouping the results
|
|
|
|
group_by = request.GET.get("group_by", False)
|
|
|
|
if group_by:
|
|
|
|
return Response(
|
|
|
|
group_results(issues, group_by), status=status.HTTP_200_OK
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(issues, status=status.HTTP_200_OK)
|
2022-12-13 18:06:30 +00:00
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2022-12-13 18:06:30 +00:00
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
|
2022-12-22 10:23:29 +00:00
|
|
|
|
2022-11-29 21:17:42 +00:00
|
|
|
class WorkSpaceIssuesEndpoint(BaseAPIView):
|
|
|
|
permission_classes = [
|
|
|
|
WorkSpaceAdminPermission,
|
|
|
|
]
|
|
|
|
|
2023-03-27 18:06:13 +00:00
|
|
|
@method_decorator(gzip_page)
|
2022-11-29 21:17:42 +00:00
|
|
|
def get(self, request, slug):
|
|
|
|
try:
|
2023-03-25 05:44:05 +00:00
|
|
|
issues = (
|
2023-06-16 13:27:17 +00:00
|
|
|
Issue.issue_objects.filter(workspace__slug=slug)
|
2023-03-25 05:44:05 +00:00
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.order_by("-created_at")
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
serializer = IssueSerializer(issues, many=True)
|
|
|
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class IssueActivityEndpoint(BaseAPIView):
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
2023-03-27 18:06:13 +00:00
|
|
|
@method_decorator(gzip_page)
|
2022-11-29 21:17:42 +00:00
|
|
|
def get(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
issue_activities = (
|
|
|
|
IssueActivity.objects.filter(issue_id=issue_id)
|
2023-02-22 14:10:57 +00:00
|
|
|
.filter(
|
2023-08-30 11:08:04 +00:00
|
|
|
~Q(field__in=["comment", "vote", "reaction"]),
|
2023-02-22 14:10:57 +00:00
|
|
|
project__project_projectmember__member=self.request.user,
|
|
|
|
)
|
2023-08-01 11:33:19 +00:00
|
|
|
.select_related("actor", "workspace", "issue", "project")
|
2023-03-25 05:44:05 +00:00
|
|
|
).order_by("created_at")
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
issue_comments = (
|
|
|
|
IssueComment.objects.filter(issue_id=issue_id)
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.order_by("created_at")
|
2023-07-24 06:53:34 +00:00
|
|
|
.select_related("actor", "issue", "project", "workspace")
|
2023-08-29 08:05:36 +00:00
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"comment_reactions",
|
|
|
|
queryset=CommentReaction.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
issue_activities = IssueActivitySerializer(issue_activities, many=True).data
|
|
|
|
issue_comments = IssueCommentSerializer(issue_comments, many=True).data
|
|
|
|
|
|
|
|
result_list = sorted(
|
|
|
|
chain(issue_activities, issue_comments),
|
|
|
|
key=lambda instance: instance["created_at"],
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(result_list, status=status.HTTP_200_OK)
|
2022-11-29 21:17:42 +00:00
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class IssueCommentViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssueCommentSerializer
|
|
|
|
model = IssueComment
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
permission_classes = [
|
2023-07-24 12:10:26 +00:00
|
|
|
ProjectLitePermission,
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
]
|
2022-11-29 21:17:42 +00:00
|
|
|
|
|
|
|
filterset_fields = [
|
|
|
|
"issue__id",
|
|
|
|
"workspace__id",
|
|
|
|
]
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
issue_id=self.kwargs.get("issue_id"),
|
|
|
|
actor=self.request.user if self.request.user is not None else None,
|
|
|
|
)
|
2023-02-22 14:10:57 +00:00
|
|
|
issue_activity.delay(
|
2023-04-06 17:26:36 +00:00
|
|
|
type="comment.activity.created",
|
|
|
|
requested_data=json.dumps(serializer.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id")),
|
|
|
|
project_id=str(self.kwargs.get("project_id")),
|
|
|
|
current_instance=None,
|
2023-02-22 14:10:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def perform_update(self, serializer):
|
|
|
|
requested_data = json.dumps(self.request.data, cls=DjangoJSONEncoder)
|
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
|
|
|
if current_instance is not None:
|
|
|
|
issue_activity.delay(
|
2023-04-06 17:26:36 +00:00
|
|
|
type="comment.activity.updated",
|
|
|
|
requested_data=requested_data,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueCommentSerializer(current_instance).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
2023-02-22 14:10:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
return super().perform_update(serializer)
|
|
|
|
|
|
|
|
def perform_destroy(self, instance):
|
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
|
|
|
if current_instance is not None:
|
|
|
|
issue_activity.delay(
|
2023-04-06 17:26:36 +00:00
|
|
|
type="comment.activity.deleted",
|
|
|
|
requested_data=json.dumps(
|
|
|
|
{"comment_id": str(self.kwargs.get("pk", None))}
|
|
|
|
),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueCommentSerializer(current_instance).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
2023-02-22 14:10:57 +00:00
|
|
|
)
|
|
|
|
return super().perform_destroy(instance)
|
2022-11-29 21:17:42 +00:00
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return self.filter_queryset(
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("issue")
|
2023-08-29 08:04:38 +00:00
|
|
|
.annotate(
|
|
|
|
is_member=Exists(
|
|
|
|
ProjectMember.objects.filter(
|
|
|
|
workspace__slug=self.kwargs.get("slug"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
member_id=self.request.user.id,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-11-29 21:17:42 +00:00
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class IssuePropertyViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssuePropertySerializer
|
|
|
|
model = IssueProperty
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
filterset_fields = []
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
project_id=self.kwargs.get("project_id"), user=self.request.user
|
|
|
|
)
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return self.filter_queryset(
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(user=self.request.user)
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
)
|
|
|
|
|
|
|
|
def list(self, request, slug, project_id):
|
|
|
|
queryset = self.get_queryset()
|
|
|
|
serializer = IssuePropertySerializer(queryset, many=True)
|
|
|
|
return Response(
|
|
|
|
serializer.data[0] if len(serializer.data) > 0 else [],
|
|
|
|
status=status.HTTP_200_OK,
|
|
|
|
)
|
|
|
|
|
|
|
|
def create(self, request, slug, project_id):
|
|
|
|
try:
|
|
|
|
issue_property, created = IssueProperty.objects.get_or_create(
|
|
|
|
user=request.user,
|
|
|
|
project_id=project_id,
|
|
|
|
)
|
|
|
|
|
|
|
|
if not created:
|
|
|
|
issue_property.properties = request.data.get("properties", {})
|
|
|
|
issue_property.save()
|
|
|
|
|
|
|
|
serializer = IssuePropertySerializer(issue_property)
|
|
|
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
|
|
|
|
|
|
issue_property.properties = request.data.get("properties", {})
|
|
|
|
issue_property.save()
|
|
|
|
serializer = IssuePropertySerializer(issue_property)
|
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class LabelViewSet(BaseViewSet):
|
|
|
|
serializer_class = LabelSerializer
|
|
|
|
model = Label
|
|
|
|
permission_classes = [
|
|
|
|
ProjectMemberPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
)
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return self.filter_queryset(
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("parent")
|
2023-03-25 05:44:05 +00:00
|
|
|
.order_by("name")
|
2022-11-29 21:17:42 +00:00
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class BulkDeleteIssuesEndpoint(BaseAPIView):
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
def delete(self, request, slug, project_id):
|
|
|
|
try:
|
|
|
|
issue_ids = request.data.get("issue_ids", [])
|
|
|
|
|
|
|
|
if not len(issue_ids):
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue IDs are required"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
2023-06-16 13:27:17 +00:00
|
|
|
issues = Issue.issue_objects.filter(
|
2022-11-29 21:17:42 +00:00
|
|
|
workspace__slug=slug, project_id=project_id, pk__in=issue_ids
|
|
|
|
)
|
|
|
|
|
|
|
|
total_issues = len(issues)
|
|
|
|
|
|
|
|
issues.delete()
|
|
|
|
|
|
|
|
return Response(
|
2022-12-13 17:54:42 +00:00
|
|
|
{"message": f"{total_issues} issues were deleted"},
|
|
|
|
status=status.HTTP_200_OK,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
dev: promote stage release to production (#155)
* refractor: removed modules from user.context
* refractor: removed cycles from user context
* refractor: removed state from user context
* feat: implement channel protocol for tracking issue-activites
* refactor: remove blocking code and add todo
* refactor: refactor the consumer with function modules
* feat: add columns for identifiers for easier redirection
* style: minor padding, coloring and consistency changes
* feat: track blocker issues
* feat: track issue after creation
* feat: add runworker in procfile
* refractor: moved all context provider to _app for more clarity
* dev: added our icons
* refractor: removed issues from user context
* refactor: rename db names to plural and remove admin register file
* refactor: integrate permission layer in endpoints
* feat: create product email html templates
* refractor: changed to getServerSide from getInitialProps, removed unused component imports and minor refractoring
* feat: remirror added
* feat: workspace member user details endpoint
* fix: resolved build issue
* refactor: remove www
* feat: workspace details on user endpoint
* feat: added authorization in project settings
refractor: improved code readability
* fix: removed hard-coded workspace slug value, and added workspace in user interface
* refactor: invitation workflow for already existing users
* feat: modified remirror, fix: issue details sidebar
* fix: merge conflicts
* fix: merge conflicts
* fix: added missing dependencies
* refactor: remove user dependency from invitations
* refactor: issue description context is updated with manager
* dev: redis instance rewrite for ssl settings and remove REDIS_TLS env variable
* chore: upgrade python package requirements
* dev: added new migrations for changes
* dev: ssl config for django channels redis connection
* chore: upgrade channels requirements
* refactor: better function for connecting with redis ssl django channels
* chore: cleanup on manifest file
* revert: user endpoint changes
* build: setup asgi
* refactor: update invitation endpoint to do bulk operations
* style: cycles page, custom listbox, issue details page
* refractor: removed folder that were moved to workspaceSlug
* dev: uvicorn in requirements
* Update index.tsx
* refactor: get workspace slug on user endpoint
* fix: workspace slug redirections and slug value in user context
* fix: user context bugs, drag and drop in cycles and modules
* fix: merge conflicts
* fix: user context and create issue modal
* refactor: add extra columns for json and html description and script for back migrating old issues
* refactor: move all 500 errors to 400
* refractor: removed active project, active workspace, projects, and workspaces from user context
* refractor: change from /home to /, added home page redirection logic
added explict GET method on fetch request, and fixed invitation page not fetching all invitations
* fix: passing project id in command palette
* style: home page, feat: image in remirror
* fix: bugs
* chore: remove test_runner workflow from github actions
* dev: update Procfile worker count and python runtime upgrade
* refactor: update response from 404 to 403
* feat: filtering using both name and issue identifier in command palette
showing my issues instead of project issue in command palette, hiding again according to route in command palette
* fix: mutation on different CRUD operations
* fix: redirection in my issues pages
* feat: added authorization in workspace settings, moved command palette to app-layout
* feat: endpoint and column to store my issue props
* style: authorization new design,
fix: made whole button on authorization page clickable, lib/auth on unsuccessful api call redirecting to error page
* feat: return project details on modules and cycles
* fix: create cycle and state coming below issue modal, showing loader for rich text editor
refractor: changed from sprint to cycle in issue type
* fix: issue delete mustation
and some code refractor
* fix: mutation bugs, remirror bugs, style: consistent droopdowns and buttons
* feat: user role in model
* dev: added new migrations
* fix: add url for workspace availability check
* feat: onboarding screens
* fix: update url for workspace name check and add authentication layer and
fix invitation endpoint
* refactor: bulk invitations message
* refactor: response on workspace invitarions
* refactor: update identifier endpoint
* refactor: invitations endpoint
* feat: onboarding logic and validations
* fix: email striep
* dev: added workspace space member unique_together
* chore: back populate neccesary data for description field
* feat: emoji-picker gets close on select, public will be default option in create project
* fix: update error in project creation
* fix: mutation error on issue count in kanban view
some minor code refractoring
* fix: module bugs
* fix: issue activities and issue comments mutation handled at issue detail
* fix: error message for creating updates without permissions
* fix: showing no user left to invite in project invite
fix: - mutation in project settings control, style: - showing loader in project settings controller, - showing request pending for user that hasn't accepted invitation
* refactor: file asset upload directory
* fix: update last workspace id on user invitation accept
* style: onboarding screens
* style: cycles, issue activity
* feat: add json and html column in issue comments
* fix: submitting create issue modal on enter click, project not getting deselected
* feat: file size validator
* fix: emoji picker not closing on all emoji select
* feat: added validation in identifier such that it only accept uppercase text
* dev: commenting is now richer
* fix: shortcuts not getting opened in settings layouts
* style: showing sidebar on unauthorized pages
* fix: error code on exception
* fix: add issue button is working on my issues pages
* feat: new way of assets
* fix: updated activity content for description field
* fix: mutation on project settings control
style: blocker and blocked changed to outline button
* fix: description activity logging
* refactor: check for workspace slug on workspace creation
* fix: typo on workspace url check
* fix: workspace name uniqueness
* fix: remove workspace from read only field
* fix: file upload endpoint, workspace slug check
* chore: drop unique_together constraint for name and workspace
* chore: settings files cleanup and use PubSub backend on django channels
* chore: change in channels backend
* refactor: issue activity api to combine comments
* fix: instance created at key
* fix: result list
* style: create project, cycle modal, view dropdown
* feat: merged issue activities and issue comments into a single section
* fix: remirror dynamic update of issue description
* fix: removed commented code
* fix: issue acitivties mutation
* fix: empty comments cant be submitted
* fix: workspace avatar has been updated while loading
* refactor: update docker-compose to run redis and database in heroku and docker environment
* refactor: removesingle docker file configuration
* refactor: update take off script to run in asgi
* docs: added workspace, quickstart documentation
* fix: reading editor values on focus out
* refactor: cleanup environment variables and create .env.example
* refactor: add extra variables in example env
* fix: warning and erros on console
lazy loading images with low priority, added validation on onboarding for user to either join or create workspace, on onboarding user can't click button while form is getting submitted, profile page going into loading state when updated, refractor: made some state local, removed unnecessary console logs and comments, changed some variable and function name to make more sence
* feat: env examples
* fix: workspace member does not exist
* fi: remove pagination from issue list api
* refactor: remove env example from root
* feat: documentation for projects on plane
* feat: create code of conduct and contributing guidelines
* fix: update docker setup to check handle redis
* revert: bring back pagination to avoid breaking
* feat: made image uploader modal, used it in profile page and workspace page,
delete project from project settings page, join project modal in project list page
* feat: create workspace page, style: made ui consistent
* style: updated onboarding and create workspace page design
* style: responsive sidebar
* fix: updated ui imports
2023-01-10 18:25:47 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2022-11-29 21:17:42 +00:00
|
|
|
)
|
2023-01-26 06:11:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SubIssuesEndpoint(BaseAPIView):
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
2023-03-27 18:06:13 +00:00
|
|
|
@method_decorator(gzip_page)
|
2023-01-26 06:11:20 +00:00
|
|
|
def get(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
sub_issues = (
|
2023-07-26 12:22:35 +00:00
|
|
|
Issue.issue_objects.filter(parent_id=issue_id, workspace__slug=slug)
|
2023-01-26 06:11:20 +00:00
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("state")
|
|
|
|
.select_related("parent")
|
|
|
|
.prefetch_related("assignees")
|
|
|
|
.prefetch_related("labels")
|
2023-06-20 04:57:21 +00:00
|
|
|
.annotate(
|
|
|
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
2023-06-22 14:17:56 +00:00
|
|
|
.annotate(
|
|
|
|
link_count=IssueLink.objects.filter(issue=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
attachment_count=IssueAttachment.objects.filter(
|
|
|
|
issue=OuterRef("id")
|
|
|
|
)
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
2023-08-11 07:13:00 +00:00
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"issue_reactions",
|
|
|
|
queryset=IssueReaction.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
2023-01-26 06:11:20 +00:00
|
|
|
)
|
|
|
|
|
2023-04-20 12:44:24 +00:00
|
|
|
state_distribution = (
|
2023-08-11 11:08:03 +00:00
|
|
|
State.objects.filter(
|
|
|
|
workspace__slug=slug, state_issue__parent_id=issue_id
|
2023-04-20 12:44:24 +00:00
|
|
|
)
|
2023-08-11 11:08:03 +00:00
|
|
|
.annotate(state_group=F("group"))
|
|
|
|
.values("state_group")
|
|
|
|
.annotate(state_count=Count("state_group"))
|
|
|
|
.order_by("state_group")
|
2023-04-20 12:44:24 +00:00
|
|
|
)
|
|
|
|
|
2023-08-29 08:04:38 +00:00
|
|
|
result = {
|
|
|
|
item["state_group"]: item["state_count"] for item in state_distribution
|
|
|
|
}
|
2023-04-20 12:44:24 +00:00
|
|
|
|
|
|
|
serializer = IssueLiteSerializer(
|
|
|
|
sub_issues,
|
|
|
|
many=True,
|
|
|
|
)
|
|
|
|
return Response(
|
|
|
|
{
|
|
|
|
"sub_issues": serializer.data,
|
|
|
|
"state_distribution": result,
|
|
|
|
},
|
|
|
|
status=status.HTTP_200_OK,
|
|
|
|
)
|
2023-01-26 06:11:20 +00:00
|
|
|
except Exception as e:
|
2023-04-21 19:34:07 +00:00
|
|
|
capture_exception(e)
|
2023-01-26 06:11:20 +00:00
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-02-14 10:03:53 +00:00
|
|
|
|
|
|
|
# Assign multiple sub issues
|
|
|
|
def post(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
2023-06-16 13:27:17 +00:00
|
|
|
parent_issue = Issue.issue_objects.get(pk=issue_id)
|
2023-02-14 10:03:53 +00:00
|
|
|
sub_issue_ids = request.data.get("sub_issue_ids", [])
|
|
|
|
|
2023-02-14 14:38:04 +00:00
|
|
|
if not len(sub_issue_ids):
|
2023-02-14 10:03:53 +00:00
|
|
|
return Response(
|
|
|
|
{"error": "Sub Issue IDs are required"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
2023-06-16 13:27:17 +00:00
|
|
|
sub_issues = Issue.issue_objects.filter(id__in=sub_issue_ids)
|
2023-02-14 10:03:53 +00:00
|
|
|
|
|
|
|
for sub_issue in sub_issues:
|
|
|
|
sub_issue.parent = parent_issue
|
|
|
|
|
2023-02-14 14:38:04 +00:00
|
|
|
_ = Issue.objects.bulk_update(sub_issues, ["parent"], batch_size=10)
|
|
|
|
|
2023-06-16 13:27:17 +00:00
|
|
|
updated_sub_issues = Issue.issue_objects.filter(id__in=sub_issue_ids)
|
2023-02-14 10:03:53 +00:00
|
|
|
|
|
|
|
return Response(
|
2023-02-14 14:38:04 +00:00
|
|
|
IssueFlatSerializer(updated_sub_issues, many=True).data,
|
2023-02-14 10:03:53 +00:00
|
|
|
status=status.HTTP_200_OK,
|
|
|
|
)
|
|
|
|
except Issue.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"Parent Issue does not exists"}, status=status.HTTP_400_BAD_REQUEST
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-02-27 20:39:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IssueLinkViewSet(BaseViewSet):
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
model = IssueLink
|
|
|
|
serializer_class = IssueLinkSerializer
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
issue_id=self.kwargs.get("issue_id"),
|
|
|
|
)
|
2023-04-10 05:28:22 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="link.activity.created",
|
|
|
|
requested_data=json.dumps(serializer.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id")),
|
|
|
|
project_id=str(self.kwargs.get("project_id")),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
|
|
|
|
|
|
|
def perform_update(self, serializer):
|
|
|
|
requested_data = json.dumps(self.request.data, cls=DjangoJSONEncoder)
|
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
|
|
|
if current_instance is not None:
|
|
|
|
issue_activity.delay(
|
|
|
|
type="link.activity.updated",
|
|
|
|
requested_data=requested_data,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueLinkSerializer(current_instance).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
return super().perform_update(serializer)
|
|
|
|
|
|
|
|
def perform_destroy(self, instance):
|
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
|
|
|
if current_instance is not None:
|
|
|
|
issue_activity.delay(
|
|
|
|
type="link.activity.deleted",
|
|
|
|
requested_data=json.dumps(
|
|
|
|
{"link_id": str(self.kwargs.get("pk", None))}
|
|
|
|
),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueLinkSerializer(current_instance).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
return super().perform_destroy(instance)
|
2023-02-27 20:39:22 +00:00
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
2023-03-25 05:44:05 +00:00
|
|
|
.order_by("-created_at")
|
2023-02-27 20:39:22 +00:00
|
|
|
.distinct()
|
|
|
|
)
|
2023-03-15 17:54:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BulkCreateIssueLabelsEndpoint(BaseAPIView):
|
|
|
|
def post(self, request, slug, project_id):
|
|
|
|
try:
|
|
|
|
label_data = request.data.get("label_data", [])
|
|
|
|
project = Project.objects.get(pk=project_id)
|
|
|
|
|
|
|
|
labels = Label.objects.bulk_create(
|
|
|
|
[
|
|
|
|
Label(
|
|
|
|
name=label.get("name", "Migrated"),
|
|
|
|
description=label.get("description", "Migrated Issue"),
|
|
|
|
color="#" + "%06x" % random.randint(0, 0xFFFFFF),
|
|
|
|
project_id=project_id,
|
|
|
|
workspace_id=project.workspace_id,
|
|
|
|
created_by=request.user,
|
|
|
|
updated_by=request.user,
|
|
|
|
)
|
|
|
|
for label in label_data
|
|
|
|
],
|
|
|
|
batch_size=50,
|
|
|
|
ignore_conflicts=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(
|
|
|
|
{"labels": LabelSerializer(labels, many=True).data},
|
|
|
|
status=status.HTTP_201_CREATED,
|
|
|
|
)
|
|
|
|
except Project.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Project Does not exist"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-04-04 18:47:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IssueAttachmentEndpoint(BaseAPIView):
|
|
|
|
serializer_class = IssueAttachmentSerializer
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
model = IssueAttachment
|
|
|
|
parser_classes = (MultiPartParser, FormParser)
|
|
|
|
|
|
|
|
def post(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
serializer = IssueAttachmentSerializer(data=request.data)
|
|
|
|
if serializer.is_valid():
|
|
|
|
serializer.save(project_id=project_id, issue_id=issue_id)
|
2023-04-10 05:28:22 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="attachment.activity.created",
|
2023-04-12 19:03:50 +00:00
|
|
|
requested_data=None,
|
2023-04-10 05:28:22 +00:00
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
serializer.data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
|
|
|
)
|
2023-06-05 07:21:12 +00:00
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
2023-04-04 18:47:55 +00:00
|
|
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def delete(self, request, slug, project_id, issue_id, pk):
|
|
|
|
try:
|
|
|
|
issue_attachment = IssueAttachment.objects.get(pk=pk)
|
2023-04-12 19:03:37 +00:00
|
|
|
issue_attachment.asset.delete(save=False)
|
2023-04-04 18:47:55 +00:00
|
|
|
issue_attachment.delete()
|
2023-04-10 05:28:22 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="attachment.activity.deleted",
|
2023-04-12 19:03:50 +00:00
|
|
|
requested_data=None,
|
2023-04-10 05:28:22 +00:00
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
|
|
|
|
2023-04-04 18:47:55 +00:00
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except IssueAttachment.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue Attachment does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def get(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
issue_attachments = IssueAttachment.objects.filter(
|
|
|
|
issue_id=issue_id, workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
serilaizer = IssueAttachmentSerializer(issue_attachments, many=True)
|
|
|
|
return Response(serilaizer.data, status=status.HTTP_200_OK)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-07-11 08:06:31 +00:00
|
|
|
|
|
|
|
|
2023-07-11 09:05:20 +00:00
|
|
|
class IssueArchiveViewSet(BaseViewSet):
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
serializer_class = IssueFlatSerializer
|
|
|
|
model = Issue
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
|
|
|
Issue.objects.annotate(
|
|
|
|
sub_issues_count=Issue.objects.filter(parent=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.filter(archived_at__isnull=False)
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("state")
|
|
|
|
.select_related("parent")
|
|
|
|
.prefetch_related("assignees")
|
|
|
|
.prefetch_related("labels")
|
|
|
|
)
|
|
|
|
|
|
|
|
@method_decorator(gzip_page)
|
|
|
|
def list(self, request, slug, project_id):
|
|
|
|
try:
|
|
|
|
filters = issue_filters(request.query_params, "GET")
|
|
|
|
show_sub_issues = request.GET.get("show_sub_issues", "true")
|
|
|
|
|
|
|
|
# Custom ordering for priority and state
|
2023-09-12 07:36:49 +00:00
|
|
|
priority_order = ["urgent", "high", "medium", "low", "none"]
|
2023-07-11 09:05:20 +00:00
|
|
|
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]
|
|
|
|
|
|
|
|
order_by_param = request.GET.get("order_by", "-created_at")
|
|
|
|
|
|
|
|
issue_queryset = (
|
|
|
|
self.get_queryset()
|
|
|
|
.filter(**filters)
|
2023-07-17 07:47:11 +00:00
|
|
|
.annotate(cycle_id=F("issue_cycle__cycle_id"))
|
|
|
|
.annotate(module_id=F("issue_module__module_id"))
|
2023-07-11 09:05:20 +00:00
|
|
|
.annotate(
|
|
|
|
link_count=IssueLink.objects.filter(issue=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
attachment_count=IssueAttachment.objects.filter(
|
|
|
|
issue=OuterRef("id")
|
|
|
|
)
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Priority Ordering
|
|
|
|
if order_by_param == "priority" or order_by_param == "-priority":
|
|
|
|
priority_order = (
|
|
|
|
priority_order
|
|
|
|
if order_by_param == "priority"
|
|
|
|
else priority_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
priority_order=Case(
|
|
|
|
*[
|
|
|
|
When(priority=p, then=Value(i))
|
|
|
|
for i, p in enumerate(priority_order)
|
|
|
|
],
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("priority_order")
|
|
|
|
|
|
|
|
# State Ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"state__name",
|
|
|
|
"state__group",
|
|
|
|
"-state__name",
|
|
|
|
"-state__group",
|
|
|
|
]:
|
|
|
|
state_order = (
|
|
|
|
state_order
|
|
|
|
if order_by_param in ["state__name", "state__group"]
|
|
|
|
else state_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
state_order=Case(
|
|
|
|
*[
|
|
|
|
When(state__group=state_group, then=Value(i))
|
|
|
|
for i, state_group in enumerate(state_order)
|
|
|
|
],
|
|
|
|
default=Value(len(state_order)),
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("state_order")
|
|
|
|
# assignee and label ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"labels__name",
|
|
|
|
"-labels__name",
|
|
|
|
"assignees__first_name",
|
|
|
|
"-assignees__first_name",
|
|
|
|
]:
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
max_values=Max(
|
|
|
|
order_by_param[1::]
|
|
|
|
if order_by_param.startswith("-")
|
|
|
|
else order_by_param
|
|
|
|
)
|
|
|
|
).order_by(
|
|
|
|
"-max_values" if order_by_param.startswith("-") else "max_values"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
|
|
|
|
|
|
|
issue_queryset = (
|
|
|
|
issue_queryset
|
|
|
|
if show_sub_issues == "true"
|
|
|
|
else issue_queryset.filter(parent__isnull=True)
|
|
|
|
)
|
|
|
|
|
|
|
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
|
|
|
|
|
|
|
## Grouping the results
|
|
|
|
group_by = request.GET.get("group_by", False)
|
|
|
|
if group_by:
|
|
|
|
return Response(
|
|
|
|
group_results(issues, group_by), status=status.HTTP_200_OK
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(issues, status=status.HTTP_200_OK)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def retrieve(self, request, slug, project_id, pk=None):
|
|
|
|
try:
|
|
|
|
issue = Issue.objects.get(
|
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
archived_at__isnull=False,
|
|
|
|
pk=pk,
|
|
|
|
)
|
|
|
|
return Response(IssueSerializer(issue).data, status=status.HTTP_200_OK)
|
|
|
|
except Issue.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue Does not exist"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def unarchive(self, request, slug, project_id, pk=None):
|
|
|
|
try:
|
|
|
|
issue = Issue.objects.get(
|
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
archived_at__isnull=False,
|
|
|
|
pk=pk,
|
|
|
|
)
|
|
|
|
issue.archived_at = None
|
|
|
|
issue.save()
|
|
|
|
issue_activity.delay(
|
|
|
|
type="issue.activity.updated",
|
2023-07-13 08:17:24 +00:00
|
|
|
requested_data=json.dumps({"archived_at": None}),
|
2023-07-11 09:05:20 +00:00
|
|
|
actor_id=str(request.user.id),
|
|
|
|
issue_id=str(issue.id),
|
|
|
|
project_id=str(project_id),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(IssueSerializer(issue).data, status=status.HTTP_200_OK)
|
|
|
|
except Issue.DoesNotExist:
|
|
|
|
return Response(
|
2023-07-24 06:53:34 +00:00
|
|
|
{"error": "Issue Does not exist"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
2023-07-11 09:05:20 +00:00
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong, please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
2023-07-24 06:53:34 +00:00
|
|
|
|
2023-07-11 08:06:31 +00:00
|
|
|
class IssueSubscriberViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssueSubscriberSerializer
|
|
|
|
model = IssueSubscriber
|
|
|
|
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
def get_permissions(self):
|
|
|
|
if self.action in ["subscribe", "unsubscribe", "subscription_status"]:
|
|
|
|
self.permission_classes = [
|
|
|
|
ProjectLitePermission,
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
self.permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
return super(IssueSubscriberViewSet, self).get_permissions()
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
issue_id=self.kwargs.get("issue_id"),
|
|
|
|
)
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.order_by("-created_at")
|
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
|
|
|
|
def list(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
2023-07-24 06:53:34 +00:00
|
|
|
members = (
|
|
|
|
ProjectMember.objects.filter(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
is_subscribed=Exists(
|
|
|
|
IssueSubscriber.objects.filter(
|
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
issue_id=issue_id,
|
|
|
|
subscriber=OuterRef("member"),
|
|
|
|
)
|
2023-07-11 08:06:31 +00:00
|
|
|
)
|
|
|
|
)
|
2023-07-24 06:53:34 +00:00
|
|
|
.select_related("member")
|
|
|
|
)
|
2023-07-11 08:06:31 +00:00
|
|
|
serializer = ProjectMemberLiteSerializer(members, many=True)
|
|
|
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": e},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, issue_id, subscriber_id):
|
|
|
|
try:
|
|
|
|
issue_subscriber = IssueSubscriber.objects.get(
|
|
|
|
project=project_id,
|
|
|
|
subscriber=subscriber_id,
|
|
|
|
workspace__slug=slug,
|
|
|
|
issue=issue_id,
|
|
|
|
)
|
|
|
|
issue_subscriber.delete()
|
|
|
|
return Response(
|
|
|
|
status=status.HTTP_204_NO_CONTENT,
|
|
|
|
)
|
|
|
|
except IssueSubscriber.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "User is not subscribed to this issue"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def subscribe(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
if IssueSubscriber.objects.filter(
|
|
|
|
issue_id=issue_id,
|
|
|
|
subscriber=request.user,
|
|
|
|
workspace__slug=slug,
|
|
|
|
project=project_id,
|
|
|
|
).exists():
|
|
|
|
return Response(
|
|
|
|
{"message": "User already subscribed to the issue."},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
subscriber = IssueSubscriber.objects.create(
|
|
|
|
issue_id=issue_id,
|
|
|
|
subscriber_id=request.user.id,
|
|
|
|
project_id=project_id,
|
|
|
|
)
|
|
|
|
serilaizer = IssueSubscriberSerializer(subscriber)
|
|
|
|
return Response(serilaizer.data, status=status.HTTP_201_CREATED)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong, please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def unsubscribe(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
issue_subscriber = IssueSubscriber.objects.get(
|
|
|
|
project=project_id,
|
|
|
|
subscriber=request.user,
|
|
|
|
workspace__slug=slug,
|
|
|
|
issue=issue_id,
|
|
|
|
)
|
|
|
|
issue_subscriber.delete()
|
|
|
|
return Response(
|
|
|
|
status=status.HTTP_204_NO_CONTENT,
|
|
|
|
)
|
|
|
|
except IssueSubscriber.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "User subscribed to this issue"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def subscription_status(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
issue_subscriber = IssueSubscriber.objects.filter(
|
|
|
|
issue=issue_id,
|
|
|
|
subscriber=request.user,
|
|
|
|
workspace__slug=slug,
|
|
|
|
project=project_id,
|
|
|
|
).exists()
|
|
|
|
return Response({"subscribed": issue_subscriber}, status=status.HTTP_200_OK)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong, please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-07-31 05:12:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IssueReactionViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssueReactionSerializer
|
|
|
|
model = IssueReaction
|
|
|
|
permission_classes = [
|
|
|
|
ProjectLitePermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.order_by("-created_at")
|
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
issue_id=self.kwargs.get("issue_id"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
actor=self.request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_reaction.activity.created",
|
|
|
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
2023-07-31 05:12:17 +00:00
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, issue_id, reaction_code):
|
|
|
|
try:
|
|
|
|
issue_reaction = IssueReaction.objects.get(
|
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
issue_id=issue_id,
|
|
|
|
reaction=reaction_code,
|
|
|
|
actor=request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_reaction.activity.deleted",
|
|
|
|
requested_data=None,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
{
|
|
|
|
"reaction": str(reaction_code),
|
|
|
|
"identifier": str(issue_reaction.id),
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2023-07-31 05:12:17 +00:00
|
|
|
issue_reaction.delete()
|
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except IssueReaction.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue reaction does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CommentReactionViewSet(BaseViewSet):
|
|
|
|
serializer_class = CommentReactionSerializer
|
|
|
|
model = CommentReaction
|
|
|
|
permission_classes = [
|
|
|
|
ProjectLitePermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(comment_id=self.kwargs.get("comment_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.order_by("-created_at")
|
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
|
|
|
|
def perform_create(self, serializer):
|
|
|
|
serializer.save(
|
|
|
|
actor=self.request.user,
|
|
|
|
comment_id=self.kwargs.get("comment_id"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="comment_reaction.activity.created",
|
|
|
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=None,
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
2023-07-31 05:12:17 +00:00
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, comment_id, reaction_code):
|
|
|
|
try:
|
|
|
|
comment_reaction = CommentReaction.objects.get(
|
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
comment_id=comment_id,
|
|
|
|
reaction=reaction_code,
|
|
|
|
actor=request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="comment_reaction.activity.deleted",
|
|
|
|
requested_data=None,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=None,
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
{
|
|
|
|
"reaction": str(reaction_code),
|
|
|
|
"identifier": str(comment_reaction.id),
|
2023-08-31 18:38:40 +00:00
|
|
|
"comment_id": str(comment_id),
|
2023-08-30 11:08:04 +00:00
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2023-07-31 05:12:17 +00:00
|
|
|
comment_reaction.delete()
|
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except CommentReaction.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Comment reaction does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-08-07 06:29:04 +00:00
|
|
|
|
|
|
|
|
2023-08-11 13:57:44 +00:00
|
|
|
class IssueCommentPublicViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssueCommentSerializer
|
|
|
|
model = IssueComment
|
|
|
|
|
|
|
|
filterset_fields = [
|
|
|
|
"issue__id",
|
|
|
|
"workspace__id",
|
|
|
|
]
|
|
|
|
|
2023-08-31 18:38:40 +00:00
|
|
|
def get_permissions(self):
|
|
|
|
if self.action in ["list", "retrieve"]:
|
|
|
|
self.permission_classes = [
|
|
|
|
AllowAny,
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
self.permission_classes = [
|
|
|
|
IsAuthenticated,
|
|
|
|
]
|
|
|
|
|
|
|
|
return super(IssueCommentPublicViewSet, self).get_permissions()
|
|
|
|
|
2023-08-11 13:57:44 +00:00
|
|
|
def get_queryset(self):
|
2023-09-02 14:13:17 +00:00
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=self.kwargs.get("slug"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
)
|
|
|
|
if project_deploy_board.comments:
|
|
|
|
return self.filter_queryset(
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(access="EXTERNAL")
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("issue")
|
|
|
|
.annotate(
|
|
|
|
is_member=Exists(
|
|
|
|
ProjectMember.objects.filter(
|
|
|
|
workspace__slug=self.kwargs.get("slug"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
member_id=self.request.user.id,
|
|
|
|
)
|
2023-08-29 08:04:38 +00:00
|
|
|
)
|
|
|
|
)
|
2023-09-02 14:13:17 +00:00
|
|
|
.distinct()
|
2023-09-07 07:51:05 +00:00
|
|
|
).order_by("created_at")
|
2023-09-02 14:13:17 +00:00
|
|
|
else:
|
|
|
|
return IssueComment.objects.none()
|
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
2023-08-11 13:57:44 +00:00
|
|
|
return IssueComment.objects.none()
|
|
|
|
|
|
|
|
def create(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
if not project_deploy_board.comments:
|
|
|
|
return Response(
|
|
|
|
{"error": "Comments are not enabled for this project"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
serializer = IssueCommentSerializer(data=request.data)
|
|
|
|
if serializer.is_valid():
|
|
|
|
serializer.save(
|
|
|
|
project_id=project_id,
|
|
|
|
issue_id=issue_id,
|
|
|
|
actor=request.user,
|
2023-08-29 08:04:38 +00:00
|
|
|
access="EXTERNAL",
|
2023-08-11 13:57:44 +00:00
|
|
|
)
|
|
|
|
issue_activity.delay(
|
|
|
|
type="comment.activity.created",
|
|
|
|
requested_data=json.dumps(serializer.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(request.user.id),
|
|
|
|
issue_id=str(issue_id),
|
|
|
|
project_id=str(project_id),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
2023-08-30 06:45:08 +00:00
|
|
|
if not ProjectMember.objects.filter(
|
|
|
|
project_id=project_id,
|
|
|
|
member=request.user,
|
|
|
|
).exists():
|
|
|
|
# Add the user for workspace tracking
|
|
|
|
_ = ProjectPublicMember.objects.get_or_create(
|
|
|
|
project_id=project_id,
|
|
|
|
member=request.user,
|
|
|
|
)
|
|
|
|
|
2023-08-11 13:57:44 +00:00
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
|
|
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def partial_update(self, request, slug, project_id, issue_id, pk):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
if not project_deploy_board.comments:
|
|
|
|
return Response(
|
|
|
|
{"error": "Comments are not enabled for this project"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
comment = IssueComment.objects.get(
|
|
|
|
workspace__slug=slug, pk=pk, actor=request.user
|
|
|
|
)
|
|
|
|
serializer = IssueCommentSerializer(
|
|
|
|
comment, data=request.data, partial=True
|
|
|
|
)
|
|
|
|
if serializer.is_valid():
|
|
|
|
serializer.save()
|
|
|
|
issue_activity.delay(
|
|
|
|
type="comment.activity.updated",
|
|
|
|
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(request.user.id),
|
|
|
|
issue_id=str(issue_id),
|
|
|
|
project_id=str(project_id),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueCommentSerializer(comment).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
|
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
except (IssueComment.DoesNotExist, ProjectDeployBoard.DoesNotExist):
|
|
|
|
return Response(
|
|
|
|
{"error": "IssueComent Does not exists"},
|
2023-08-29 08:04:38 +00:00
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, issue_id, pk):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
if not project_deploy_board.comments:
|
|
|
|
return Response(
|
|
|
|
{"error": "Comments are not enabled for this project"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
comment = IssueComment.objects.get(
|
|
|
|
workspace__slug=slug, pk=pk, project_id=project_id, actor=request.user
|
|
|
|
)
|
|
|
|
issue_activity.delay(
|
|
|
|
type="comment.activity.deleted",
|
|
|
|
requested_data=json.dumps({"comment_id": str(pk)}),
|
|
|
|
actor_id=str(request.user.id),
|
|
|
|
issue_id=str(issue_id),
|
|
|
|
project_id=str(project_id),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueCommentSerializer(comment).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
comment.delete()
|
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except (IssueComment.DoesNotExist, ProjectDeployBoard.DoesNotExist):
|
|
|
|
return Response(
|
|
|
|
{"error": "IssueComent Does not exists"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class IssueReactionPublicViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssueReactionSerializer
|
|
|
|
model = IssueReaction
|
|
|
|
|
|
|
|
def get_queryset(self):
|
2023-09-02 14:13:17 +00:00
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=self.kwargs.get("slug"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
)
|
|
|
|
if project_deploy_board.reactions:
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.order_by("-created_at")
|
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
return IssueReaction.objects.none()
|
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
2023-08-11 13:57:44 +00:00
|
|
|
return IssueReaction.objects.none()
|
|
|
|
|
|
|
|
def create(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
if not project_deploy_board.reactions:
|
|
|
|
return Response(
|
|
|
|
{"error": "Reactions are not enabled for this project board"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
serializer = IssueReactionSerializer(data=request.data)
|
|
|
|
if serializer.is_valid():
|
|
|
|
serializer.save(
|
|
|
|
project_id=project_id, issue_id=issue_id, actor=request.user
|
|
|
|
)
|
2023-08-30 06:45:08 +00:00
|
|
|
if not ProjectMember.objects.filter(
|
|
|
|
project_id=project_id,
|
|
|
|
member=request.user,
|
|
|
|
).exists():
|
|
|
|
# Add the user for workspace tracking
|
|
|
|
_ = ProjectPublicMember.objects.get_or_create(
|
|
|
|
project_id=project_id,
|
|
|
|
member=request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_reaction.activity.created",
|
|
|
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=None,
|
2023-08-31 18:38:40 +00:00
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
|
|
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Project board does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, issue_id, reaction_code):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
if not project_deploy_board.reactions:
|
|
|
|
return Response(
|
|
|
|
{"error": "Reactions are not enabled for this project board"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
issue_reaction = IssueReaction.objects.get(
|
|
|
|
workspace__slug=slug,
|
|
|
|
issue_id=issue_id,
|
|
|
|
reaction=reaction_code,
|
|
|
|
actor=request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_reaction.activity.deleted",
|
|
|
|
requested_data=None,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
{
|
|
|
|
"reaction": str(reaction_code),
|
|
|
|
"identifier": str(issue_reaction.id),
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
issue_reaction.delete()
|
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except IssueReaction.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue reaction does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CommentReactionPublicViewSet(BaseViewSet):
|
|
|
|
serializer_class = CommentReactionSerializer
|
|
|
|
model = CommentReaction
|
|
|
|
|
|
|
|
def get_queryset(self):
|
2023-09-02 14:13:17 +00:00
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=self.kwargs.get("slug"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
)
|
|
|
|
if project_deploy_board.reactions:
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(comment_id=self.kwargs.get("comment_id"))
|
|
|
|
.order_by("-created_at")
|
|
|
|
.distinct()
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
return CommentReaction.objects.none()
|
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
2023-08-11 13:57:44 +00:00
|
|
|
return CommentReaction.objects.none()
|
|
|
|
|
|
|
|
def create(self, request, slug, project_id, comment_id):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
if not project_deploy_board.reactions:
|
|
|
|
return Response(
|
|
|
|
{"error": "Reactions are not enabled for this board"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
serializer = CommentReactionSerializer(data=request.data)
|
|
|
|
if serializer.is_valid():
|
|
|
|
serializer.save(
|
|
|
|
project_id=project_id, comment_id=comment_id, actor=request.user
|
|
|
|
)
|
2023-08-30 06:45:08 +00:00
|
|
|
if not ProjectMember.objects.filter(
|
|
|
|
project_id=project_id, member=request.user
|
|
|
|
).exists():
|
|
|
|
# Add the user for workspace tracking
|
|
|
|
_ = ProjectPublicMember.objects.get_or_create(
|
|
|
|
project_id=project_id,
|
|
|
|
member=request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="comment_reaction.activity.created",
|
|
|
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=None,
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=None,
|
2023-08-31 18:38:40 +00:00
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
|
|
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
2023-08-30 11:08:04 +00:00
|
|
|
except IssueComment.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Comment does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Project board does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, comment_id, reaction_code):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
if not project_deploy_board.reactions:
|
|
|
|
return Response(
|
|
|
|
{"error": "Reactions are not enabled for this board"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
comment_reaction = CommentReaction.objects.get(
|
|
|
|
project_id=project_id,
|
|
|
|
workspace__slug=slug,
|
|
|
|
comment_id=comment_id,
|
|
|
|
reaction=reaction_code,
|
|
|
|
actor=request.user,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="comment_reaction.activity.deleted",
|
|
|
|
requested_data=None,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=None,
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
{
|
|
|
|
"reaction": str(reaction_code),
|
|
|
|
"identifier": str(comment_reaction.id),
|
2023-08-31 18:38:40 +00:00
|
|
|
"comment_id": str(comment_id),
|
2023-08-30 11:08:04 +00:00
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
comment_reaction.delete()
|
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except CommentReaction.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Comment reaction does not exist"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class IssueVotePublicViewSet(BaseViewSet):
|
|
|
|
model = IssueVote
|
|
|
|
serializer_class = IssueVoteSerializer
|
|
|
|
|
|
|
|
def get_queryset(self):
|
2023-09-02 14:13:17 +00:00
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=self.kwargs.get("slug"),
|
|
|
|
project_id=self.kwargs.get("project_id"),
|
|
|
|
)
|
|
|
|
if project_deploy_board.votes:
|
|
|
|
return (
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
return IssueVote.objects.none()
|
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
|
|
|
return IssueVote.objects.none()
|
2023-08-11 13:57:44 +00:00
|
|
|
|
|
|
|
def create(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
issue_vote, _ = IssueVote.objects.get_or_create(
|
|
|
|
actor_id=request.user.id,
|
|
|
|
project_id=project_id,
|
|
|
|
issue_id=issue_id,
|
|
|
|
)
|
2023-08-30 06:45:08 +00:00
|
|
|
# Add the user for workspace tracking
|
|
|
|
if not ProjectMember.objects.filter(
|
|
|
|
project_id=project_id, member=request.user
|
|
|
|
).exists():
|
|
|
|
_ = ProjectPublicMember.objects.get_or_create(
|
|
|
|
project_id=project_id,
|
|
|
|
member=request.user,
|
|
|
|
)
|
2023-08-29 09:32:29 +00:00
|
|
|
issue_vote.vote = request.data.get("vote", 1)
|
|
|
|
issue_vote.save()
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
2023-08-31 18:38:40 +00:00
|
|
|
type="issue_vote.activity.created",
|
|
|
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
serializer = IssueVoteSerializer(issue_vote)
|
|
|
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
2023-09-02 14:13:17 +00:00
|
|
|
except IntegrityError:
|
2023-09-04 09:08:39 +00:00
|
|
|
return Response(
|
|
|
|
{"error": "Reaction already exists"}, status=status.HTTP_400_BAD_REQUEST
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def destroy(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
issue_vote = IssueVote.objects.get(
|
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
issue_id=issue_id,
|
|
|
|
actor_id=request.user.id,
|
|
|
|
)
|
2023-08-30 11:08:04 +00:00
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_vote.activity.deleted",
|
|
|
|
requested_data=None,
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
{
|
|
|
|
"vote": str(issue_vote.vote),
|
|
|
|
"identifier": str(issue_vote.id),
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2023-08-11 13:57:44 +00:00
|
|
|
issue_vote.delete()
|
|
|
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
2023-08-29 09:30:26 +00:00
|
|
|
|
|
|
|
|
2023-09-13 06:55:10 +00:00
|
|
|
class IssueRelationViewSet(BaseViewSet):
|
|
|
|
serializer_class = IssueRelationSerializer
|
|
|
|
model = IssueRelation
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
|
|
|
|
def perform_destroy(self, instance):
|
|
|
|
current_instance = (
|
|
|
|
self.get_queryset().filter(pk=self.kwargs.get("pk", None)).first()
|
|
|
|
)
|
|
|
|
if current_instance is not None:
|
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_relation.activity.deleted",
|
|
|
|
requested_data=json.dumps({"related_list": None}),
|
|
|
|
actor_id=str(self.request.user.id),
|
|
|
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
|
|
|
project_id=str(self.kwargs.get("project_id", None)),
|
|
|
|
current_instance=json.dumps(
|
|
|
|
IssueRelationSerializer(current_instance).data,
|
|
|
|
cls=DjangoJSONEncoder,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
return super().perform_destroy(instance)
|
|
|
|
|
|
|
|
def create(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
related_list = request.data.get("related_list", [])
|
|
|
|
project = Project.objects.get(pk=project_id)
|
|
|
|
|
|
|
|
issueRelation = IssueRelation.objects.bulk_create(
|
|
|
|
[
|
|
|
|
IssueRelation(
|
|
|
|
issue_id=related_issue["issue"],
|
|
|
|
related_issue_id=related_issue["related_issue"],
|
|
|
|
relation_type=related_issue["relation_type"],
|
|
|
|
project_id=project_id,
|
|
|
|
workspace_id=project.workspace_id,
|
|
|
|
created_by=request.user,
|
|
|
|
updated_by=request.user,
|
|
|
|
)
|
|
|
|
for related_issue in related_list
|
|
|
|
],
|
|
|
|
batch_size=10,
|
|
|
|
ignore_conflicts=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
issue_activity.delay(
|
|
|
|
type="issue_relation.activity.created",
|
|
|
|
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
|
|
|
|
actor_id=str(request.user.id),
|
|
|
|
issue_id=str(issue_id),
|
|
|
|
project_id=str(project_id),
|
|
|
|
current_instance=None,
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(
|
|
|
|
IssueRelationSerializer(issueRelation, many=True).data,
|
|
|
|
status=status.HTTP_201_CREATED,
|
|
|
|
)
|
|
|
|
except IntegrityError as e:
|
|
|
|
if "already exists" in str(e):
|
|
|
|
return Response(
|
|
|
|
{"name": "The issue is already taken"},
|
|
|
|
status=status.HTTP_410_GONE,
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return self.filter_queryset(
|
|
|
|
super()
|
|
|
|
.get_queryset()
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(issue_id=self.kwargs.get("issue_id"))
|
|
|
|
.filter(project__project_projectmember__member=self.request.user)
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("issue")
|
|
|
|
.distinct()
|
|
|
|
)
|
2023-08-29 09:30:26 +00:00
|
|
|
class IssueRetrievePublicEndpoint(BaseAPIView):
|
|
|
|
permission_classes = [
|
|
|
|
AllowAny,
|
|
|
|
]
|
|
|
|
|
|
|
|
def get(self, request, slug, project_id, issue_id):
|
|
|
|
try:
|
|
|
|
issue = Issue.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id, pk=issue_id
|
|
|
|
)
|
|
|
|
serializer = IssuePublicSerializer(issue)
|
|
|
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
|
|
|
except Issue.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue Does not exist"}, status=status.HTTP_400_BAD_REQUEST
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
print(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectIssuesPublicEndpoint(BaseAPIView):
|
|
|
|
permission_classes = [
|
|
|
|
AllowAny,
|
|
|
|
]
|
|
|
|
|
|
|
|
def get(self, request, slug, project_id):
|
|
|
|
try:
|
|
|
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
)
|
|
|
|
|
|
|
|
filters = issue_filters(request.query_params, "GET")
|
|
|
|
|
|
|
|
# Custom ordering for priority and state
|
2023-09-12 07:36:49 +00:00
|
|
|
priority_order = ["urgent", "high", "medium", "low", "none"]
|
2023-08-29 09:30:26 +00:00
|
|
|
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]
|
|
|
|
|
|
|
|
order_by_param = request.GET.get("order_by", "-created_at")
|
|
|
|
|
|
|
|
issue_queryset = (
|
|
|
|
Issue.issue_objects.annotate(
|
|
|
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.filter(project_id=project_id)
|
|
|
|
.filter(workspace__slug=slug)
|
|
|
|
.select_related("project", "workspace", "state", "parent")
|
|
|
|
.prefetch_related("assignees", "labels")
|
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"issue_reactions",
|
|
|
|
queryset=IssueReaction.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
2023-09-06 10:34:12 +00:00
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"votes",
|
|
|
|
queryset=IssueVote.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
2023-08-29 09:30:26 +00:00
|
|
|
.filter(**filters)
|
|
|
|
.annotate(cycle_id=F("issue_cycle__cycle_id"))
|
|
|
|
.annotate(module_id=F("issue_module__module_id"))
|
|
|
|
.annotate(
|
|
|
|
link_count=IssueLink.objects.filter(issue=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
attachment_count=IssueAttachment.objects.filter(
|
|
|
|
issue=OuterRef("id")
|
|
|
|
)
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Priority Ordering
|
|
|
|
if order_by_param == "priority" or order_by_param == "-priority":
|
|
|
|
priority_order = (
|
|
|
|
priority_order
|
|
|
|
if order_by_param == "priority"
|
|
|
|
else priority_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
priority_order=Case(
|
|
|
|
*[
|
|
|
|
When(priority=p, then=Value(i))
|
|
|
|
for i, p in enumerate(priority_order)
|
|
|
|
],
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("priority_order")
|
|
|
|
|
|
|
|
# State Ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"state__name",
|
|
|
|
"state__group",
|
|
|
|
"-state__name",
|
|
|
|
"-state__group",
|
|
|
|
]:
|
|
|
|
state_order = (
|
|
|
|
state_order
|
|
|
|
if order_by_param in ["state__name", "state__group"]
|
|
|
|
else state_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
state_order=Case(
|
|
|
|
*[
|
|
|
|
When(state__group=state_group, then=Value(i))
|
|
|
|
for i, state_group in enumerate(state_order)
|
|
|
|
],
|
|
|
|
default=Value(len(state_order)),
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("state_order")
|
|
|
|
# assignee and label ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"labels__name",
|
|
|
|
"-labels__name",
|
|
|
|
"assignees__first_name",
|
|
|
|
"-assignees__first_name",
|
|
|
|
]:
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
max_values=Max(
|
|
|
|
order_by_param[1::]
|
|
|
|
if order_by_param.startswith("-")
|
|
|
|
else order_by_param
|
|
|
|
)
|
|
|
|
).order_by(
|
|
|
|
"-max_values" if order_by_param.startswith("-") else "max_values"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
|
|
|
|
|
|
|
issues = IssuePublicSerializer(issue_queryset, many=True).data
|
|
|
|
|
2023-09-04 09:08:39 +00:00
|
|
|
state_group_order = [
|
|
|
|
"backlog",
|
|
|
|
"unstarted",
|
|
|
|
"started",
|
|
|
|
"completed",
|
|
|
|
"cancelled",
|
|
|
|
]
|
|
|
|
|
|
|
|
states = (
|
|
|
|
State.objects.filter(
|
2023-09-07 07:51:58 +00:00
|
|
|
~Q(name="Triage"),
|
2023-09-04 09:08:39 +00:00
|
|
|
workspace__slug=slug,
|
|
|
|
project_id=project_id,
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
custom_order=Case(
|
|
|
|
*[
|
|
|
|
When(group=value, then=Value(index))
|
|
|
|
for index, value in enumerate(state_group_order)
|
|
|
|
],
|
|
|
|
default=Value(len(state_group_order)),
|
|
|
|
output_field=IntegerField(),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.values("name", "group", "color", "id")
|
|
|
|
.order_by("custom_order", "sequence")
|
|
|
|
)
|
2023-08-29 09:30:26 +00:00
|
|
|
|
|
|
|
labels = Label.objects.filter(
|
|
|
|
workspace__slug=slug, project_id=project_id
|
|
|
|
).values("id", "name", "color", "parent")
|
|
|
|
|
|
|
|
## Grouping the results
|
|
|
|
group_by = request.GET.get("group_by", False)
|
|
|
|
if group_by:
|
|
|
|
issues = group_results(issues, group_by)
|
|
|
|
|
|
|
|
return Response(
|
|
|
|
{
|
|
|
|
"issues": issues,
|
|
|
|
"states": states,
|
|
|
|
"labels": labels,
|
|
|
|
},
|
|
|
|
status=status.HTTP_200_OK,
|
|
|
|
)
|
|
|
|
except ProjectDeployBoard.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Board does not exists"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
2023-08-30 06:45:08 +00:00
|
|
|
)
|
2023-09-13 06:40:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IssueDraftViewSet(BaseViewSet):
|
|
|
|
permission_classes = [
|
|
|
|
ProjectEntityPermission,
|
|
|
|
]
|
|
|
|
serializer_class = IssueFlatSerializer
|
|
|
|
model = Issue
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
return (
|
|
|
|
Issue.objects.annotate(
|
|
|
|
sub_issues_count=Issue.issue_objects.filter(parent=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.filter(project_id=self.kwargs.get("project_id"))
|
|
|
|
.filter(workspace__slug=self.kwargs.get("slug"))
|
|
|
|
.filter(is_draft=True)
|
|
|
|
.select_related("project")
|
|
|
|
.select_related("workspace")
|
|
|
|
.select_related("state")
|
|
|
|
.select_related("parent")
|
|
|
|
.prefetch_related("assignees")
|
|
|
|
.prefetch_related("labels")
|
|
|
|
.prefetch_related(
|
|
|
|
Prefetch(
|
|
|
|
"issue_reactions",
|
|
|
|
queryset=IssueReaction.objects.select_related("actor"),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
@method_decorator(gzip_page)
|
|
|
|
def list(self, request, slug, project_id):
|
|
|
|
try:
|
|
|
|
filters = issue_filters(request.query_params, "GET")
|
|
|
|
|
|
|
|
# Custom ordering for priority and state
|
|
|
|
priority_order = ["urgent", "high", "medium", "low", "none"]
|
|
|
|
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]
|
|
|
|
|
|
|
|
order_by_param = request.GET.get("order_by", "-created_at")
|
|
|
|
|
|
|
|
issue_queryset = (
|
|
|
|
self.get_queryset()
|
|
|
|
.filter(**filters)
|
|
|
|
.annotate(cycle_id=F("issue_cycle__cycle_id"))
|
|
|
|
.annotate(module_id=F("issue_module__module_id"))
|
|
|
|
.annotate(
|
|
|
|
link_count=IssueLink.objects.filter(issue=OuterRef("id"))
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
.annotate(
|
|
|
|
attachment_count=IssueAttachment.objects.filter(
|
|
|
|
issue=OuterRef("id")
|
|
|
|
)
|
|
|
|
.order_by()
|
|
|
|
.annotate(count=Func(F("id"), function="Count"))
|
|
|
|
.values("count")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Priority Ordering
|
|
|
|
if order_by_param == "priority" or order_by_param == "-priority":
|
|
|
|
priority_order = (
|
|
|
|
priority_order
|
|
|
|
if order_by_param == "priority"
|
|
|
|
else priority_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
priority_order=Case(
|
|
|
|
*[
|
|
|
|
When(priority=p, then=Value(i))
|
|
|
|
for i, p in enumerate(priority_order)
|
|
|
|
],
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("priority_order")
|
|
|
|
|
|
|
|
# State Ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"state__name",
|
|
|
|
"state__group",
|
|
|
|
"-state__name",
|
|
|
|
"-state__group",
|
|
|
|
]:
|
|
|
|
state_order = (
|
|
|
|
state_order
|
|
|
|
if order_by_param in ["state__name", "state__group"]
|
|
|
|
else state_order[::-1]
|
|
|
|
)
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
state_order=Case(
|
|
|
|
*[
|
|
|
|
When(state__group=state_group, then=Value(i))
|
|
|
|
for i, state_group in enumerate(state_order)
|
|
|
|
],
|
|
|
|
default=Value(len(state_order)),
|
|
|
|
output_field=CharField(),
|
|
|
|
)
|
|
|
|
).order_by("state_order")
|
|
|
|
# assignee and label ordering
|
|
|
|
elif order_by_param in [
|
|
|
|
"labels__name",
|
|
|
|
"-labels__name",
|
|
|
|
"assignees__first_name",
|
|
|
|
"-assignees__first_name",
|
|
|
|
]:
|
|
|
|
issue_queryset = issue_queryset.annotate(
|
|
|
|
max_values=Max(
|
|
|
|
order_by_param[1::]
|
|
|
|
if order_by_param.startswith("-")
|
|
|
|
else order_by_param
|
|
|
|
)
|
|
|
|
).order_by(
|
|
|
|
"-max_values" if order_by_param.startswith("-") else "max_values"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
issue_queryset = issue_queryset.order_by(order_by_param)
|
|
|
|
|
|
|
|
issues = IssueLiteSerializer(issue_queryset, many=True).data
|
|
|
|
|
|
|
|
## Grouping the results
|
|
|
|
group_by = request.GET.get("group_by", False)
|
|
|
|
if group_by:
|
|
|
|
return Response(
|
|
|
|
group_results(issues, group_by), status=status.HTTP_200_OK
|
|
|
|
)
|
|
|
|
|
|
|
|
return Response(issues, status=status.HTTP_200_OK)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
capture_exception(e)
|
|
|
|
return Response(
|
|
|
|
{"error": "Something went wrong please try again later"},
|
|
|
|
status=status.HTTP_400_BAD_REQUEST,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def retrieve(self, request, slug, project_id, pk=None):
|
|
|
|
try:
|
|
|
|
issue = Issue.objects.get(
|
|
|
|
workspace__slug=slug, project_id=project_id, pk=pk, is_draft=True
|
|
|
|
)
|
|
|
|
return Response(IssueSerializer(issue).data, status=status.HTTP_200_OK)
|
|
|
|
except Issue.DoesNotExist:
|
|
|
|
return Response(
|
|
|
|
{"error": "Issue Does not exist"}, status=status.HTTP_404_NOT_FOUND
|
|
|
|
)
|
|
|
|
|