Skip to content

Conversation

@FlowFlorent
Copy link
Contributor

Descriptions

Adds room.getUnreadInboxNotificationsCount

Usage:

  const room = useRoom();
  const count = await room.getUnreadInboxNotificationsCount();
  
  // OR
  
  const room = client.getRoom("my-room");
  const count = await room.getUnreadInboxNotificationsCount();

@FlowFlorent FlowFlorent marked this pull request as ready for review November 19, 2024 16:23
@FlowFlorent FlowFlorent requested a review from nvie as a code owner November 19, 2024 16:23
* @example
* const count = await room.getUnreadInboxNotificationsCount();
*/
getUnreadInboxNotificationsCount(): Promise<number>;
Copy link
Contributor

@nimeshnayaju nimeshnayaju Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is a method we know we wish to support also in the long term, so it is fine to not mark it as experimental.

Comment on lines +996 to +999
await authManager.getAuthValue({
requestedScope: "comments:read",
roomId: options.roomId,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ofoucherot @marcbouchenoire I am not very well versed in the current auth manager but we seem to request cached token for this very scope comments:read for a lot of other methods (createThread, deleteThread) currently. Should we be requesting room:read scope in this particular method?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for inbox-notifications it should be room:read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that room:read is the right one.

That said, if you use comments without storage, you'd still want to have the notifications. In which case you need the less powerful permission (comments:read) to still provide notifications.

Wondering if this is a missing piece in our system. And we should add a notifications:write/read permission.

@FlowFlorent
Copy link
Contributor Author

Closing, more thought needs to be put into this, with an API that likely reuses the project level one using queries

@nvie
Copy link
Contributor

nvie commented Nov 28, 2024

For full context to posterity, I suggested a potential different solution direction for this here privately on Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants