Add more logging to debug chat mute bridging

This commit is contained in:
Tulir Asokan 2021-05-04 13:50:35 +03:00
parent dbdd3258b2
commit 29254ee29a

View file

@ -691,10 +691,10 @@ func (user *User) updateChatMute(intent *appservice.IntentAPI, portal *Portal, m
} }
var err error var err error
if mutedUntil < time.Now().Unix() { if mutedUntil < time.Now().Unix() {
user.log.Debugln("Unmuting", portal.MXID) user.log.Debugfln("Portal %s is muted until %d, unmuting...", portal.MXID, mutedUntil)
err = intent.DeletePushRule("global", pushrules.RoomRule, string(portal.MXID)) err = intent.DeletePushRule("global", pushrules.RoomRule, string(portal.MXID))
} else { } else {
user.log.Debugln("Muting", portal.MXID) user.log.Debugfln("Portal %s is muted until %d, muting...", portal.MXID, mutedUntil)
err = intent.PutPushRule("global", pushrules.RoomRule, string(portal.MXID), &mautrix.ReqPutPushRule{ err = intent.PutPushRule("global", pushrules.RoomRule, string(portal.MXID), &mautrix.ReqPutPushRule{
Actions: []pushrules.PushActionType{pushrules.ActionDontNotify}, Actions: []pushrules.PushActionType{pushrules.ActionDontNotify},
}) })
@ -834,6 +834,7 @@ func (user *User) syncPortals(chatMap map[string]whatsapp.Chat, createAll bool)
} }
create := (chat.LastMessageTime >= user.LastConnection && user.LastConnection > 0) || i < limit create := (chat.LastMessageTime >= user.LastConnection && user.LastConnection > 0) || i < limit
if len(chat.Portal.MXID) > 0 || create || createAll { if len(chat.Portal.MXID) > 0 || create || createAll {
user.log.Debugfln("Syncing chat %+v", chat.Chat.Source)
justCreated := len(chat.Portal.MXID) == 0 justCreated := len(chat.Portal.MXID) == 0
user.syncPortal(chat) user.syncPortal(chat)
user.syncChatDoublePuppetDetails(doublePuppet, chat, justCreated) user.syncChatDoublePuppetDetails(doublePuppet, chat, justCreated)