Skip to content

Commit

Permalink
wip - activity when feedback attachment is deleted
Browse files Browse the repository at this point in the history
relates to #67707
  • Loading branch information
ryan953 committed Apr 8, 2024
1 parent 830cdcd commit 9ae80e7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/sentry/api/endpoints/event_attachment_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
from sentry.auth.superuser import superuser_has_permission
from sentry.auth.system import is_system_auth
from sentry.constants import ATTACHMENTS_ROLE_DEFAULT
from sentry.models.activity import Activity
from sentry.models.eventattachment import EventAttachment
from sentry.models.organizationmember import OrganizationMember
from sentry.types.activity import ActivityType


class EventAttachmentDetailsPermission(ProjectPermission):
Expand Down Expand Up @@ -129,4 +131,11 @@ def delete(self, request: Request, project, event_id, attachment_id) -> Response
return self.respond({"detail": "Attachment not found"}, status=404)

attachment.delete()
Activity.objects.create(
group=attachment.group,
project=project,
type=ActivityType.DELETED_ATTACHMENT.value,
user_id=request.user.id,
data={},
)
return self.respond(status=204)
1 change: 1 addition & 0 deletions src/sentry/types/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ActivityType(Enum):
SET_ESCALATING = 25

SET_PRIORITY = 26
DELETED_ATTACHMENT = 27


# Warning: This must remain in this EXACT order.
Expand Down
9 changes: 8 additions & 1 deletion static/app/types/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ export enum GroupActivityType {
AUTO_SET_ONGOING = 'auto_set_ongoing',
SET_ESCALATING = 'set_escalating',
SET_PRIORITY = 'set_priority',
DELETED_ATTACHMENT = 'deleted_attachment',
}

interface GroupActivityBase {
Expand Down Expand Up @@ -630,6 +631,11 @@ export interface GroupActivityCreateIssue extends GroupActivityBase {
type: GroupActivityType.CREATE_ISSUE;
}

interface GroupActivityDeletedAttachment extends GroupActivityBase {
data: {};
type: GroupActivityType.DELETED_ATTACHMENT;
}

export type GroupActivity =
| GroupActivityNote
| GroupActivitySetResolved
Expand Down Expand Up @@ -657,7 +663,8 @@ export type GroupActivity =
| GroupActivityCreateIssue
| GroupActivityAutoSetOngoing
| GroupActivitySetEscalating
| GroupActivitySetPriority;
| GroupActivitySetPriority
| GroupActivityDeletedAttachment;

export type Activity = GroupActivity;

Expand Down
2 changes: 2 additions & 0 deletions static/app/views/issueDetails/groupActivityItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,8 @@ function GroupActivityItem({
);
}
}
case GroupActivityType.DELETED_ATTACHMENT:
return tct('[author] deleted an attachment', {author});
default:
return ''; // should never hit (?)
}
Expand Down

0 comments on commit 9ae80e7

Please sign in to comment.