DEV: Include group_name in push notification payload for group mentions (#26081)
This commit is contained in:
parent
92d357f91a
commit
3b0b4e118c
|
@ -167,6 +167,7 @@ async function onNotification(data, siteSettings, user, appEvents) {
|
||||||
site_title: siteSettings.title,
|
site_title: siteSettings.title,
|
||||||
topic: data.topic_title,
|
topic: data.topic_title,
|
||||||
username: formatUsername(data.username),
|
username: formatUsername(data.username),
|
||||||
|
group_name: data.group_name,
|
||||||
});
|
});
|
||||||
|
|
||||||
const notificationBody = data.excerpt;
|
const notificationBody = data.excerpt;
|
||||||
|
|
|
@ -13,7 +13,14 @@ class PostAlerter
|
||||||
post
|
post
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_notification_alert(user:, post:, notification_type:, excerpt: nil, username: nil)
|
def self.create_notification_alert(
|
||||||
|
user:,
|
||||||
|
post:,
|
||||||
|
notification_type:,
|
||||||
|
excerpt: nil,
|
||||||
|
username: nil,
|
||||||
|
group_name: nil
|
||||||
|
)
|
||||||
return if user.suspended?
|
return if user.suspended?
|
||||||
|
|
||||||
if post_url = post.url
|
if post_url = post.url
|
||||||
|
@ -34,6 +41,7 @@ class PostAlerter
|
||||||
username: username || post.username,
|
username: username || post.username,
|
||||||
post_url: post_url,
|
post_url: post_url,
|
||||||
}
|
}
|
||||||
|
payload[:group_name] = group_name if group_name.present?
|
||||||
|
|
||||||
DiscourseEvent.trigger(:pre_notification_alert, user, payload)
|
DiscourseEvent.trigger(:pre_notification_alert, user, payload)
|
||||||
|
|
||||||
|
@ -655,19 +663,28 @@ class PostAlerter
|
||||||
post: original_post,
|
post: original_post,
|
||||||
notification_type: type,
|
notification_type: type,
|
||||||
username: original_username,
|
username: original_username,
|
||||||
|
group_name: group&.name,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
created.id ? created : nil
|
created.id ? created : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_notification_alert(user:, post:, notification_type:, excerpt: nil, username: nil)
|
def create_notification_alert(
|
||||||
|
user:,
|
||||||
|
post:,
|
||||||
|
notification_type:,
|
||||||
|
excerpt: nil,
|
||||||
|
username: nil,
|
||||||
|
group_name: nil
|
||||||
|
)
|
||||||
self.class.create_notification_alert(
|
self.class.create_notification_alert(
|
||||||
user: user,
|
user: user,
|
||||||
post: post,
|
post: post,
|
||||||
notification_type: notification_type,
|
notification_type: notification_type,
|
||||||
excerpt: excerpt,
|
excerpt: excerpt,
|
||||||
username: username,
|
username: username,
|
||||||
|
group_name: group_name,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ class PushNotificationPusher
|
||||||
site_title: SiteSetting.title,
|
site_title: SiteSetting.title,
|
||||||
topic: payload[:topic_title],
|
topic: payload[:topic_title],
|
||||||
username: payload[:username],
|
username: payload[:username],
|
||||||
|
group_name: payload[:group_name],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue