mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-28 12:09:41 +00:00
core, ui: prohibit to invite contact to channel (#6731)
This commit is contained in:
@@ -253,6 +253,18 @@ struct ChatView: View {
|
||||
AddGroupMembersView(chat: chat, groupInfo: groupInfo)
|
||||
}
|
||||
}
|
||||
.appSheet(isPresented: $showGroupLinkSheet) {
|
||||
if case let .group(groupInfo, _) = cInfo {
|
||||
GroupLinkView(
|
||||
groupId: groupInfo.groupId,
|
||||
groupLink: $groupLink,
|
||||
groupLinkMemberRole: $groupLinkMemberRole,
|
||||
showTitle: true,
|
||||
creatingGroup: false,
|
||||
isChannel: groupInfo.useRelays
|
||||
)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: Binding(
|
||||
get: { !forwardedChatItems.isEmpty },
|
||||
set: { isPresented in
|
||||
@@ -579,17 +591,8 @@ struct ChatView: View {
|
||||
contentFilterMenu(withLabel: false)
|
||||
Menu {
|
||||
if groupInfo.canAddMembers {
|
||||
if (chat.chatInfo.incognito) {
|
||||
if chat.chatInfo.incognito || groupInfo.useRelays {
|
||||
groupLinkButton()
|
||||
.appSheet(isPresented: $showGroupLinkSheet) {
|
||||
GroupLinkView(
|
||||
groupId: groupInfo.groupId,
|
||||
groupLink: $groupLink,
|
||||
groupLinkMemberRole: $groupLinkMemberRole,
|
||||
showTitle: true,
|
||||
creatingGroup: false
|
||||
)
|
||||
}
|
||||
} else {
|
||||
addMembersButton()
|
||||
}
|
||||
@@ -1438,7 +1441,11 @@ struct ChatView: View {
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Label("Group link", systemImage: "link.badge.plus")
|
||||
if case let .group(gInfo, _) = chat.chatInfo, gInfo.useRelays {
|
||||
Label("Channel link", systemImage: "link")
|
||||
} else {
|
||||
Label("Group link", systemImage: "link.badge.plus")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-6
@@ -1282,7 +1282,7 @@ fun BoxScope.ChatInfoToolbar(
|
||||
is ChatInfo.Group -> {
|
||||
// Add members / group link moved to menu
|
||||
if (chatInfo.groupInfo.canAddMembers) {
|
||||
if (!chatInfo.incognito) {
|
||||
if (!chatInfo.incognito && !chatInfo.groupInfo.useRelays) {
|
||||
menuItems.add {
|
||||
ItemAction(stringResource(MR.strings.icon_descr_add_members), painterResource(MR.images.ic_person_add_500), onClick = {
|
||||
showMenu.value = false
|
||||
@@ -1291,10 +1291,14 @@ fun BoxScope.ChatInfoToolbar(
|
||||
}
|
||||
} else {
|
||||
menuItems.add {
|
||||
ItemAction(stringResource(MR.strings.group_link), painterResource(MR.images.ic_add_link), onClick = {
|
||||
showMenu.value = false
|
||||
openGroupLink(chatInfo.groupInfo)
|
||||
})
|
||||
ItemAction(
|
||||
stringResource(if (chatInfo.groupInfo.useRelays) MR.strings.channel_link else MR.strings.group_link),
|
||||
painterResource(if (chatInfo.groupInfo.useRelays) MR.images.ic_link else MR.images.ic_add_link),
|
||||
onClick = {
|
||||
showMenu.value = false
|
||||
openGroupLink(chatInfo.groupInfo)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3169,7 +3173,7 @@ fun openGroupLink(groupInfo: GroupInfo, rhId: Long?, view: Any? = null, close: (
|
||||
val link = chatModel.controller.apiGetGroupLink(rhId, groupInfo.groupId)
|
||||
close?.invoke()
|
||||
ModalManager.end.showModalCloseable(true) {
|
||||
GroupLinkView(chatModel, rhId, groupInfo, link, onGroupLinkUpdated = null)
|
||||
GroupLinkView(chatModel, rhId, groupInfo, link, onGroupLinkUpdated = null, isChannel = groupInfo.useRelays)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user