Refactor approval queue to display last meaningful status #94

Merged
Oleg-Komarov merged 13 commits from approval-queue into main 2024-04-30 10:48:38 +02:00
Owner

See #89

rewriting approval queue page as a listing of all ApprovalActivity items across all extensions, grouped by extension, displaying a summary:

  • last meaningful status ("Awaiting review", "Awaiting changes", "Approved")
  • presence of a suspicious upload
  • other fields present today (Type, Name, Author, Submitted, Activity)
See #89 rewriting approval queue page as a listing of all ApprovalActivity items across all extensions, grouped by extension, displaying a summary: - last meaningful status ("Awaiting review", "Awaiting changes", "Approved") - presence of a suspicious upload - other fields present today (Type, Name, Author, Submitted, Activity)
Oleg-Komarov added 11 commits 2024-04-29 18:46:11 +02:00
Oleg-Komarov added 1 commit 2024-04-29 19:16:30 +02:00
Anna Sirota approved these changes 2024-04-29 19:24:35 +02:00
Anna Sirota left a comment
Owner

LGTM

LGTM
@ -22,2 +28,2 @@
return Extension.objects.exclude(status=Extension.STATUSES.APPROVED).order_by(
'-date_created'
qs = (
ApprovalActivity.objects.prefetch_related(
Owner

For already existing extensions without activity records ApprovalActivity will have to be created (with the Extension.date_status_changed dates as date_created) to ensure they still show up in the approval queue.

For already existing extensions without activity records `ApprovalActivity` will have to be created (with the `Extension.date_status_changed` dates as `date_created`) to ensure they still show up in the approval queue.
Author
Owner

running in shell

from extensions.models import Extension
from reviewers.models import ApprovalActivity

to_create = []
for ext in Extension.objects.filter(status=2).all():
    if ext.review_activity.count() == 0:
        to_create.append(ApprovalActivity(
            type=ApprovalActivity.ActivityType.AWAITING_REVIEW,
            extension=ext,
            user=ext.authors.all()[0],
            date_created=ext.date_status_changed,
            message='Extension is ready for initial review',
        ))

ApprovalActivity.objects.bulk_create(to_create)

for at in to_create:
    at.date_created = at.extension.date_status_changed

ApprovalActivity.objects.bulk_update(to_create, ['date_created'])
running in shell ``` from extensions.models import Extension from reviewers.models import ApprovalActivity to_create = [] for ext in Extension.objects.filter(status=2).all(): if ext.review_activity.count() == 0: to_create.append(ApprovalActivity( type=ApprovalActivity.ActivityType.AWAITING_REVIEW, extension=ext, user=ext.authors.all()[0], date_created=ext.date_status_changed, message='Extension is ready for initial review', )) ApprovalActivity.objects.bulk_create(to_create) for at in to_create: at.date_created = at.extension.date_status_changed ApprovalActivity.objects.bulk_update(to_create, ['date_created']) ```
Oleg-Komarov added 1 commit 2024-04-30 10:23:20 +02:00
Oleg-Komarov merged commit 4af1fd6563 into main 2024-04-30 10:48:38 +02:00
Oleg-Komarov deleted branch approval-queue 2024-04-30 10:48:38 +02:00
Author
Owner

before
Screenshot 2024-04-30 at 10-53-58 Blender Extensions.png

after
Screenshot 2024-04-30 at 10-54-55 Blender Extensions.png

before ![Screenshot 2024-04-30 at 10-53-58 Blender Extensions.png](/attachments/fac5c383-2651-4247-8b7e-74c07f6fb8a0) after ![Screenshot 2024-04-30 at 10-54-55 Blender Extensions.png](/attachments/e044b60c-0b1b-4f18-9d04-6ef82ad7057a)
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/extensions-website#94
No description provided.