mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #1981 from omnivore-app/fix/rule
Disable push notification action in rules engine
This commit is contained in:
commit
00d0cc2dd1
2 changed files with 20 additions and 21 deletions
|
|
@ -1,9 +1,8 @@
|
|||
import { NotificationData, sendNotification } from './notification'
|
||||
import { getAuthToken, PubSubData } from './index'
|
||||
import axios, { AxiosResponse } from 'axios'
|
||||
import { filterPage } from './filter'
|
||||
import { getAuthToken, PubSubData } from './index'
|
||||
import { setLabels } from './label'
|
||||
import { archivePage, markPageAsRead } from './page'
|
||||
import { filterPage } from './filter'
|
||||
|
||||
export enum RuleActionType {
|
||||
AddLabel = 'ADD_LABEL',
|
||||
|
|
@ -141,25 +140,25 @@ export const triggerActions = async (
|
|||
filteredPage.readingProgressPercent < 100 &&
|
||||
actionPromises.push(markPageAsRead(apiEndpoint, authToken, data.id))
|
||||
)
|
||||
case RuleActionType.SendNotification: {
|
||||
const data: NotificationData = {
|
||||
title: 'New page added to your library',
|
||||
body: filteredPage.title,
|
||||
image: filteredPage.image || undefined,
|
||||
}
|
||||
// case RuleActionType.SendNotification: {
|
||||
// const data: NotificationData = {
|
||||
// title: 'New page added to your library',
|
||||
// body: filteredPage.title,
|
||||
// image: filteredPage.image || undefined,
|
||||
// }
|
||||
|
||||
const params = action.params
|
||||
if (params.length > 0) {
|
||||
const param = JSON.parse(params[0]) as NotificationData
|
||||
data.body = param.body || data.body
|
||||
data.title = param.title || data.title
|
||||
data.image = param.image || data.image
|
||||
}
|
||||
// const params = action.params
|
||||
// if (params.length > 0) {
|
||||
// const param = JSON.parse(params[0]) as NotificationData
|
||||
// data.body = param.body || data.body
|
||||
// data.title = param.title || data.title
|
||||
// data.image = param.image || data.image
|
||||
// }
|
||||
|
||||
return actionPromises.push(
|
||||
sendNotification(apiEndpoint, authToken, data)
|
||||
)
|
||||
}
|
||||
// return actionPromises.push(
|
||||
// sendNotification(apiEndpoint, authToken, data)
|
||||
// )
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export enum RuleActionType {
|
|||
AddLabel = 'ADD_LABEL',
|
||||
Archive = 'ARCHIVE',
|
||||
MarkAsRead = 'MARK_AS_READ',
|
||||
SendNotification = 'SEND_NOTIFICATION',
|
||||
// SendNotification = 'SEND_NOTIFICATION',
|
||||
}
|
||||
|
||||
export interface Rule {
|
||||
|
|
|
|||
Loading…
Reference in a new issue