From 9b6721790f711c62fde54dac8671df637aee0e79 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:58:34 +0530 Subject: [PATCH 1/2] fix: issues count to remove archived issues (#1591) --- apiserver/plane/api/views/notification.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apiserver/plane/api/views/notification.py b/apiserver/plane/api/views/notification.py index f0c8e05d5..b7f5bd335 100644 --- a/apiserver/plane/api/views/notification.py +++ b/apiserver/plane/api/views/notification.py @@ -214,6 +214,7 @@ class UnreadNotificationEndpoint(BaseAPIView): workspace__slug=slug, receiver_id=request.user.id, read_at__isnull=True, + archived_at__isnull=True, entity_identifier__in=IssueSubscriber.objects.filter( workspace__slug=slug, subscriber_id=request.user.id ).values_list("issue_id", flat=True), @@ -224,6 +225,7 @@ class UnreadNotificationEndpoint(BaseAPIView): workspace__slug=slug, receiver_id=request.user.id, read_at__isnull=True, + archived_at__isnull=True, entity_identifier__in=IssueAssignee.objects.filter( workspace__slug=slug, assignee_id=request.user.id ).values_list("issue_id", flat=True), @@ -234,6 +236,7 @@ class UnreadNotificationEndpoint(BaseAPIView): workspace__slug=slug, receiver_id=request.user.id, read_at__isnull=True, + archived_at__isnull=True, entity_identifier__in=Issue.objects.filter( workspace__slug=slug, created_by=request.user ).values_list("pk", flat=True), From e687cd6f6a15c1641467ee3306b14b212d3f9c80 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:59:09 +0530 Subject: [PATCH 2/2] dev: background migration for user custom themes (#1590) --- .../db/migrations/0038_auto_20230720_1505.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 apiserver/plane/db/migrations/0038_auto_20230720_1505.py diff --git a/apiserver/plane/db/migrations/0038_auto_20230720_1505.py b/apiserver/plane/db/migrations/0038_auto_20230720_1505.py new file mode 100644 index 000000000..1f5c63a89 --- /dev/null +++ b/apiserver/plane/db/migrations/0038_auto_20230720_1505.py @@ -0,0 +1,35 @@ +# Generated by Django 4.2.3 on 2023-07-20 09:35 + +from django.db import migrations, models + + +def restructure_theming(apps, schema_editor): + Model = apps.get_model("db", "User") + updated_user = [] + for obj in Model.objects.exclude(theme={}).all(): + current_theme = obj.theme + updated_theme = { + "primary": current_theme.get("accent", ""), + "background": current_theme.get("bgBase", ""), + "sidebarBackground": current_theme.get("sidebar", ""), + "text": current_theme.get("textBase", ""), + "sidebarText": current_theme.get("textBase", ""), + "palette": f"""{current_theme.get("bgBase","")},{current_theme.get("textBase", "")},{current_theme.get("accent", "")},{current_theme.get("sidebar","")},{current_theme.get("textBase", "")}""", + "darkPalette": current_theme.get("darkPalette", "") + } + obj.theme = updated_theme + updated_user.append(obj) + + Model.objects.bulk_update( + updated_user, ["theme"], batch_size=100 + ) + + +class Migration(migrations.Migration): + dependencies = [ + ("db", "0037_issue_archived_at_project_archive_in_and_more"), + ] + + operations = [ + migrations.RunPython(restructure_theming) + ]