Skip to content

Commit

Permalink
Support updating add members permission (#6194)
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan authored Aug 12, 2024
1 parent 323d292 commit aab6bfb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions backend/canisters/community/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Added

- Support updating add members permission ([#6194](https://github.com/open-chat-labs/open-chat/pull/6194))

### Changed

- Members of private communities can be added to channels skipping gate checks ([#6159](https://github.com/open-chat-labs/open-chat/pull/6159))
Expand Down
15 changes: 7 additions & 8 deletions backend/libraries/group_chat_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ use std::collections::{BTreeSet, HashSet};
use types::{
AccessGate, AvatarChanged, ContentValidationError, CustomPermission, Document, EventIndex, EventOrExpiredRange,
EventWrapper, EventsResponse, FieldTooLongResult, FieldTooShortResult, GroupDescriptionChanged, GroupGateUpdated,
GroupNameChanged, GroupPermissionRole, GroupPermissions, GroupReplyContext, GroupRole, GroupRulesChanged, GroupSubtype,
GroupVisibilityChanged, HydratedMention, InvalidPollReason, MemberLeft, MembersRemoved, Message, MessageContent,
MessageContentInitial, MessageId, MessageIndex, MessageMatch, MessagePermissions, MessagePinned, MessageUnpinned,
MessagesResponse, Milliseconds, MultiUserChat, OptionUpdate, OptionalGroupPermissions, OptionalMessagePermissions,
PermissionsChanged, PushEventResult, PushIfNotContains, Reaction, RoleChanged, Rules, SelectedGroupUpdates, ThreadPreview,
TimestampMillis, Timestamped, UpdatedRules, UserId, UserType, UsersBlocked, UsersInvited, Version, Versioned,
VersionedRules, VideoCall,
GroupNameChanged, GroupPermissions, GroupReplyContext, GroupRole, GroupRulesChanged, GroupSubtype, GroupVisibilityChanged,
HydratedMention, InvalidPollReason, MemberLeft, MembersRemoved, Message, MessageContent, MessageContentInitial, MessageId,
MessageIndex, MessageMatch, MessagePermissions, MessagePinned, MessageUnpinned, MessagesResponse, Milliseconds,
MultiUserChat, OptionUpdate, OptionalGroupPermissions, OptionalMessagePermissions, PermissionsChanged, PushEventResult,
PushIfNotContains, Reaction, RoleChanged, Rules, SelectedGroupUpdates, ThreadPreview, TimestampMillis, Timestamped,
UpdatedRules, UserId, UserType, UsersBlocked, UsersInvited, Version, Versioned, VersionedRules, VideoCall,
};
use utils::document_validation::validate_avatar;
use utils::text_validation::{
Expand Down Expand Up @@ -1710,7 +1709,7 @@ impl GroupChatCore {
delete_messages: new.delete_messages.unwrap_or(old.delete_messages),
update_group: new.update_group.unwrap_or(old.update_group),
pin_messages: new.pin_messages.unwrap_or(old.pin_messages),
add_members: GroupPermissionRole::Owner,
add_members: new.add_members.unwrap_or(old.add_members),
invite_users: new.invite_users.unwrap_or(old.invite_users),
react_to_messages: new.react_to_messages.unwrap_or(old.react_to_messages),
mention_all_members: new.mention_all_members.unwrap_or(old.mention_all_members),
Expand Down
3 changes: 2 additions & 1 deletion backend/libraries/types/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -1273,12 +1273,12 @@ type User = record {

type GroupPermissions = record {
change_roles : PermissionRole;
add_members : PermissionRole;
remove_members : PermissionRole;
delete_messages : PermissionRole;
update_group : PermissionRole;
pin_messages : PermissionRole;
invite_users : PermissionRole;
add_members : PermissionRole;
react_to_messages : PermissionRole;
mention_all_members : PermissionRole;
start_video_call : PermissionRole;
Expand Down Expand Up @@ -1314,6 +1314,7 @@ type OptionalGroupPermissions = record {
update_group : opt PermissionRole;
pin_messages : opt PermissionRole;
invite_users : opt PermissionRole;
add_members : opt PermissionRole;
react_to_messages : opt PermissionRole;
mention_all_members : opt PermissionRole;
start_video_call : opt PermissionRole;
Expand Down
1 change: 1 addition & 0 deletions backend/libraries/types/src/group_roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub struct OptionalGroupPermissions {
pub change_roles: Option<GroupPermissionRole>,
pub update_group: Option<GroupPermissionRole>,
pub invite_users: Option<GroupPermissionRole>,
pub add_members: Option<GroupPermissionRole>,
pub remove_members: Option<GroupPermissionRole>,
pub delete_messages: Option<GroupPermissionRole>,
pub pin_messages: Option<GroupPermissionRole>,
Expand Down

0 comments on commit aab6bfb

Please sign in to comment.