diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift index d706116dea..50f3fd57b0 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift @@ -139,8 +139,8 @@ public enum EditChatFolderLinkError { case generic } -func _internal_editChatFolderLink(account: Account, filterId: Int32, link: ExportedChatFolderLink, title: String?, peerIds: [EnginePeer.Id]?, revoke: Bool) -> Signal { - return account.postbox.transaction { transaction -> Signal in +func _internal_editChatFolderLink(account: Account, filterId: Int32, link: ExportedChatFolderLink, title: String?, peerIds: [EnginePeer.Id]?, revoke: Bool) -> Signal { + return account.postbox.transaction { transaction -> Signal in var flags: Int32 = 0 if revoke { flags |= 1 << 0 @@ -150,13 +150,24 @@ func _internal_editChatFolderLink(account: Account, filterId: Int32, link: Expor } var peers: [Api.InputPeer]? if let peerIds = peerIds { + flags |= 1 << 2 peers = peerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer) } return account.network.request(Api.functions.communities.editExportedInvite(flags: flags, community: .inputCommunityDialogFilter(filterId: filterId), slug: link.slug, title: title, peers: peers)) |> mapError { _ -> EditChatFolderLinkError in return .generic } - |> ignoreValues + |> map { result in + switch result { + case let .exportedCommunityInvite(flags, title, url, peers): + return ExportedChatFolderLink( + title: title, + link: url, + peerIds: peers.map(\.peerId), + isRevoked: (flags & (1 << 0)) != 0 + ) + } + } } |> castError(EditChatFolderLinkError.self) |> switchToLatest diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift index 15a98ab9f8..3d45daad05 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift @@ -1034,7 +1034,7 @@ public extension TelegramEngine { return _internal_getExportedChatFolderLinks(account: self.account, id: id) } - public func editChatFolderLink(filterId: Int32, link: ExportedChatFolderLink, title: String?, peerIds: [EnginePeer.Id]?, revoke: Bool) -> Signal { + public func editChatFolderLink(filterId: Int32, link: ExportedChatFolderLink, title: String?, peerIds: [EnginePeer.Id]?, revoke: Bool) -> Signal { return _internal_editChatFolderLink(account: self.account, filterId: filterId, link: link, title: title, peerIds: peerIds, revoke: revoke) }