per-resource notifications #15 - #187
Conversation
|
Thanks, a valuable addition! Pls give me some time to grasp changes, in particular the intended design. Good idea to split into |
Afair, GeoNode uses strict pep8 line width, but I'd say 120 chars at least is a sane value. |
|
I’d prefer pep8 strict for line length if possible. |
I've added some rationale in PR's description. Could you review? |
|
Design and overall approach ok. To be resolved (order of importance):
|
justb4
left a comment
There was a problem hiding this comment.
Sorry, did not used Review form, seee comments:
#187 (comment)
True. Other way would be to keep |
|
On 26-02-18 19:10, Cezary Statkiewicz wrote:
upgrading existing GHC installations: looks like
GHC_NOTIFICATIONS_EMAIL is no longer used. Upgraded GHC will have no
Recipients for existing Resources hence no notifications (?).
Suggestion: initialize Recipients from GHC_NOTIFICATIONS_EMAIL
within Alembic upgrade? (only if GHC_NOTIFICATIONS is True).
True. Other way would be to keep |GHC_NOTIFICATIONS_EMAIL| and use it
along with per-resource notification emails. I imagine that sometimes
it's better to set one global notification target, than having
recipients set for each resource. Would that work?
That is even better: one could get either/or. Best also to make that
clear in doc, maybe UI. Many GHC installs have just one or more emails
for all Resources.
|
I've restored use of
Done. I've also added source file for diagram for future use.
I've added simple webhook implementation (model is slightly improved, notifications logic decoupled from detecting change, ui handling for multiple webhooks configuration is added, tests and docs are updated). Could you review? |
|
Tested by pulling in branch 15_resource_notifications. Also to notify @tomkralidis . Per Resource email and webhook-notification (using https://requestb.in, very handy) confirmed working, though these issues were found:
self.preparer.format_type(type_), The Enum type should have a kw-arg name like in and in migration code in See also http://docs.sqlalchemy.org/en/latest/core/type_basics.html Upgrade Postgres ok with these fixes.
|
|
Thanks for detailed review!
Right. I was checking with sqlite only. I knew that PG supports enums, but didn't know about that subtle difference in SA. Should be fixed.
Should be fixed.
I've added label to template, updated docs and translations.
I couldn't reproduce this. Did you add subsequent webhooks with |
|
Tested new commits: 23143cb..5feafb5 on march 5, 2018, 15:00 UTC
comments below.
On 05-03-18 14:11, Cezary Statkiewicz wrote:
see above: 'webhook' should be in Enum definition in bb91fb332c36.py
Right. I was checking with sqlite only. I knew that PG supports enums,
but didn't know about that subtle difference in SA. Should be
fixed.
Ok now.
edit a Resource. Click 'Save' without filling in email, always
error: Save: ('Bad value: Invalid email address.',
ValidationError(u'Invalid email address.',)) Looks like at least one
email is always required. Especially existing installations may
require only the global notification email.
Should be fixed.
Ok now.
not clear how to separate email addresses in Resource Edit form
(comma-separated), give suggestion text.
I've added label to template, updated docs and translations.
Ok, for
label only in my case the label "You can enter multiple emails separated
with comma" is above (Resource) "Name" Input Field, not intended "Notify
emails" Field.
specifying multiple webhooks in Resource Edit form: only first
webhook is stored and notified.
I couldn't reproduce this. Did you add subsequent webhooks with |+|?
I've added green/red colors to those widgets, as they may be hard to
notice.
Is ok. Yes, forgot entering |+|).
|
fixed |
|
On 05-03-18 19:23, Cezary Statkiewicz wrote:
Ok, for
label only in my case the label "You can enter multiple emails separated
with comma" is above (Resource) "Name" Input Field, not intended "Notify
emails" Field.
fixed
Ok, confirmed! Wait for merge!
|
|
@justb4 It is not clear for me if you are still requesting chamges on this PR. Can you , please, clarify? |
|
@cezio @simboss we are clear to merge. Thanks for patience. @tomkralidis and I needed to make sure we can perform the DB upgrade on the demo server: http://demo.geohealthcheck.org which is hooked to commits on master. Today lacked time because of WFS 3 hackathon and regular work. Merge upcoming.. |
|
PR running now on http://demo.geohealthcheck.org . Had some trouble due to outdated |
|
@justb4 no worries, I just wanted to make sure you weren't expecting any actions from us. |
partial fix #15
This patch adds per-resource notifications. Notifications have separate
Recipientmodel, which is m2m (throughResourceNotification) withResourcemodel.Recipientcontains two main fields:channel- medium type (for nowemailonly)location- value that identifies recipient for given channel. value passed tolocationwill be validated when new instance is created.Recipientmodel is not related to any user, so resource's owner can set arbitrary email (or any other recipient) to receive notifications. Recipient doesn't have to be GHC user to get notifications (or can be non-human, like slack bot).Each time
Resource's recipients are modified, unusedRecipients are removed.In UI, recipients are added with input field (for email), with autocomplete, which suggests from values added for resources owned by current user.
I've included test for model api, and support for recipients in data export.
Other changes, improvements to code base:
wtformsin requirements__init__.py)alembic_helpersin migrations with regular import