mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 19:57:43 +00:00
only alert on non deleted messages
This commit is contained in:
parent
78e48a8f3b
commit
b07bf599de
1 changed files with 13 additions and 1 deletions
|
@ -280,7 +280,14 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
"count": msgs.Count,
|
"count": msgs.Count,
|
||||||
}).Debug("fetched messages")
|
}).Debug("fetched messages")
|
||||||
|
|
||||||
|
for i := msgs.Count - 1; i >= 0; i-- {
|
||||||
|
msg := msgs.Children[i]
|
||||||
|
|
||||||
|
if !msg.IsDeleted() {
|
||||||
account.LastMessageID = msgs.Children[0].FullName()
|
account.LastMessageID = msgs.Children[0].FullName()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err = nc.accountRepo.Update(ctx, &account); err != nil {
|
if err = nc.accountRepo.Update(ctx, &account); err != nil {
|
||||||
nc.logger.WithFields(logrus.Fields{
|
nc.logger.WithFields(logrus.Fields{
|
||||||
|
@ -310,6 +317,11 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
// Iterate backwards so we notify from older to newer
|
// Iterate backwards so we notify from older to newer
|
||||||
for i := msgs.Count - 1; i >= 0; i-- {
|
for i := msgs.Count - 1; i >= 0; i-- {
|
||||||
msg := msgs.Children[i]
|
msg := msgs.Children[i]
|
||||||
|
|
||||||
|
if msg.IsDeleted() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
notification := &apns2.Notification{}
|
notification := &apns2.Notification{}
|
||||||
notification.Topic = "com.christianselig.Apollo"
|
notification.Topic = "com.christianselig.Apollo"
|
||||||
notification.Payload = payloadFromMessage(account, msg, msgs.Count)
|
notification.Payload = payloadFromMessage(account, msg, msgs.Count)
|
||||||
|
|
Loading…
Reference in a new issue