Expose notify platform targets as individual services (#2837)
* First pass on providing individual services for all possible targets that a notification platform supports. * Add a quite hacky first version of notification groups * Add a docstring for get_targets * Register group service under notifygroup/ and safely check for notifygroups in config * Remove notifygroups, because it belongs in its own PR * Make @balloob requested changes * get_targets()->targets * Add tests for notify targets exposed as individual services * If we dont have a platform name set in configuration, lets use the name of the platform instead of notify * Fix test docstring. * Dont use a dictionary for just one value * No need to double slugify * targets is now just a list of strings instead of a dict
This commit is contained in:
1 parent
37561765ff
commit
c1ce6855c5
4 files changed
+64
-3
No files matched your search
@@ -142,6 +142,11 @@ class HTML5NotificationService(BaseNotificationService):
|
||||
self._gcm_key = gcm_key
|
||||
self.registrations = registrations
|
||||
|
||||
@property
|
||||
def targets(self):
|
||||
"""Return a dictionary of registered targets."""
|
||||
return self.registrations.keys()
|
||||
|
||||
def send_message(self, message="", **kwargs):
|
||||
"""Send a message to a user."""
|
||||
from pywebpush import WebPusher
|
||||
|
||||
Reference in new issue
Block a user