MM-52804 - Implement SendPushNotification plugin api method (#24273)

* add SendPushNotification plugin api method

* lint; add testing.Short bc of the sleep

* add interface and generated layers

* add fields to PluginPushNotification; generate mocks

* SendPushNotification -> SendPluginPushNotification; improved comments

* more comments; fix test

* send api.ctx
Этот коммит содержится в:
Christopher Poile
2023-08-18 13:05:26 -04:00
коммит произвёл GitHub
родитель f13a531bca
Коммит 8418eefb75
9 изменённых файлов: 198 добавлений и 7 удалений

Просмотреть файл

@@ -4,9 +4,18 @@
package model
// PluginPushNotification is sent to the plugin when a push notification is going to be sent (via the
// NotificationWillBePushed hook).
// NotificationWillBePushed hook), and is used as the source data for the plugin api SendPluginPushNotification method.
//
// Note: Please keep in mind that Mattermost push notifications always refer to a specific post. Therefore, when used
// as source data for `SendPluginPushNotification`, Post and Channel must be valid in order to create a correct
// model.PushNotification.
// Note: Post and Channel are pointers so that plugins using the NotificationWillBePushed hook will not need to query the
// database on every push notification.
type PluginPushNotification struct {
Post *Post
Channel *Channel
UserID string
Post *Post // The post that will be used as the source of the push notification.
Channel *Channel // The channel that the post appeared in.
UserID string // The receiver of the push notification.
ExplicitMention bool // Used to construct the generic "@sender mentioned you" msg when `cfg.EmailSettings.PushNotificationContents` is not set to `full`
ChannelWideMention bool // Used to construct the generic "@sender notified the channel" msg when `cfg.EmailSettings.PushNotificationContents` is not set to `full`
ReplyToThreadType string // Used to construct the generic CRT msgs when `cfg.EmailSettings.PushNotificationContents` is not set to `full`; see `App.getPushNotificationMessage` for details.
}