Skip to content

Commit 53dc1e6

Browse files
author
isaac
committed
Merge commit '63f784a2b97c64dc4c839612e6d692381a54c086' into beta
2 parents 4e357ed + 63f784a commit 53dc1e6

6 files changed

Lines changed: 39 additions & 11 deletions

File tree

‎Telegram/Telegram-iOS/en.lproj/Localizable.strings‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16514,6 +16514,7 @@ Error: %8$@";
1651416514
"Community.Add.VisibilityHiddenInfo" = "Only invited members and community admins will see this chat.";
1651516515
"Community.Add.ActionAddToCommunity" = "Add to Community";
1651616516

16517+
"Community.Chat.JoinToView" = "You need to join this group to view its messages.";
1651716518
"Community.PrivateChat.Info" = "This group is invite-only.\nOnly its members can view it.";
1651816519
"Community.PrivateChat.MessageOwner" = "Message Group Owner";
1651916520

‎submodules/ChatPresentationInterfaceState/Sources/ChatPresentationInterfaceState.swift‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,3 +1621,17 @@ public func canSendReactionsToChat(_ state: ChatPresentationInterfaceState) -> B
16211621
return false
16221622
}
16231623
}
1624+
1625+
public func canJoinInaccessibleCommunityChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceState) -> Bool {
1626+
guard chatPresentationInterfaceState.isNotAccessible,
1627+
let renderedPeer = chatPresentationInterfaceState.renderedPeer,
1628+
let channel = renderedPeer.peer as? TelegramChannel,
1629+
case .group = channel.info,
1630+
case .left = channel.participationStatus,
1631+
let linkedCommunityId = channel.linkedCommunityId,
1632+
let community = renderedPeer.peers[linkedCommunityId] as? TelegramCommunity,
1633+
case .member = community.participationStatus else {
1634+
return false
1635+
}
1636+
return true
1637+
}

‎submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,18 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
497497
}
498498

499499
var rightPanelItems: [GlassControlGroupComponent.Item] = []
500-
rightPanelItems.append(GlassControlGroupComponent.Item(
501-
id: "search",
502-
content: .icon("Chat List/SearchIcon"),
503-
action: { [weak self] in
504-
guard let self else {
505-
return
500+
if !canJoinInaccessibleCommunityChat(interfaceState) {
501+
rightPanelItems.append(GlassControlGroupComponent.Item(
502+
id: "search",
503+
content: .icon("Chat List/SearchIcon"),
504+
action: { [weak self] in
505+
guard let self else {
506+
return
507+
}
508+
self.interfaceInteraction?.beginMessageSearch(.everything, "")
506509
}
507-
self.interfaceInteraction?.beginMessageSearch(.everything, "")
508-
}
509-
))
510+
))
511+
}
510512

511513
let panelHeight = defaultHeight(metrics: metrics)
512514
let _ = isFirstTime

‎submodules/TelegramUI/Sources/ChatControllerContentData.swift‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,9 @@ extension ChatControllerImpl {
922922
if let associatedPeerId = peer.associatedPeerId, let associatedPeer = peerView.peers[associatedPeerId] {
923923
peers[associatedPeer.id] = associatedPeer
924924
}
925+
if let containerPeerId = peer.containerPeerId, let containerPeer = peerView.peers[containerPeerId] {
926+
peers[containerPeer.id] = containerPeer
927+
}
925928
renderedPeer = RenderedPeer(peerId: peer.id, peers: peers, associatedMedia: peerView.media)
926929
}
927930

@@ -1500,6 +1503,9 @@ extension ChatControllerImpl {
15001503
if let associatedPeerId = peer.associatedPeerId, let associatedPeer = peerView.peers[associatedPeerId] {
15011504
peers[associatedPeer.id] = associatedPeer
15021505
}
1506+
if let containerPeerId = peer.containerPeerId, let containerPeer = peerView.peers[containerPeerId] {
1507+
peers[containerPeer.id] = containerPeer
1508+
}
15031509
renderedPeer = RenderedPeer(peerId: peer.id, peers: peers, associatedMedia: peerView.media)
15041510
}
15051511

@@ -1875,6 +1881,9 @@ extension ChatControllerImpl {
18751881
if let associatedPeerId = peer.associatedPeerId, let associatedPeer = peerView.peers[associatedPeerId] {
18761882
peers[associatedPeer.id] = associatedPeer
18771883
}
1884+
if let containerPeerId = peer.containerPeerId, let containerPeer = peerView.peers[containerPeerId] {
1885+
peers[containerPeer.id] = containerPeer
1886+
}
18781887
renderedPeer = RenderedPeer(peerId: peer.id, peers: peers, associatedMedia: peerView.media)
18791888

18801889
self.state.infoAvatar = .peer(

‎submodules/TelegramUI/Sources/ChatControllerNode.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,9 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
37293729
if let peer = chatPresentationInterfaceState.renderedPeer?.peer, let restrictionTextValue = peer.restrictionText(platform: "ios", contentSettings: self.context.currentContentSettings.with { $0 }), !restrictionTextValue.isEmpty {
37303730
restrictionText = restrictionTextValue
37313731
} else if chatPresentationInterfaceState.isNotAccessible {
3732-
if case .replyThread = self.chatLocation {
3732+
if canJoinInaccessibleCommunityChat(chatPresentationInterfaceState) {
3733+
restrictionText = chatPresentationInterfaceState.strings.Community_Chat_JoinToView
3734+
} else if case .replyThread = self.chatLocation {
37333735
restrictionText = chatPresentationInterfaceState.strings.CommentsGroup_ErrorAccessDenied
37343736
} else if let peer = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = peer.info {
37353737
restrictionText = chatPresentationInterfaceState.strings.Channel_ErrorAccessDenied

‎submodules/TelegramUI/Sources/ChatInterfaceStateInputPanels.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
3434
if let renderedPeer = chatPresentationInterfaceState.renderedPeer, renderedPeer.peer?.restrictionText(platform: "ios", contentSettings: context.currentContentSettings.with { $0 }) != nil {
3535
return (nil, nil)
3636
}
37-
if chatPresentationInterfaceState.isNotAccessible {
37+
if chatPresentationInterfaceState.isNotAccessible && !canJoinInaccessibleCommunityChat(chatPresentationInterfaceState) {
3838
return (nil, nil)
3939
}
4040

0 commit comments

Comments
 (0)