From d11290ef4ad15aa23d77254a8d4328c6fbc36d1d Mon Sep 17 00:00:00 2001 From: Pascal Precht <445106+PascalPrecht@users.noreply.github.com> Date: Wed, 4 May 2022 13:42:10 +0200 Subject: [PATCH] fix: only dispatch magnetlink when owner of community --- protocol/messenger_communities.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go index 499a57c61..9c901bab7 100644 --- a/protocol/messenger_communities.go +++ b/protocol/messenger_communities.go @@ -96,9 +96,16 @@ func (m *Messenger) handleCommunitiesHistoryArchivesSubscription(c chan *communi m.config.messengerSignalsHandler.HistoryArchivesSeeding(sub.HistoryArchivesSeedingSignal.CommunityID) - err := m.dispatchMagnetlinkMessage(sub.HistoryArchivesSeedingSignal.CommunityID) + c, err := m.communitiesManager.GetByIDString(sub.HistoryArchivesSeedingSignal.CommunityID) if err != nil { - m.logger.Debug("failed to dispatch magnetlink message", zap.Error(err)) + m.logger.Debug("failed to retrieve community by id string", zap.Error(err)) + } + + if c.IsAdmin() { + err := m.dispatchMagnetlinkMessage(sub.HistoryArchivesSeedingSignal.CommunityID) + if err != nil { + m.logger.Debug("failed to dispatch magnetlink message", zap.Error(err)) + } } }