MM-53924 - Implement push notifications plugin hook and plugin api method (#24350)

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

This reverts commit 8418eefb75.

* Revert "MM-53924 - Implement NotificationWillBePushed plugin hook (#24263)"

This reverts commit f13a531bca.

* implement NotificationWillBePushed plugin hook

* implement SendPushNotification plugin api method

* move where we're setting post and channel type

* fix comment

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Christopher Poile
2023-08-24 12:33:53 -04:00
коммит произвёл GitHub
родитель dad579daee
Коммит 69c11cfe14
16 изменённых файлов: 169 добавлений и 166 удалений

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

@@ -3639,15 +3639,17 @@ func (_m *API) SendMail(to string, subject string, htmlBody string) *model.AppEr
return r0
}
// SendPluginPushNotification provides a mock function with given fields: notification
func (_m *API) SendPluginPushNotification(notification *model.PluginPushNotification) error {
ret := _m.Called(notification)
// SendPushNotification provides a mock function with given fields: notification, userID
func (_m *API) SendPushNotification(notification *model.PushNotification, userID string) *model.AppError {
ret := _m.Called(notification, userID)
var r0 error
if rf, ok := ret.Get(0).(func(*model.PluginPushNotification) error); ok {
r0 = rf(notification)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.PushNotification, string) *model.AppError); ok {
r0 = rf(notification, userID)
} else {
r0 = ret.Error(0)
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0

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

@@ -193,18 +193,30 @@ func (_m *Hooks) MessageWillBeUpdated(c *plugin.Context, newPost *model.Post, ol
return r0, r1
}
// NotificationWillBePushed provides a mock function with given fields: pushNotification
func (_m *Hooks) NotificationWillBePushed(pushNotification *model.PluginPushNotification) bool {
ret := _m.Called(pushNotification)
// NotificationWillBePushed provides a mock function with given fields: pushNotification, userID
func (_m *Hooks) NotificationWillBePushed(pushNotification *model.PushNotification, userID string) (*model.PushNotification, string) {
ret := _m.Called(pushNotification, userID)
var r0 bool
if rf, ok := ret.Get(0).(func(*model.PluginPushNotification) bool); ok {
r0 = rf(pushNotification)
var r0 *model.PushNotification
var r1 string
if rf, ok := ret.Get(0).(func(*model.PushNotification, string) (*model.PushNotification, string)); ok {
return rf(pushNotification, userID)
}
if rf, ok := ret.Get(0).(func(*model.PushNotification, string) *model.PushNotification); ok {
r0 = rf(pushNotification, userID)
} else {
r0 = ret.Get(0).(bool)
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.PushNotification)
}
}
return r0
if rf, ok := ret.Get(1).(func(*model.PushNotification, string) string); ok {
r1 = rf(pushNotification, userID)
} else {
r1 = ret.Get(1).(string)
}
return r0, r1
}
// OnActivate provides a mock function with given fields: