Skip to content

feat: allow only default reactions - #8545

Merged
r10s merged 3 commits into
mainfrom
r10s/restrict-channel-reactions
Aug 5, 2026
Merged

feat: allow only default reactions#8545
r10s merged 3 commits into
mainfrom
r10s/restrict-channel-reactions

Conversation

@r10s

@r10s r10s commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

the UIs are currently advised
to only allow the five default reactions in broadcast channels.
this PR ensures that from sending site as well as receiving site.

soon, we probably want to make the possible reactions configurable, this PR is mainly for some safety until then. once we have an API to change default reactions, we can also easily test "invalid" reactions on the receiving side; currently only sending is tested

successor of #8450

@r10s
r10s marked this pull request as draft August 4, 2026 21:34
@r10s
r10s force-pushed the r10s/restrict-channel-reactions branch 2 times, most recently from 4495732 to b947588 Compare August 4, 2026 21:36
the UIs are currently advised
to only allow the five default reactions in broadcast channels.
this PR ensures that from sending site as well as receiving site.
@r10s
r10s force-pushed the r10s/restrict-channel-reactions branch from b947588 to dc6a27e Compare August 4, 2026 21:52
@r10s
r10s requested review from Hocuri and link2xt August 4, 2026 21:58
@r10s
r10s marked this pull request as ready for review August 4, 2026 21:59
}

/// Emojis allowed as reactions in broadcast channels.
const ALLOWED_REACTIONS: [&str; 5] = ["馃憤", "馃憥", "鉂わ笍", "馃槀", "馃檨"];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

in the future, this will probably be configurable

Comment thread src/reaction.rs Outdated
let old_reactions = get_msg_reactions(context, msg_id).await?;
let old_self_reaction = old_reactions.by_contact.get(&ContactId::SELF);

if (chat.typ == Chattype::OutBroadcast || chat.typ == Chattype::InBroadcast)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (chat.typ == Chattype::OutBroadcast || chat.typ == Chattype::InBroadcast)
if matches!(chat.typ, Chattype::OutBroadcast | Chattype::InBroadcast)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ftr, i find a simple "if" easier to read, esp if short, but if matches! is the rust way and what we do otherwise, i am fine with that as well

Comment thread src/reaction.rs Outdated
r10s and others added 2 commits August 5, 2026 08:05
Co-authored-by: Jagoda Estera 艢l膮zak <[email protected]>
Co-authored-by: Jagoda Estera 艢l膮zak <[email protected]>

@j-g00da j-g00da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Implementation-wise looks good (but I missed when it was discussed)

@r10s

r10s commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

UI already now do not allow random reactions in channels by default, but only a subset. to make life for haters or trolls harder, and life of channel owners better :) this is similar to telegram or whatsapp

for simplicity in first UI implementations, the subset are the already present default reactions. later we want to have that configurable.

this PR just adds an additional layer to enforce the subset - esp as core does not really know what an emoji is, and allows all short strings as reactions

@r10s
r10s merged commit 93d9a4b into main Aug 5, 2026
30 checks passed
@r10s
r10s deleted the r10s/restrict-channel-reactions branch August 5, 2026 08:22
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