mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-25 07:42:15 +00:00
core, ui: prohibit to invite contact to channel
This commit is contained in:
@@ -578,7 +578,7 @@ struct ChatView: View {
|
||||
HStack {
|
||||
contentFilterMenu(withLabel: false)
|
||||
Menu {
|
||||
if groupInfo.canAddMembers {
|
||||
if groupInfo.canAddMembers && !groupInfo.useRelays {
|
||||
if (chat.chatInfo.incognito) {
|
||||
groupLinkButton()
|
||||
.appSheet(isPresented: $showGroupLinkSheet) {
|
||||
|
||||
@@ -1281,7 +1281,7 @@ fun BoxScope.ChatInfoToolbar(
|
||||
}
|
||||
is ChatInfo.Group -> {
|
||||
// Add members / group link moved to menu
|
||||
if (chatInfo.groupInfo.canAddMembers) {
|
||||
if (chatInfo.groupInfo.canAddMembers && !chatInfo.groupInfo.useRelays) {
|
||||
if (!chatInfo.incognito) {
|
||||
menuItems.add {
|
||||
ItemAction(stringResource(MR.strings.icon_descr_add_members), painterResource(MR.images.ic_person_add_500), onClick = {
|
||||
|
||||
@@ -2425,9 +2425,10 @@ processChatCommand vr nm = \case
|
||||
APIAddMember groupId contactId memRole -> withUser $ \user -> withGroupLock "addMember" groupId $ do
|
||||
-- TODO for large groups: no need to load all members to determine if contact is a member
|
||||
(group, contact) <- withFastStore $ \db -> (,) <$> getGroup db vr user groupId <*> getContact db vr user contactId
|
||||
assertDirectAllowed user MDSnd contact XGrpInv_
|
||||
let Group gInfo members = group
|
||||
Contact {localDisplayName = cName} = contact
|
||||
when (useRelays' gInfo) $ throwCmdError "can't invite contact to channel"
|
||||
assertDirectAllowed user MDSnd contact XGrpInv_
|
||||
assertUserGroupRole gInfo $ max GRAdmin memRole
|
||||
-- [incognito] forbid to invite contact to whom user is connected incognito
|
||||
when (contactConnIncognito contact) $ throwChatError CEContactIncognitoCantInvite
|
||||
|
||||
@@ -2314,6 +2314,8 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
|
||||
toView $ CEvtNewChatItems user [AChatItem SCTGroup (msgDirection @d) cInfo ci]
|
||||
|
||||
processGroupInvitation :: Contact -> GroupInvitation -> RcvMessage -> MsgMeta -> CM ()
|
||||
processGroupInvitation _ct GroupInvitation {groupProfile = GroupProfile {groupLink = Just _}} _msg _msgMeta =
|
||||
messageError "x.grp.inv: can't invite to channel"
|
||||
processGroupInvitation ct inv msg msgMeta = do
|
||||
let Contact {localDisplayName = c, activeConn} = ct
|
||||
GroupInvitation {fromMember = (MemberIdRole fromMemId fromRole), invitedMember = (MemberIdRole memId memRole), connRequest, groupLinkId} = inv
|
||||
|
||||
Reference in New Issue
Block a user