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(community)_: fix pure readonly channels not respecting the right roles #5513

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

jrainville
Copy link
Member

Fixes status-im/status-desktop#15547

The problem was that we used channelEncrypted to know if we should use all the community members or the given members by the control node.
However, pure read-only channel (for example announcements) are permissions, but not encrypted, since everyone still has access to read them.

The solution is to add channelHasPermissions and use that one instead in the hydrate and dehydrate functions.

I also added a test to validate the behaviour. It seems like we never tested pure read-only channels before.

image

@status-im-auto
Copy link
Member

status-im-auto commented Jul 11, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 4841803 #1 2024-07-11 21:36:52 ~2 min tests-rpc 📄log
✔️ 4841803 #1 2024-07-11 21:38:17 ~3 min linux 📦zip
✔️ 4841803 #1 2024-07-11 21:38:23 ~4 min ios 📦zip
✔️ 4841803 #1 2024-07-11 21:39:35 ~5 min android 📦aar
✔️ 4841803 #1 2024-07-11 22:18:39 ~44 min tests 📄log
✔️ dd77220 #2 2024-07-12 14:30:42 ~2 min tests-rpc 📄log
✔️ dd77220 #2 2024-07-12 14:32:14 ~4 min linux 📦zip
✔️ dd77220 #2 2024-07-12 14:32:47 ~4 min ios 📦zip
✔️ dd77220 #2 2024-07-12 14:33:59 ~5 min android 📦aar
✔️ dd77220 #2 2024-07-12 15:13:07 ~44 min tests 📄log

Copy link
Contributor

@osmaczko osmaczko left a comment

Choose a reason for hiding this comment

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

Good catch, thanks!

}

_, err = s.bob.SendChatMessage(context.Background(), msg)
s.Require().Error(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to check exact error here?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was a good tip, turns out I was passing the wrong chatID, so the error was unknown chat 🙈

I'm fixing it and making it test the error

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@jrainville
Copy link
Member Author

FYI, I ran the test a 1000 times:

go test -test.count 1000 -run MessengerCommunitiesTokenPermissionsSuite/TestAnnouncementsChannelPermissions -failfast -timeout 3000s -tags gowaku_skip_migrations,gowaku_no_rln
PASS
ok  	github.com/status-im/status-go/protocol	1332.294s

@jrainville jrainville force-pushed the fix/re-only-channels-members-marked-as-posters branch from 4841803 to dd77220 Compare July 12, 2024 14:27
Copy link
Contributor

@kounkou kounkou left a comment

Choose a reason for hiding this comment

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

LGTM

@jrainville jrainville merged commit 621b31a into develop Jul 15, 2024
10 checks passed
@jrainville jrainville deleted the fix/re-only-channels-members-marked-as-posters branch July 15, 2024 17:53
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.

[ChatInput]: not disabled with closed channels
4 participants