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

feat: introduce CommunityAdminSettings in CommunityDescription #2668

Merged
merged 1 commit into from
May 18, 2022

Conversation

0x-r4bbit
Copy link
Member

This allows to store community admin settings that are meant to be propagated
to community members (as opposed to the already existing
CommunitySettings which are considered local to every account).

The first setting introduced as part of this commit is one that enables
community admins to configure whether or not members of the community
are allowed to pin messages in community channels.

Prior to this commit, this was not restricted at all on the protocol
level and only enforced by clients via UI (e.g. members don't see an
option to pin messages, although they could).

This config setting now ensures that:

  1. If turned off, members cannot send a pin message
  2. If turned off, pin messages from members are not handled/processed

This is needed by status-im/status-desktop#5662

@0x-r4bbit 0x-r4bbit requested review from richard-ramos and cammellos and removed request for richard-ramos May 10, 2022 14:28
@status-github-bot
Copy link

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • Have you tested changes with mobile?
  • Have you tested changes with desktop?

@status-im-auto
Copy link
Member

status-im-auto commented May 10, 2022

Jenkins Builds

Click to see older builds (29)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 8d72710 #1 2022-05-10 14:32:11 ~3 min linux 📦zip
✔️ 8d72710 #1 2022-05-10 14:33:04 ~4 min android 📦aar
✔️ 8d72710 #1 2022-05-10 14:33:10 ~4 min ios 📦zip
✔️ 931dd57 #2 2022-05-10 16:16:43 ~5 min linux 📦zip
✔️ 931dd57 #2 2022-05-10 16:16:45 ~5 min ios 📦zip
✔️ 931dd57 #2 2022-05-10 16:19:36 ~8 min android 📦aar
✔️ 13b2047 #3 2022-05-10 17:26:44 ~1 min linux 📦zip
✔️ 13b2047 #3 2022-05-10 17:26:57 ~1 min ios 📦zip
✔️ 76c200e #4 2022-05-11 08:26:10 ~2 min ios 📦zip
✔️ 76c200e #4 2022-05-11 08:26:15 ~2 min linux 📦zip
✔️ 76c200e #4 2022-05-11 08:26:50 ~3 min android 📦aar
✔️ 687247b #5 2022-05-11 10:34:16 ~2 min linux 📦zip
✔️ 687247b #5 2022-05-11 10:36:18 ~4 min android 📦aar
✔️ 687247b #5 2022-05-11 10:48:36 ~16 min ios 📦zip
✔️ 1246821 #6 2022-05-13 07:51:12 ~2 min ios 📦zip
✔️ 1246821 #6 2022-05-13 07:51:15 ~2 min linux 📦zip
✔️ 1246821 #6 2022-05-13 07:52:43 ~4 min android 📦aar
✔️ b2f6fe1 #7 2022-05-13 10:42:35 ~3 min android 📦aar
✔️ b2f6fe1 #7 2022-05-13 10:42:40 ~3 min linux 📦zip
✔️ b2f6fe1 #7 2022-05-13 10:50:13 ~11 min ios 📦zip
✔️ 194b120 #8 2022-05-13 11:12:24 ~2 min linux 📦zip
✔️ 194b120 #8 2022-05-13 11:12:27 ~2 min ios 📦zip
✔️ 194b120 #8 2022-05-13 11:13:28 ~3 min android 📦aar
✔️ 685f89b #9 2022-05-13 14:15:18 ~1 min linux 📦zip
✔️ 685f89b #9 2022-05-13 14:16:10 ~2 min ios 📦zip
✔️ 685f89b #9 2022-05-13 14:16:51 ~2 min android 📦aar
✔️ 3336b4a #10 2022-05-13 14:33:56 ~1 min linux 📦zip
✔️ 3336b4a #10 2022-05-13 14:34:15 ~1 min ios 📦zip
✔️ 3336b4a #10 2022-05-13 14:35:23 ~2 min android 📦aar
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 459b456 #11 2022-05-17 12:21:33 ~1 min linux 📦zip
✔️ 459b456 #11 2022-05-17 12:24:15 ~4 min android 📦aar
✔️ 459b456 #11 2022-05-17 12:24:15 ~4 min ios 📦zip
✔️ 6695097 #12 2022-05-18 07:53:18 ~2 min ios 📦zip
✔️ 6695097 #12 2022-05-18 07:53:29 ~2 min linux 📦zip
✔️ 6695097 #12 2022-05-18 07:53:59 ~3 min android 📦aar

