wiki
wiki copied to clipboard
Feature: Email notification on comment
This pull requests extends the comment provider named "default" with an email notification. This pull request defines a new job that collects unsent comments. It can notify about multiple comments that were added after the last job ran.
Before merging this we probably need to:
- [ ] Adjust the name of the
server/db/migrations/2.5.292.js
file to whatever version this PR lands in. - [x] Add a SQLite migration. I have only tested with PostgreSQL.
- [x] ~~Add some way to trigger the notification job - or explain how to configure it on the server. Right now I use the operating system cron. This works by adding the command
node server/core/worker.js --job=send-comment-notification-emails
to crontab. I can imagine to find or build a poormanscron feature within the node server, so notifications are triggered by HTTP requests. Then, we'd need to define a frequency, preferably by config.~~ - [ ] Potentially add a test - please guide me though your expectations here.
- [ ] Add the new i18text in a proper way. I have tested it by running this SQL:
update locales set strings=jsonb_set(strings, '{emails}', '{ "notification-email": { "subject": "New comments", "item": "Comment on page <a href=''{{pagePath}}''>{{pageTitle}}</a> by <a href=''mailto:{{email}}''>{{commentAuthorName}}</a>" } }', true) where code = 'en';
I have added a textarea to the comments admin page:
Here is the link to canny.io: https://feedback.js.wiki/wiki/p/send-an-email-when-a-comment-is-added
Very cool.
To trigger a job on schedule, you need to add an entry to https://github.com/requarks/wiki/blob/main/server/app/data.yml#L118-L139
Could this be expanded so users can subscribe to certain pages so they only get comment notifications for that page?
@mike-lloyd03 Sure, but I might not be the person to write the code. Before expanding the feature, I'd like to get this PR merged.
@NGPixel I have updated the data.yml
and the description of this pull request. Let me know if you need anything else from me to get this mergeable.
We have used this feature in our production instance of the wiki for 7 days now and it works great.
@NGPixel Let me know where I can help to get this into a release. Getting English texts into the official i18n seems crucial.
Can this be enhanced to send email on the event of the page being changed?
We have used this feature in our production instance of the wiki for 7 days now and it works great.
@NGPixel Let me know where I can help to get this into a release. Getting English texts into the official i18n seems crucial.
@fonata , just curious, is there any blocking issue for this PR's merge?
I have a site that will use this as soon as it is merged. We use sqlite and I'd be happy to test or help out.
just curious, is there any blocking issue for this PR's merge?
@farzadpanahi I am not aware of open issues.
Can this be enhanced to send email on the event of the page being changed?
@zhuzhzh I suggest that you open another issue or pull request for that, as it is a different feature with different config settings.
Hey guys,
To check if we can review that and merge it, it's a feature we are waiting for from a couple of mounts. We can also help with testing it.
I would absolutely love to see a feature like this land in WikiJS. However, to really be useful, I think we need some more granularity and control similar to what @mike-lloyd03 suggested.
Users should be able to subscribe/unsubscribe to the comments section of any given page. In addition, users should have some level of control over their default subscriptions behavior. For example, if you leave a comment on a page, that could auto-subscribe you if you've enabled it.
What I'm really hoping for, perhaps in WikiJS v3, is a full-blown event driven webhooks abstraction. That could potentially serve as the backbone for comment notifications.