notifications

pull/94/head
Hunter Long 2018-11-01 16:26:25 +01:00
parent ce6adc9d1c
commit 5f95b72744
3 changed files with 3 additions and 9 deletions

View File

@ -278,11 +278,11 @@ CheckNotifier:
ok, _ := notification.WithinLimits()
if ok {
msg := notification.Queue[0]
err := n.Send(msg)
err := n.Send(msg.Data)
if err != nil {
utils.Log(2, fmt.Sprintf("notifier %v had an error: %v", notification.Method, err))
}
notification.makeLog(msg)
notification.makeLog(msg.Data)
notification.Queue = notification.Queue[1:]
rateLimit = notification.Delay
}

View File

@ -100,7 +100,7 @@ func (u *mobilePush) OnTest() error {
return nil
}
// Send will send a HTTP Post to the discord API. It accepts type: []byte
// Send will send message to expo mobile push notifications endpoint
func (u *mobilePush) Send(msg interface{}) error {
pushMessage := msg.(*expo.PushMessage)
client := expo.NewPushClient(nil)

View File

@ -106,12 +106,6 @@ func TestMobileNotifier(t *testing.T) {
assert.True(t, ok)
})
t.Run("mobile Send", func(t *testing.T) {
err := mobile.Send(slackTestMessage)
assert.Nil(t, err)
assert.Equal(t, 0, len(mobile.Queue))
})
t.Run("mobile Test", func(t *testing.T) {
err := mobile.OnTest()
assert.Nil(t, err)