A muted admin user can still DM you

This commit is contained in:
Noah 2023-08-13 22:59:35 -07:00
parent a1aedea2f4
commit b5429226d6

View File

@ -165,9 +165,10 @@ func (s *Server) OnMessage(sub *Subscriber, msg messages.Message) {
s.SendTo(sub.Username, message)
message.Channel = "@" + sub.Username
// Don't deliver it if the receiver has muted us.
// Don't deliver it if the receiver has muted us. Note: admin users, even if muted,
// can still deliver a DM to the one who muted them.
rcpt, err := s.GetSubscriber(strings.TrimPrefix(msg.Channel, "@"))
if err == nil && rcpt.Mutes(sub.Username) {
if err == nil && rcpt.Mutes(sub.Username) && !sub.IsAdmin() {
log.Debug("Do not send message to %s: they have muted or booted %s", rcpt.Username, sub.Username)
return
}