From 9275e6f373ca48107a36d5744c92acc1ee9a41c1 Mon Sep 17 00:00:00 2001
From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com>
Date: Thu, 20 Jul 2023 15:14:57 +0530
Subject: [PATCH] promote: develop to stage-release (#1589)
* fix: onboarding invitations overflow (#1575)
* fix: onboarding invitations overflow
* fix: user avatar in the notification card
* style: update graph grid color
* fix: no 'Create by me' label coming up (#1573)
* feat: added new issue subscriber table
* dev: notification model
* feat: added CRUD operation for issue subscriber
* Revert "feat: added CRUD operation for issue subscriber"
This reverts commit b22e0625768f0b096b5898936ace76d6882b0736.
* feat: added CRUD operation for issue subscriber
* dev: notification models and operations
* dev: remove delete endpoint response data
* dev: notification endpoints and fix bg worker for saving notifications
* feat: added list and unsubscribe function in issue subscriber
* dev: filter by snoozed and response update for list and permissions
* dev: update issue notifications
* dev: notification segregation
* dev: update notifications
* dev: notification filtering
* dev: add issue name in notifications
* dev: notification new endpoints
* fix: pushing local settings
* feat: notification workflow setup and made basic UI
* style: improved UX with toast alerts and other interactions
refactor: changed classnames according to new theme structure, changed all icons to material icons
* feat: showing un-read notification count
* feat: not showing 'subscribe' button on issue created by user & assigned to user
not showing 'Create by you' for view & guest of the workspace
* fix: 'read' -> 'unread' heading, my issue wrong filter
* feat: made snooze dropdown & modal
feat: switched to calendar
* fix: minor ui fixes
* feat: snooze modal date/time select
* fix: params for read/un-read notification
* style: snooze notification modal
* fix: no label for 'Create by me'
* fix: no label for 'Create by me'
* fix: removed console log
* fix: tooltip going behind popover
---------
Co-authored-by: NarayanBavisetti
Co-authored-by: pablohashescobar
Co-authored-by: Aaryan Khandelwal
* style: tooltip on notification header actions (#1577)
* style: tooltip on notification header
* chore: update tooltip content
---------
Co-authored-by: Aaryan Khandelwal
* fix: user migrations for back population (#1578)
* fix: total notifications count (#1579)
* fix: notification card (#1583)
* feat: add new icons package (#1586)
* feat: add material icons package
* chore: replace issue view icons
* chore: notification ordering (#1584)
* fix: uuid error when cycle and module updates (#1585)
* refactor: height of popover & api fetch call (#1587)
* fix: snooze dropdown overflow (#1588)
---------
Co-authored-by: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com>
Co-authored-by: NarayanBavisetti
Co-authored-by: pablohashescobar
Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com>
---
apiserver/plane/api/views/notification.py | 3 +-
.../plane/bgtasks/issue_activites_task.py | 147 ++++++-----
...archived_at_project_archive_in_and_more.py | 4 +-
.../components/account/email-code-form.tsx | 2 +-
.../core/filters/issues-view-filter.tsx | 36 +--
.../notifications/notification-card.tsx | 229 ++++++++--------
.../notifications/notification-popover.tsx | 111 ++++----
.../components/onboarding/join-workspaces.tsx | 8 +-
.../components/onboarding/tour/sidebar.tsx | 31 ++-
.../project/single-sidebar-project.tsx | 38 ++-
apps/app/components/ui/custom-menu.tsx | 187 -------------
.../components/ui/dropdowns/custom-menu.tsx | 18 +-
.../app/components/workspace/help-section.tsx | 199 ++++----------
.../components/workspace/sidebar-dropdown.tsx | 6 +-
.../app/components/workspace/sidebar-menu.tsx | 25 +-
.../workspace/upgrade-to-pro-modal.tsx | 248 ------------------
apps/app/constants/graph.ts | 4 +-
apps/app/helpers/date-time.helper.ts | 2 +-
apps/app/hooks/use-user-notifications.tsx | 98 ++++---
apps/app/package.json | 2 +
apps/app/pages/[workspaceSlug]/index.tsx | 8 +-
.../[workspaceSlug]/settings/billing.tsx | 14 +-
.../pages/[workspaceSlug]/settings/index.tsx | 5 +-
apps/app/pages/index.tsx | 4 +-
apps/app/pages/invitations.tsx | 162 ++++++------
apps/app/services/notifications.service.ts | 2 +-
apps/app/styles/globals.css | 4 +
yarn.lock | 157 +++++++++++
28 files changed, 736 insertions(+), 1018 deletions(-)
delete mode 100644 apps/app/components/ui/custom-menu.tsx
delete mode 100644 apps/app/components/workspace/upgrade-to-pro-modal.tsx
diff --git a/apiserver/plane/api/views/notification.py b/apiserver/plane/api/views/notification.py
index e81fd2b5f..f0c8e05d5 100644
--- a/apiserver/plane/api/views/notification.py
+++ b/apiserver/plane/api/views/notification.py
@@ -30,7 +30,6 @@ class NotificationViewSet(BaseViewSet):
def list(self, request, slug):
try:
- order_by = request.GET.get("order_by", "-created_at")
snoozed = request.GET.get("snoozed", "false")
archived = request.GET.get("archived", "false")
read = request.GET.get("read", "true")
@@ -40,7 +39,7 @@ class NotificationViewSet(BaseViewSet):
notifications = Notification.objects.filter(
workspace__slug=slug, receiver_id=request.user.id
- ).order_by(order_by)
+ ).order_by("snoozed_till", "-created_at")
# Filter for snoozed notifications
if snoozed == "false":
diff --git a/apiserver/plane/bgtasks/issue_activites_task.py b/apiserver/plane/bgtasks/issue_activites_task.py
index e45ad9b32..523e4bc30 100644
--- a/apiserver/plane/bgtasks/issue_activites_task.py
+++ b/apiserver/plane/bgtasks/issue_activites_task.py
@@ -1028,21 +1028,26 @@ def issue_activity(
actor = User.objects.get(pk=actor_id)
project = Project.objects.get(pk=project_id)
+ if type not in [
+ "cycle.activity.created",
+ "cycle.activity.deleted",
+ "module.activity.created",
+ "module.activity.deleted",
+ ]:
+ issue = Issue.objects.filter(pk=issue_id, project_id=project_id).first()
- issue = Issue.objects.filter(pk=issue_id, project_id=project_id).first()
+ if issue is not None:
+ issue.updated_at = timezone.now()
+ issue.save(update_fields=["updated_at"])
- if issue is not None:
- issue.updated_at = timezone.now()
- issue.save(update_fields=["updated_at"])
-
- if subscriber:
- # add the user to issue subscriber
- try:
- _ = IssueSubscriber.objects.get_or_create(
- issue_id=issue_id, subscriber=actor
- )
- except Exception as e:
- pass
+ if subscriber:
+ # add the user to issue subscriber
+ try:
+ _ = IssueSubscriber.objects.get_or_create(
+ issue_id=issue_id, subscriber=actor
+ )
+ except Exception as e:
+ pass
ACTIVITY_MAPPER = {
"issue.activity.created": create_issue_activity,
@@ -1094,67 +1099,79 @@ def issue_activity(
except Exception as e:
capture_exception(e)
- # Create Notifications
- bulk_notifications = []
+ if type not in [
+ "cycle.activity.created",
+ "cycle.activity.deleted",
+ "module.activity.created",
+ "module.activity.deleted",
+ ]:
+ # Create Notifications
+ bulk_notifications = []
- issue_subscribers = list(
- IssueSubscriber.objects.filter(project=project, issue_id=issue_id)
- .exclude(subscriber_id=actor_id)
- .values_list("subscriber", flat=True)
- )
+ issue_subscribers = list(
+ IssueSubscriber.objects.filter(project=project, issue_id=issue_id)
+ .exclude(subscriber_id=actor_id)
+ .values_list("subscriber", flat=True)
+ )
- issue_assignees = list(
- IssueAssignee.objects.filter(project=project, issue_id=issue_id)
- .exclude(assignee_id=actor_id)
- .values_list("assignee", flat=True)
- )
+ issue_assignees = list(
+ IssueAssignee.objects.filter(project=project, issue_id=issue_id)
+ .exclude(assignee_id=actor_id)
+ .values_list("assignee", flat=True)
+ )
- issue_subscribers = issue_subscribers + issue_assignees
+ issue_subscribers = issue_subscribers + issue_assignees
- issue = Issue.objects.filter(pk=issue_id, project_id=project_id).first()
+ issue = Issue.objects.filter(pk=issue_id, project_id=project_id).first()
- # Add bot filtering
- if issue is not None and issue.created_by_id is not None and not issue.created_by.is_bot:
- issue_subscribers = issue_subscribers + [issue.created_by_id]
+ # Add bot filtering
+ if (
+ issue is not None
+ and issue.created_by_id is not None
+ and not issue.created_by.is_bot
+ ):
+ issue_subscribers = issue_subscribers + [issue.created_by_id]
- for subscriber in issue_subscribers:
- for issue_activity in issue_activities_created:
- bulk_notifications.append(
- Notification(
- workspace=project.workspace,
- sender="in_app:issue_activities",
- triggered_by_id=actor_id,
- receiver_id=subscriber,
- entity_identifier=issue_id,
- entity_name="issue",
- project=project,
- title=issue_activity.comment,
- data={
- "issue": {
- "id": str(issue_id),
- "name": str(issue.name),
- "identifier": str(project.identifier),
- "sequence_id": issue.sequence_id,
- "state_name": issue.state.name,
- "state_group": issue.state.group,
+ for subscriber in issue_subscribers:
+ for issue_activity in issue_activities_created:
+ bulk_notifications.append(
+ Notification(
+ workspace=project.workspace,
+ sender="in_app:issue_activities",
+ triggered_by_id=actor_id,
+ receiver_id=subscriber,
+ entity_identifier=issue_id,
+ entity_name="issue",
+ project=project,
+ title=issue_activity.comment,
+ data={
+ "issue": {
+ "id": str(issue_id),
+ "name": str(issue.name),
+ "identifier": str(project.identifier),
+ "sequence_id": issue.sequence_id,
+ "state_name": issue.state.name,
+ "state_group": issue.state.group,
+ },
+ "issue_activity": {
+ "id": str(issue_activity.id),
+ "verb": str(issue_activity.verb),
+ "field": str(issue_activity.field),
+ "actor": str(issue_activity.actor_id),
+ "new_value": str(issue_activity.new_value),
+ "old_value": str(issue_activity.old_value),
+ "issue_comment": str(
+ issue_activity.issue_comment.comment_stripped
+ if issue_activity.issue_comment is not None
+ else ""
+ ),
+ },
},
- "issue_activity": {
- "id": str(issue_activity.id),
- "verb": str(issue_activity.verb),
- "field": str(issue_activity.field),
- "actor": str(issue_activity.actor_id),
- "new_value": str(issue_activity.new_value),
- "old_value": str(issue_activity.old_value),
- "issue_comment": str(
- issue_activity.issue_comment.comment_stripped if issue_activity.issue_comment is not None else ""
- ),
- },
- },
+ )
)
- )
- # Bulk create notifications
- Notification.objects.bulk_create(bulk_notifications, batch_size=100)
+ # Bulk create notifications
+ Notification.objects.bulk_create(bulk_notifications, batch_size=100)
return
except Exception as e:
diff --git a/apiserver/plane/db/migrations/0037_issue_archived_at_project_archive_in_and_more.py b/apiserver/plane/db/migrations/0037_issue_archived_at_project_archive_in_and_more.py
index bd2ff322f..d11e1afd8 100644
--- a/apiserver/plane/db/migrations/0037_issue_archived_at_project_archive_in_and_more.py
+++ b/apiserver/plane/db/migrations/0037_issue_archived_at_project_archive_in_and_more.py
@@ -8,6 +8,7 @@ import plane.db.models.user
import uuid
+
def onboarding_default_steps(apps, schema_editor):
default_onboarding_schema = {
"workspace_join": True,
@@ -23,7 +24,7 @@ def onboarding_default_steps(apps, schema_editor):
obj.is_tour_completed = True
updated_user.append(obj)
- Model.objects.bulk_update(updated_user, ["onboarding_step"], batch_size=100)
+ Model.objects.bulk_update(updated_user, ["onboarding_step", "is_tour_completed"], batch_size=100)
class Migration(migrations.Migration):
@@ -79,6 +80,7 @@ class Migration(migrations.Migration):
name="onboarding_step",
field=models.JSONField(default=plane.db.models.user.get_default_onboarding),
),
+ migrations.RunPython(onboarding_default_steps),
migrations.CreateModel(
name="Notification",
fields=[
diff --git a/apps/app/components/account/email-code-form.tsx b/apps/app/components/account/email-code-form.tsx
index f745c5521..1e68cbb29 100644
--- a/apps/app/components/account/email-code-form.tsx
+++ b/apps/app/components/account/email-code-form.tsx
@@ -120,7 +120,7 @@ export const EmailCodeForm = ({ handleSignIn }: any) => {
Please check your inbox at {watch("email")}
)}
-