From af369c34cbf54e76996e138f4fd47d2b879ccfe6 Mon Sep 17 00:00:00 2001 From: texuf Date: Thu, 15 Sep 2022 08:25:34 -0700 Subject: [PATCH] Disable the updated check to enable marking messages > 1 day old as read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I couldn’t clear notifications for messages greater than 1 day old because they no longer existed :) --- userapi/consumers/syncapi_readupdate.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/userapi/consumers/syncapi_readupdate.go b/userapi/consumers/syncapi_readupdate.go index 54654f757..c152621aa 100644 --- a/userapi/consumers/syncapi_readupdate.go +++ b/userapi/consumers/syncapi_readupdate.go @@ -95,22 +95,22 @@ func (s *OutputReadUpdateConsumer) onMessage(ctx context.Context, msgs []*nats.M log.Tracef("Received read update from sync API: %#v", read) if read.Read > 0 { - updated, err := s.db.SetNotificationsRead(ctx, localpart, roomID, int64(read.Read), true) + /*updated*/ _, err := s.db.SetNotificationsRead(ctx, localpart, roomID, int64(read.Read), true) if err != nil { log.WithError(err).Error("userapi EDU consumer") return false } - if updated { - if err = s.syncProducer.GetAndSendNotificationData(ctx, userID, roomID); err != nil { - log.WithError(err).Error("userapi EDU consumer: GetAndSendNotificationData failed") - return false - } - if err = util.NotifyUserCountsAsync(ctx, s.pgClient, localpart, s.db); err != nil { - log.WithError(err).Error("userapi EDU consumer: NotifyUserCounts failed") - return false - } + // if updated { + if err = s.syncProducer.GetAndSendNotificationData(ctx, userID, roomID); err != nil { + log.WithError(err).Error("userapi EDU consumer: GetAndSendNotificationData failed") + return false } + if err = util.NotifyUserCountsAsync(ctx, s.pgClient, localpart, s.db); err != nil { + log.WithError(err).Error("userapi EDU consumer: NotifyUserCounts failed") + return false + } + //} } if read.FullyRead > 0 {