@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch from 8d72710 to 931dd57 Compare May 10, 2022 16:11
0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request May 10, 2022
This adds a checkbox to configure whether or not community members are
allowed to pin any message of a community channel, based on the newly
introduced `CommunityAdminSettings` that are introduced in status-im/status-go#2668

Closes #5662
@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch from 931dd57 to 13b2047 Compare May 10, 2022 17:24
Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

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

Looks good, but I think on the receiving end, there might be a missing condition. I might be wrong though.

isMemberAdmin := community.IsMemberAdmin(chatEntity.GetSigPubKey())
pinMessageAllowed := community.AllowsAllMembersToPinMessage()

if (!isMemberAdmin && !pinMessageAllowed) || (!emojiReaction && !canPost) {
Copy link
Member

Choose a reason for hiding this comment

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

Should there be an additionnal check on pin? It seems like this might block people from posting normal messages as well.
Something like

(isPinMessage && !isMemberAdmin && !pinMessageAllowed)

Where isPinMessage comes from a new case in the switch above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, forgot to add that. In my head I was still inside HandlePinMessage...

Thanks man, will update

@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch 2 times, most recently from 76c200e to 687247b Compare May 11, 2022 10:31
Copy link
Member

@Samyoul Samyoul left a comment

Choose a reason for hiding this comment

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

Looks good. I'm presuming that in the future more parameters will be added to the CommunityAdminSettings? Ah, I just reread the description.

@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch from 687247b to 1246821 Compare May 13, 2022 07:48
0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request May 13, 2022
This adds a checkbox to configure whether or not community members are
allowed to pin any message of a community channel, based on the newly
introduced `CommunityAdminSettings` that are introduced in status-im/status-go#2668

Closes #5662
@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch 2 times, most recently from b2f6fe1 to 194b120 Compare May 13, 2022 11:10
@0x-r4bbit
Copy link
Member Author

Tests are failing but unrelated to these changes.
This has been reported here as well: #2672 (comment)

Also, I think status-im/status-desktop#5729 is related.

Investigating...

@0x-r4bbit
Copy link
Member Author

So it seems it affects all tests that involve JoinCommunity APIs. I can confirm that TestJoinCommunity does not fail when run standalone

Comment on lines +47 to 52
CommunityAdminSettings admin_settings = 10;
}

message CommunityAdminSettings {
bool pin_message_all_members_enabled = 1;
}
Copy link
Member

Choose a reason for hiding this comment

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

This is very nice!

@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch 3 times, most recently from 3336b4a to 459b456 Compare May 17, 2022 12:19
This allows to store community admin settings that are meant to be propagated
to community members (as opposed to the already existing
`CommunitySettings` which are considered local to every account).

The first setting introduced as part of this commit is one that enables
community admins to configure whether or not members of the community
are allowed to pin messages in community channels.

Prior to this commit, this was not restricted at all on the protocol
level and only enforced by clients via UI (e.g. members don't see an
option to pin messages, although they could).

This config setting now ensures that:

1. If turned off, members cannot send a pin message
2. If turned off, pin messages from members are not handled/processed

This is needed by status-im/status-desktop#5662
@0x-r4bbit 0x-r4bbit force-pushed the feat/enable-pin-message-members branch from 459b456 to 6695097 Compare May 18, 2022 07:50
@0x-r4bbit 0x-r4bbit merged commit 714c03c into develop May 18, 2022
@0x-r4bbit 0x-r4bbit deleted the feat/enable-pin-message-members branch May 18, 2022 07:58
@churik
Copy link
Member

churik commented May 19, 2022

Hello!
Is there a particular reason why this PR was not going through testing?

@0x-r4bbit
Copy link
Member Author

@churik That one is on me!
The PR was sitting around for quite a while and there wasn't any activity anymore after getting a bunch of approvals..
But now that I think of it, I should've pinged you, correct?

@churik
Copy link
Member

churik commented May 19, 2022

@PascalPrecht
No worries, https://notes.status.im/pipeline-status-go - is the doc with workflow for next time

0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request May 19, 2022
This adds a checkbox to configure whether or not community members are
allowed to pin any message of a community channel, based on the newly
introduced `CommunityAdminSettings` that are introduced in status-im/status-go#2668

Closes #5662
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.

6 participants