diff --git a/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift b/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift index f1f09ac24c..90ee05c063 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift @@ -376,6 +376,10 @@ public final class InviteLinkInviteController: ViewController { ActionSheetButtonItem(title: presentationData.strings.GroupInfo_InviteLink_RevokeLink, color: .destructive, action: { dismissAction() + if let invite = invite { + let _ = (revokePeerExportedInvitation(account: context.account, peerId: peerId, link: invite.link) |> deliverOnMainQueue).start(completed: { + }) + } }) ]), ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })]) diff --git a/submodules/InviteLinksUI/Sources/InviteLinkListController.swift b/submodules/InviteLinksUI/Sources/InviteLinkListController.swift index a01efc43cb..a225af6ac1 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkListController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkListController.swift @@ -326,7 +326,7 @@ private func inviteLinkListControllerEntries(presentationData: PresentationData, hasLinks = true } - if hasLinks { + if hasLinks || admin == nil { entries.append(.linksHeader(presentationData.theme, presentationData.strings.InviteLink_AdditionalLinks.uppercased())) } if admin == nil { diff --git a/submodules/TelegramCore/Sources/InvitationLinks.swift b/submodules/TelegramCore/Sources/InvitationLinks.swift index f24b0ceda1..20eba0a261 100644 --- a/submodules/TelegramCore/Sources/InvitationLinks.swift +++ b/submodules/TelegramCore/Sources/InvitationLinks.swift @@ -158,7 +158,27 @@ public func revokePeerExportedInvitation(account: Account, peerId: PeerId, link: updatePeers(transaction: transaction, peers: peers, update: { _, updated -> Peer in return updated }) - return .replace(ExportedInvitation(apiExportedInvite: invite), ExportedInvitation(apiExportedInvite: newInvite)) + + let previous = ExportedInvitation(apiExportedInvite: invite) + let new = ExportedInvitation(apiExportedInvite: newInvite) + + if previous.isPermanent && new.isPermanent { + transaction.updatePeerCachedData(peerIds: [peerId]) { peerId, current -> CachedPeerData? in + if peerId.namespace == Namespaces.Peer.CloudGroup { + var current = current as? CachedGroupData ?? CachedGroupData() + current = current.withUpdatedExportedInvitation(new) + return current + } else if peerId.namespace == Namespaces.Peer.CloudChannel { + var current = current as? CachedChannelData ?? CachedChannelData() + current = current.withUpdatedExportedInvitation(new) + return current + } else { + return current + } + } + } + + return .replace(previous, new) } else { return nil } diff --git a/submodules/TelegramUI/Sources/ComposeController.swift b/submodules/TelegramUI/Sources/ComposeController.swift index ad68e3d15b..0b457bf515 100644 --- a/submodules/TelegramUI/Sources/ComposeController.swift +++ b/submodules/TelegramUI/Sources/ComposeController.swift @@ -224,7 +224,7 @@ public class ComposeControllerImpl: ViewController, ComposeController { if let strongSelf = self { let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } let controller = PermissionController(context: strongSelf.context, splashScreen: true) - controller.setState(.custom(icon: .animation("Channels"), title: presentationData.strings.ChannelIntro_ChannelsTitle, subtitle: nil, text: presentationData.strings.ChannelIntro_ChannelsText, buttonTitle: presentationData.strings.ChannelIntro_CreateChannel, secondaryButtonTitle: nil, footerText: nil), animated: false) + controller.setState(.custom(icon: .animation("Channels"), title: presentationData.strings.ChannelIntro_Title, subtitle: nil, text: presentationData.strings.ChannelIntro_Text, buttonTitle: presentationData.strings.ChannelIntro_CreateChannel, secondaryButtonTitle: nil, footerText: nil), animated: false) controller.proceed = { [weak self] result in if let strongSelf = self { (strongSelf.navigationController as? NavigationController)?.replaceTopController(createChannelController(context: strongSelf.context), animated: true)