fix(community): fix member role not being updated
This commit is contained in:
parent
605e3a4ed0
commit
6f119b9c53
|
@ -1913,8 +1913,9 @@ func (o *Community) CanPost(pk *ecdsa.PublicKey, chatID string, messageType prot
|
|||
if !isChatMember {
|
||||
return false, nil
|
||||
}
|
||||
isPoster := member.ChannelRole == protobuf.CommunityMember_CHANNEL_ROLE_POSTER
|
||||
isViewer := member.ChannelRole == protobuf.CommunityMember_CHANNEL_ROLE_VIEWER
|
||||
|
||||
isPoster := member.GetChannelRole() == protobuf.CommunityMember_CHANNEL_ROLE_POSTER
|
||||
isViewer := member.GetChannelRole() == protobuf.CommunityMember_CHANNEL_ROLE_VIEWER
|
||||
return isPoster || (isViewer && chat.ViewersCanPostReactions), nil
|
||||
|
||||
default:
|
||||
|
|
|
@ -1056,11 +1056,11 @@ func (m *Manager) ReevaluateMembers(community *Community) (map[protobuf.Communit
|
|||
if response.ViewAndPostPermissions.Satisfied {
|
||||
channelRole = protobuf.CommunityMember_CHANNEL_ROLE_POSTER
|
||||
}
|
||||
if !isMemberAlreadyInChannel {
|
||||
_, err := community.AddMemberToChat(channelID, memberPubKey, []protobuf.CommunityMember_Roles{}, channelRole)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Add the member back to the chat member list in case the role changed (it replaces the previous values)
|
||||
_, err := community.AddMemberToChat(channelID, memberPubKey, []protobuf.CommunityMember_Roles{}, channelRole)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if isMemberAlreadyInChannel {
|
||||
_, err := community.RemoveUserFromChat(memberPubKey, channelID)
|
||||
|
|
Loading…
Reference in New Issue