Skip to content
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

FIX: Unable to set allowed groups to everyone group #5

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

keegangeorge
Copy link
Member

@keegangeorge keegangeorge commented Jan 14, 2025

🔍 Overview

This update fixes an issue where the copy post button does not show up when it is set to the "everyone" group. This is because the "everyone" group is not a visible_group, and only visible groups are attached to the current user's serializer. Hence, we must explicitly check for the everyone group when comparing against the current user's groups.

🔗 Related links

https://meta.discourse.org/t/copy-post-component/218883/22?u=keegan

This update fixes an issue where the copy post button does not show up when it is set to the "everyone" group. This is because the "everyone" group is not a `visible_group`, and only visible groups are attached to the current user's serializer. Hence, we must explicitly check for the everyone group when comparing against the current user's groups.
@@ -48,7 +48,7 @@
before do
theme_component.update_setting(
:copy_button_allowed_groups,
[Group::AUTO_GROUPS[:trust_level_4]],
Group::AUTO_GROUPS[:trust_level_4].to_s,
Copy link
Member Author

@keegangeorge keegangeorge Jan 14, 2025

Choose a reason for hiding this comment

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

Sneaking in this fix to the spec. This was incorrectly set before and thus not working accurately. The theme setting expects a string based format where group id's are separated by pipes (i.e. "1|5|19"), however we were passing an array of ID's instead.

Copy link

@Drenmi Drenmi left a comment

Choose a reason for hiding this comment

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

The fix as it is looks good. 👍

What I'm wondering is if this potentially affects more places in the front-end, and we should instead explicitly add the "everyone" group in the serializer. Although I realize that might break assumptions in other parts of the front-end that "everyone" is not included. 😅

@keegangeorge
Copy link
Member Author

What I'm wondering is if this potentially affects more places in the front-end, and we should instead explicitly add the "everyone" group in the serializer. Although I realize that might break assumptions in other parts of the front-end that "everyone" is not included. 😅

Yes, I was thinking the same 😅, maybe something we could discuss internally before deciding, so I think I'll merge this as a solution for now.

@keegangeorge keegangeorge merged commit f784e21 into main Jan 15, 2025
3 checks passed
@keegangeorge keegangeorge deleted the fix-everyone-group branch January 15, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants