-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NC - dropdown menu with remove message and read unread action #2766
NC - dropdown menu with remove message and read unread action #2766
Conversation
NV-1612 In App - remove a notificatino - ellipses
On right click / click on elipses: Let's try to do it with the existing design system without a designer. More details: Created via Raycast |
…-a-notificatino-ellipses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, added a few notes regarding the API 🎉
apps/api/src/app/widgets/usecases/remove-message/remove-message.usecase.ts
Show resolved
Hide resolved
private async updateServices(command: RemoveMessageCommand, subscriber, message, marked: string) { | ||
const admin = await this.memberRepository.getOrganizationAdminAccount(command.organizationId); | ||
const count = await this.messageRepository.getCount(command.environmentId, subscriber._id, ChannelTypeEnum.IN_APP, { | ||
[marked]: false, | ||
}); | ||
|
||
this.updateSocketCount(subscriber, count, marked); | ||
|
||
if (admin) { | ||
this.analyticsService.track(`Removed Message - [Notification Center]`, admin._userId, { | ||
_subscriber: message._subscriberId, | ||
_organization: command.organizationId, | ||
_template: message._templateId, | ||
}); | ||
} | ||
} | ||
|
||
private updateSocketCount(subscriber: SubscriberEntity, count: number, mark: string) { | ||
const eventMessage = `un${mark}_count_changed`; | ||
const countKey = `un${mark}Count`; | ||
|
||
this.queueService.wsSocketQueue.add({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have those things duplicated elsewhere right? Maybe we can have a reusable function to do the repeated behaviour?
messageId: messageId, | ||
}); | ||
|
||
return await this.removeMessageUsecase.execute(command); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any e2e test for this endpoint (API) do we have one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, super excellent job 🎉 I love the approach you took and you didn't forget about the docs :) thanks!
left some small suggestions ;)
_organizationId: command.organizationId, | ||
_id: command.messageId, | ||
}); | ||
const item = await this.messageRepository.findDeleted({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const item = await this.messageRepository.findDeleted({ | |
const [deletedMessage] = await this.messageRepository.findDeleted({ |
return deletedMessage; | ||
} | ||
|
||
private async updateServices(command: RemoveMessageCommand, subscriber, message, marked: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the types here... I do see that this code is duplicated, should we expose it to a separate use-case?
if (admin) { | ||
this.analyticsService.track(`Removed Message - [Notification Center]`, admin._userId, { | ||
_subscriber: message._subscriberId, | ||
_organization: command.organizationId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should add here the env id too?
async removeMessage( | ||
@SubscriberSession() subscriberSession: SubscriberEntity, | ||
@Param('messageId') messageId: string | ||
): Promise<MessageEntity> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should be consistent with our API, currently, we have many different approaches when it comes to DELETE REST calls, sometimes we return true, sometimes deleted object, and in other scenarios 204 no content...
maybe we should talk about it on the tech meeting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I was facing the same confusion about what to return
...on-center/src/components/notification-center-web-component/notification-center-component.tsx
Show resolved
Hide resolved
...ter/src/components/notification-center/components/notification-item/NotificationListItem.tsx
Outdated
Show resolved
Hide resolved
I will extract the duplicated code + add more tests in a separate PR later tonight/tomorrow |
What change does this PR introduce?
Why was this change needed?
https://www.loom.com/share/f1c63987ec5844e181b3683e6e1a32e3
Other information (Screenshots)
WIP:
still needs yo add tests
add to headless
tidy up code
improve design