-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin_settings.py
More file actions
67 lines (49 loc) · 1.58 KB
/
plugin_settings.py
File metadata and controls
67 lines (49 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from utils import plugins
from utils.install import update_settings
PLUGIN_NAME = 'Notification Manager'
DISPLAY_NAME = 'Notification Manager'
DESCRIPTION = 'Manages events to third party APIs.'
AUTHOR = 'PLOS'
VERSION = '0.1'
SHORT_NAME = 'notification_manager'
MANAGER_URL = 'notification_manager_manager'
JANEWAY_VERSION = "1.7.4"
class NotificationManagerPlugin(plugins.Plugin):
plugin_name = PLUGIN_NAME
display_name = DISPLAY_NAME
description = DESCRIPTION
author = AUTHOR
short_name = SHORT_NAME
manager_url = MANAGER_URL
version = VERSION
janeway_version = JANEWAY_VERSION
def install():
NotificationManagerPlugin.install()
update_settings(
file_path='plugins/notification_manager/install/settings.json'
)
def hook_registry():
NotificationManagerPlugin.hook_registry()
def register_for_events():
# Plugin modules can't be imported until plugin is loaded
from events import logic as events_logic
events_logic.Events.register_for_event(
events_logic.Events.ON_ARTICLE_SUBMITTED, # The event to be registered for
publication_event, # The function to be called
)
pass
def publication_event(**kwargs):
# note that import must be here to avoid circular imports
from plugins.notification_manager import logic
request = kwargs.get('request')
article = kwargs.get('article')
# do something here
body = {
"data": [
{
"document_type": "article",
"id": article.id,
},
],
}
logic.send_message(request, body)