Sending notifcations when mentioned
Maybe this part of the documentation can help:
- https://jumpstartrails.com/docs/notifications
What I'm thinking is that maybe everyone mentioned in the comment can also have this method ran on their user.
- https://jumpstartrails.com/docs/notifications
What I'm thinking is that maybe everyone mentioned in the comment can also have this method ran on their user.
NewComment.with(comment: @comment).deliver_later(@comment.post.owner)
Also,
- https://jumpstartrails.com/discussions/175 (before last comment)
and here is a related thread:
- https://jumpstartrails.com/discussions/224
You'll have to loop through the ActionText content attachments and filter only the
Here's an example with a
User
attachments. Here's an example with a
Post
model that has_rich_text :body
on it to find all the User's mentioned.Post.last.body.body.attachments.select{ |a| a.attachable.class == User }
Then you can use that array of users to notify them.
I'll probably build a concern so you can add this functionality easily to your models that use ActionText.
Maybe something like this?
Maybe something like this?
include Jumpstart::Mentions has_mentions :user, rich_text: :body, class: User # defines a method called "user_mentions" that searches the "body" rich text for User attachments. def notify user_mentions #=> [<User>, <User>] end
Just added
https://gitlab.com/gorails/jumpstart-pro/-/blob/master/lib/jumpstart/lib/jumpstart/mentions.rb
Jumpstart::Mentions
as a concern so you can include it in your own models. I'll add docs for it soon, but it's all defined in the repo. https://gitlab.com/gorails/jumpstart-pro/-/blob/master/lib/jumpstart/lib/jumpstart/mentions.rb
Made a pull request to fix that: https://github.com/jumpstart-pro/jumpstart-pro/pull/114
Notifications
You’re not receiving notifications from this thread.