This repository has been archived by the owner on Feb 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
send emails to users that are mentioned in bucket comments #195
Open
jlopker
wants to merge
12
commits into
master
Choose a base branch
from
feature/at-mention
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d398c8e
send emails to users that are mentioned in bucket comments
jlopker 6e6d157
email text updates
jlopker 26d44b2
copy change, and deliver_now changed to deliver_later
jlopker 6d1df21
change url to use action mailer config
jlopker de691e6
change to deliver_later
jlopker a87bd8b
make email body text html_safe
jlopker 3005099
Merge branch 'master' into feature/at-mention
jlopker a19e93f
deliver_now -> deliver_later
jlopker 33dc9a6
backend comments recieve only markdown now
jlopker 81f5bb6
change to deliver_later
jlopker 60c5353
remove reverse_markdown as it's not in use
jlopker 33a2d51
Fixed HTML rendering problem
chime-mu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,4 +113,14 @@ def check_transactions_email | |
from: "Cobudget Updates <[email protected]>", | ||
subject: "DB transactions consistency check") | ||
end | ||
|
||
def notify_member_that_they_were_mentioned(author:, member:, bucket:, body:) | ||
@bucket = bucket | ||
@group = bucket.group | ||
@body = body | ||
@author = author | ||
mail(to: member.email, | ||
from: "Cobudget Updates <[email protected]>", | ||
subject: "#{@author.name} mentioned you in the bucket #{@bucket.name}") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/views/user_mailer/notify_member_that_they_were_mentioned.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<p> | ||
<%= @author.name %> mentioned you in the bucket <%= link_to "#{@bucket.name}", "#{root_url}#/buckets/#{@bucket.id}" %> in <%= @group.name %>. | ||
</p> | ||
|
||
<p> | ||
<%= render html: @body.html_safe %> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't put the code that converts from markdown to HTML in the controller, but rather in the
user_mailer
code that generates the mail.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chime-mu It's not always the case that the
user_mailer
would get called though. If no one is mentioned in the comment then no mails would get sent. Because of this, I'm not sure that it makes sense to me to put this code in theuser_mailer
. Does that make sense? Or is there something I'm not seeing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you convert to HTML if no mail should be sent?