🐛 Fix notify level ignore will do not push new messages either
This commit is contained in:
parent
4da282012d
commit
0e0c717722
@ -84,11 +84,12 @@ func NewMessage(message models.Message) (models.Message, error) {
|
|||||||
}).Preload("Account").Find(&members).Error; err == nil {
|
}).Preload("Account").Find(&members).Error; err == nil {
|
||||||
channel := message.Channel
|
channel := message.Channel
|
||||||
message, _ = GetMessage(message.Channel, message.ID)
|
message, _ = GetMessage(message.Channel, message.ID)
|
||||||
|
doesNotify := true
|
||||||
for _, member := range members {
|
for _, member := range members {
|
||||||
if member.ID != message.Sender.ID {
|
if member.ID != message.Sender.ID {
|
||||||
switch member.Notify {
|
switch member.Notify {
|
||||||
case models.NotifyLevelNone:
|
case models.NotifyLevelNone:
|
||||||
continue
|
doesNotify = false
|
||||||
case models.NotifyLevelMentioned:
|
case models.NotifyLevelMentioned:
|
||||||
if member.ID == message.ReplyTo.SenderID {
|
if member.ID == message.ReplyTo.SenderID {
|
||||||
break
|
break
|
||||||
@ -100,11 +101,13 @@ func NewMessage(message models.Message) (models.Message, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue
|
doesNotify = false
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if doesNotify {
|
||||||
var displayText string
|
var displayText string
|
||||||
if message.Content["algorithm"] == "plain" {
|
if message.Content["algorithm"] == "plain" {
|
||||||
displayText, _ = message.Content["value"].(string)
|
displayText, _ = message.Content["value"].(string)
|
||||||
@ -127,6 +130,7 @@ func NewMessage(message models.Message) (models.Message, error) {
|
|||||||
log.Warn().Err(err).Msg("An error occurred when trying notify user.")
|
log.Warn().Err(err).Msg("An error occurred when trying notify user.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PushCommand(member.AccountID, models.UnifiedCommand{
|
PushCommand(member.AccountID, models.UnifiedCommand{
|
||||||
Action: "messages.new",
|
Action: "messages.new",
|
||||||
Payload: message,
|
Payload: message,
|
||||||
|
Loading…
Reference in New Issue
Block a user