forum: let non-members preview topic replies in a public channel
ListChannelReplies used getChannelForMemberOrLinkedGuest, so messages.getReplies was member-only. ListChannelHistory (flat history) uses getChannelForViewer and already allows a public channel's non-members to preview it. The mismatch meant that on a public forum you could preview the flat history but not the topics - and after leaving, tdesktop's topic view got CHANNEL_PRIVATE and sat on "Loading..." forever instead of rendering a preview. Switch the primary channel lookup in ListChannelReplies (both stores) to the viewer-scope path. Private channels still return CHANNEL_PRIVATE to non-members; the broadcast comment-thread lookup is unchanged.
This commit is contained in:
parent
f7a583813b
commit
f6d7ef4652
3 changed files with 26 additions and 2 deletions
|
|
@ -501,7 +501,9 @@ func (s *ChannelStore) GetForumTopicsByID(_ context.Context, viewerUserID, chann
|
|||
func (s *ChannelStore) ListChannelReplies(_ context.Context, viewerUserID int64, filter domain.ChannelRepliesFilter) (domain.ChannelHistory, error) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
source, member, err := s.channelAndMemberOrLinkedGuestLocked(viewerUserID, filter.ChannelID)
|
||||
// Viewer scope (not strict membership): non-members can preview topic
|
||||
// replies in a public channel/supergroup, matching ListChannelHistory.
|
||||
source, member, _, err := s.channelForViewerLocked(viewerUserID, filter.ChannelID)
|
||||
if err != nil {
|
||||
return domain.ChannelHistory{}, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue