Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Comment email notifications for users #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Comment email notifications for users #7

wants to merge 4 commits into from

Conversation

salsa-nathan
Copy link
Contributor

@salsa-nathan salsa-nathan commented Feb 6, 2020

Purpose

This pull request adds functionality for users to follow or mute comments at the dataset level or for a specific comment thread of a dataset.

Comment notifications (via email) are managed by opt-in. This gives users full control over which comments they will receive notifications for (or none).

When a user adds a new comment, or replies to an existing comment, they will automatically follow that thread.

image

Approach

  • Added a new setting in CKAN .ini file ckan.comments.follow_mute_enabled to enable follow/mute UI (default: False).

  • A new database model (comment_notification_recipient) was added to the extension. A paster command is also added to initialise the database table in the CKAN postgres database.

  • Comment follow and mute routes were added to the extension, along with a controller class to handle requests via those routes.

  • A helper function file was created to isolate required functionality and enable reuse of those functions.

  • The comment list template was adjusted to add follow/mute related markup via template snippets, along with the necessary CSS, Javascript code and email notification templates.

@salsa-nathan salsa-nathan marked this pull request as ready for review February 6, 2020 23:07
cd /usr/lib/ckan/default/src/ckanext-ytp-comments # Your PATH may vary

paster init_notifications_db -c /etc/ckan/default/development.ini # Use YOUR path and relevant CKAN .ini file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be added to the normal InitDBCommand, so we have just one migration command to run for the plugin ?

@olivierdalang
Copy link

Thanks, this is almost what I needed too :-)

IMO, currently, this PR is slightly complex in terms of UX.

I'd find it much simpler if we just reused the existing dataset subscription feature to also send notifications about new comments. So we just have one button, meaning "I'm interested in this dataset and don't want to miss anything about it". The button could potentially be added to the comment section too.

@olivierdalang
Copy link

Also we could maybe hook into the activity stream ? It would be nice if comments displayed there as well.

@olivierdalang
Copy link

Here's a commit that hooks into the activity stream : olivierdalang@c22595d

It means comments now appear in the activity stream of the package, but also in the news feed, and works with activity stream email notifications !

Here's how it looks :
image

I feel if we change the logic to automatically follow a package when a user comments, it's quite nice, for a very small patch. The only relatively ugly thing is the monkey patch, as I couldn't find a way to add new activity stream types cleanly...

@salsa-nathan Let me know what you think !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants