diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5a7d334503..a3aafb04c4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -133,11 +133,11 @@ def alert_and_redirect_moderated flash[:error] = I18n.t('application_controller.author_has_been_banned') redirect_to '/' elsif @node.status == 4 && (current_user && (current_user.role == 'admin' || current_user.role == 'moderator')) - flash[:warning] = "First-time poster #{@node.author.name} submitted this #{time_ago_in_words(@node.created_at)} ago and it has not yet been approved by a moderator. Approve Spam" + flash.now[:warning] = "First-time poster #{@node.author.name} submitted this #{time_ago_in_words(@node.created_at)} ago and it has not yet been approved by a moderator. Approve Spam" elsif @node.status == 4 && (current_user && current_user.id == @node.author.id) && !flash[:first_time_post] - flash[:warning] = "Thank you for contributing open research, and thanks for your patience while your post is approved by community moderators and we'll email you when it is published. In the meantime, if you have more to contribute, feel free to do so." + flash.now[:warning] = "Thank you for contributing open research, and thanks for your patience while your post is approved by community moderators and we'll email you when it is published. In the meantime, if you have more to contribute, feel free to do so." elsif @node.status == 3 && (current_user && (current_user.is_coauthor(@node) || current_user.can_moderate?)) && !flash[:first_time_post] - flash[:warning] = "This is a draft note. Once you're ready, click Publish Draft to make it public. You can share it with collaborators using this private link #{@node.draft_url}" + flash.now[:warning] = "This is a draft note. Once you're ready, click Publish Draft to make it public. You can share it with collaborators using this private link #{@node.draft_url}" elsif @node.status != 1 && @node.status != 3 && !(current_user && (current_user.role == 'admin' || current_user.role == 'moderator')) # if it's spam or a draft # no notification; don't let people easily fish for existing draft titles; we should try to 404 it diff --git a/doc/EMAIL.md b/doc/EMAIL.md index 9fd2ced087..3f470d3fe0 100644 --- a/doc/EMAIL.md +++ b/doc/EMAIL.md @@ -8,4 +8,38 @@ After configurations are done we are good to start the `mailman` server. For sta > ruby script/mailman_server -Above command will start the server and then the mailman server will do polling in every 60 seconds(which is by default) to check for the incoming mail. However polling time can be changed by setting value to `Mailman.config.poll_interval`(more details can be found at its official [mailman user guide](https://github.com/mailman/mailman/blob/master/USER_GUIDE.md)). Logs for mailman can be seen oin Mailman log file which is present in `log` folder. \ No newline at end of file +Above command will start the server and then the mailman server will do polling in every 60 seconds(which is by default) to check for the incoming mail. However polling time can be changed by setting value to `Mailman.config.poll_interval`(more details can be found at its official [mailman user guide](https://github.com/mailman/mailman/blob/master/USER_GUIDE.md)). Logs for mailman can be seen oin Mailman log file which is present in `log` folder. + 3. + + +## Email Settings + +Users can modify **Email Settings** by visiting [https://publiclab.org/settings](https://publiclab.org/settings). Settings for each user are saved by using UserTags on their profiles. +For each setting, there is an associated tag with it. Below is the table showing associated tags with setting. + +We consider absence of tag as true and presence of tag as false for setting, so whenever a user turn-off a setting, corressponding user-tag is generated and turning setting on again will delete the tag. +So, while notifying a user UserTag is checked in different files and user is notified depending on the presence or absence of the tag. + +| Email Settings | Default | User tag to override default (for turning OFF) | File where tag is used | +| ------------- | ------------- | ----------- | ----------- | +| Notification by email for comments on your posts | ON | notify-comment-direct:false | [app/models/comment.rb](https://github.com/publiclab/plots2/blob/master/app/models/comment.rb#L135) | +| Notification by email for likes on your posts | ON |notify-likes-direct:false | [app/models/node.rb](https://github.com/publiclab/plots2/blob/master/app/models/node.rb#L906) | +| Notification by email for comments on all posts you've commented on | ON | notify-comment-indirect:false | [app/models/concerns/comments_shared.rb](https://github.com/publiclab/plots2/blob/master/app/models/concerns/comments_shared.rb#L24) | + + +### Digest Settings + +Digest settings are a part of **Email Settings** only, but they work a little differently. Digest settings also depend on UserTags. +In case of digest settings, presence of tag marks true and absence of tag as false. There are 2 digest settings currently: + +| Digest Settings | User Tag | +| ------------- | ------------- | +| Do you want to receive customized digest weekly | digest:weekly | +| Do you want to receive customized digest daily | digest:daily | + +A user can choose only one of the above setting i.e., weekly or daily. + +**Relevant Pull Requests:** + +[https://github.com/publiclab/plots2/pull/2985](https://github.com/publiclab/plots2/pull/2985) +[https://github.com/publiclab/plots2/pull/3119](https://github.com/publiclab/plots2/pull/3119) \ No newline at end of file