Skip to content

Conversation

@luflow
Copy link
Contributor

@luflow luflow commented Jan 26, 2026

Summary

This PR implements support for the new react-permission capability that will be introduced in Talk 24 (Nextcloud 34) via nextcloud/spreed#11329.

Migration guide: https://github.com/luflow/spreed/blob/93bedef92873edbf7a4ae28730c0d514a1cd2f97/docs/react-permission-integration.md

Previously, the CHAT permission (128) controlled both posting messages and adding reactions. This has been split into two separate permissions:

  • CHAT (128): Post messages and share items
  • REACT (256): Add/remove reactions

Changes

  • Add NCPermissionReact = 256 permission constant to NCRoom.h
  • Add kCapabilityReactPermission capability constant to NCDatabaseManager
  • Add canReact computed property to NCRoom that:
    • Checks for the react-permission capability (Talk 24+)
    • Falls back to checking CHAT permission for older servers
  • Update ChatViewController to use room.canReact for reaction permission checks

Backward Compatibility

The implementation maintains backward compatibility with older Talk servers by falling back to the CHAT permission check when the react-permission capability is not present.

@SystemKeeper
Copy link
Collaborator

Hello @luflow,

thanks a lot for your PRs - much appreciated!

I didn't look too closely yet, but one thing I noticed is we loose the fallback (of the fallback):

https://github.com/luflow/talk-ios/blob/41e46cf402c0620374ca30ce9115e065c673d2d8/NextcloudTalk/Chat/ChatViewController.swift#L2431

So for very old servers, we need to keep that check.

@luflow luflow force-pushed the feat/react-permission-capability branch from 9bcd41c to 621f6b9 Compare January 26, 2026 16:45
@luflow
Copy link
Contributor Author

luflow commented Jan 26, 2026

I didn't look too closely yet, but one thing I noticed is we loose the fallback (of the fallback):

https://github.com/luflow/talk-ios/blob/41e46cf402c0620374ca30ce9115e065c673d2d8/NextcloudTalk/Chat/ChatViewController.swift#L2431

So for very old servers, we need to keep that check.

True story, did a small refactoring and introduced room.canChat - so now it quite readable and better maintainable, duplicate checks are removed too :)

@luflow luflow force-pushed the feat/react-permission-capability branch from 8dd5964 to f98ced8 Compare January 28, 2026 23:10
@SystemKeeper
Copy link
Collaborator

Thanks a lot, that looks indeed very nice now! Just FYI, we will wait until the server part is merged, before we move forward with this one, but it is on our radar :)

@luflow luflow force-pushed the feat/react-permission-capability branch 2 times, most recently from ef3d8e2 to 06510f4 Compare January 30, 2026 13:06
Implement support for the new react-permission capability introduced in
Talk 24 (Nextcloud 34). Previously, the CHAT permission (128) controlled
both posting messages and adding reactions. This has been split into:

- CHAT (128): Post messages and share items
- REACT (256): Add/remove reactions

Changes:
- Add NCPermissionReact (256) permission constant
- Add kCapabilityReactPermission capability constant
- Add canReact computed property to NCRoom that checks for the
  react-permission capability and falls back to chat permission
  for older servers
- Update ChatViewController to use room.canReact for reaction
  permission checks

Signed-off-by: Florian Ludwig <[email protected]>
Preserve backward compatibility for servers that don't have the
chat-permission capability by allowing reactions unconditionally,
matching the original behavior before the react-permission refactor.

Signed-off-by: Florian Ludwig <[email protected]>
Centralize chat permission check with fallback for very old servers
into a reusable canChat property, similar to other permission helpers.
Update ChatViewController and ShareViewController to use it.

Signed-off-by: Florian Ludwig <[email protected]>
Instead of generic "could not be added/removed" errors, show a clear
message when the user lacks permission to react in the conversation.

Signed-off-by: Florian Ludwig <[email protected]>
@luflow luflow force-pushed the feat/react-permission-capability branch from 06510f4 to ba64962 Compare January 30, 2026 13:11
@luflow luflow force-pushed the feat/react-permission-capability branch from ce471ca to ca7afae Compare January 30, 2026 14:11
- Use capability check instead of branch name for react-permission
- Centralize SERVER_URL and add reusable has_capability function
- Fix chat API endpoint (v1 instead of v4)
- Fix test to wait for message instead of call button
- Simplify chat message payload to required fields only

Signed-off-by: Florian Ludwig <[email protected]>
Signed-off-by: Florian Ludwig <[email protected]>
@luflow luflow force-pushed the feat/react-permission-capability branch from 0367151 to e09bd7a Compare January 30, 2026 23:53
Co-authored-by: Marcel Müller <[email protected]>
Signed-off-by: Florian Ludwig <[email protected]>
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.

2 participants