-
Notifications
You must be signed in to change notification settings - Fork 22
setNotificationsLastSeenAt and add the value to getNotifications call #55
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
Conversation
This pull request has been linked to Clubhouse Story #21022: SetNotificationsLastSeenAt. |
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.
LGTM!. I left two comments and we should be good to go.
const encryptedTimestamp = await this.encrypt(timestamp.toString()); | ||
const lookupKey = this.getNotificationsLastSeenAtLookupKey(); | ||
const nodeRef = this.lookupUser.get(lookupKey).put({ data: encryptedTimestamp }); | ||
this.listUser.get(NotificationsLastSeenAtCollection).set(nodeRef as unknown as EncryptedMetadata); |
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 think you need to add it to a set()
here. The set is useful if we need a list of all last seen at timestamp right? And I don't think we would need that. We are only interested in setting and getting that data right? So the put()
should be fine. It would always override the latest value.
@@ -478,6 +499,10 @@ export class GundbMetadataStore implements UserMetadataStore { | |||
}); | |||
} | |||
|
|||
private getNotificationsLastSeenAtLookupKey(): string { | |||
return `notifications/lastSeenAt/${this.username}`; |
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.
return `notifications/lastSeenAt/${this.username}`; | |
return `notifications/lastSeenAt`; |
Since the key already namespaced to the user, we shouldn't need to add the username field to the lookup key
Description
This adds the
setNotificationsLastSeenAt
so the FE can set it. And alsogetNotifications
now returns this value properly.https://app.clubhouse.io/terminalsystems/story/21022/setnotificationslastseenat
Type of change
How Has This Been Tested?
Checklist: