We've moved discussions to Discord

Notifications

I noticed that the Notifications functionality which exists (sort of) in the free JumpStart template is absent from the paid product. Seeing as I'd very much like to implement notifications, any advice is appreciated.

Speaking of: is there any documentation for the Notifications mechanism in the free template? It seems a bit half-baked, and I say that with love.
Chris Oliver
There are no notifications in the free template. We have a branch that started them, but I don't think we're going to use it. It's just too simple since notifications get really complicated these days (when you're rolling up similar notifications, can un/subscribe to different notification types, etc)

We've been exploring using the activity_notification gem for Jumpstart Pro and it looks like it might work really well. Just need to finish up some testing with it before we roll it out though.
Chris Oliver
Hmmm, I don't remember this. I'm pretty sure we don't link to notifications anywhere. Looks like we maybe merged part of that branch we were experimenting with or something. I'm not sure. 
Chris Oliver
Ohhh, yeah we just ended up building a simple page and model. It's about the most basic thing you could have. I don't know that I'd use that.
Awesome. I'd love to try it out. Could you give the two-minute breakdown?
Chris Oliver
I think you simply call the following:

Notification.post(to: [list of recipients], from: user_that_took_action, action: "created", @post)

And then it'll list like the last 5 notifications in the navbar and then you also have a page with the notifications all listed out.
Screenshot from 2019-11-26 10-37-23.png 55.6 KB

Trying to parse what this all does is very confusing. And when I look at @codeByScott's PR it seems like I'm supposed to be creating folders inside of the app/views/notifications folder that in turn contain views. However, there are no examples and when I try to match up what's in the admin with the code, the head-scratching comes early. :)

I don't mean to be a pain. The solution looks genuinely interesting to me even if it won't scale. Maybe this is a dumb rabbit hole to go down but I'm compelled to understand this before it's discarded.
Chris Oliver
It's pretty simple.

Every notification has a recipient who sees the notification. An Actor who took the action that created the notification. There's an "action" which is what the Actor did to something. And the notifiable is the thing that was acted upon.

For example: Bob liked your post.

Bob is the actor.
Post model is the notifiable.
"like" is the action.
Your user account is the recipient (since the liked happened to your post)

You wouldn't create them in the admin obviously, you'd call the Notification.post I mentioned above.

Since every notification has different wording and things, we organize the views by the model name and action: https://github.com/excid3/jumpstart/blob/master/app/views/notifications/index.html.erb#L5

For example: 
# app/views/notifications/posts/like.html.erb
<%= actor.name %> liked your <%= link_to notifiable.class.to_s.downcase, notifiable %>

Would spit out "Bob liked your post" with a link around "post" to the notifiable.

I'm sure we'll be throwing this stuff out, but that's how it works.
There's the thoughtful Chris Oliver answer I was searching for! You are a mensch. Thank you for humoring me.
Tiago Casanova
We've been exploring using the activity_notification gem for Jumpstart Pro and it looks like it might work really well. Just need to finish up some testing with it before we roll it out though.

hi there! the search lead me here, sorry to barge in on the topic...

Chris Oliver I was looking to implement the same gem with the current master for a new project, however, i was a bit skeptical of how the notifications default presentation would look like coupled with the Jumpstart Pro cleaner design....anticipating some HTML/CSS tweaking for it. Any issues i should be aware of on a possible implementation, or any other advice/bump you've encountered with it?

Also, are you planning to have your notifications work on Pro.....maybe as an early Xmas gift? 🎁🎄
Chris Oliver
Since we're using Tailwind, I'm sure it'll require some custom styling. 

Plus I think they use jQuery for the Javascript and I'd like to port that to Stimulus. I'm not even sure what they're using jQuery for, but I would imagine it won't be too hard to convert.

I'd love to have this working by Christmas. I think it's doable and probably higher priority than most other features right now.
Aaron Xavier
Chris Oliver   any update on this?
Aaron Xavier +1 for this.

I posted this on GoRails the other day also.

I don't mean to pester, but it would be nice to know if a generic notifications system is being added so I don't have to undo everything I did so far if it is.
Chris Oliver
Thanks for the reminder! I haven't been satisfied with any of the gems, but I really do like Laravel's notification system. Now that I'm done with I18n, I'm going to start tackling this. Already spent a few hours on it and it's looking pretty good. 👍
Chris Oliver Thank you! Can't wait to use it in my project :)

It's not my intention to rush the development process or anything, but do you happen to know roughly when it will be ready for release?
Aaron Xavier
Neema  +1 on the thank you. 😂
Alain Pilon
+1 here too!
Chris Oliver
Alrighty! Notifications are here! Sorry for the delay, I wanted to make sure I did it "right" and that required me to think a LOT on how it should be done.

The result is github.com/excid3/noticed

Full docs are here: https://jumpstartrails.com/docs/notifications


Aaron Xavier
Chris Oliver and "right" you did.  I was checking out the codes this morning.  Needless to say, you have my respect!
Chris Oliver
Now I just gotta update this site to create notifications when you comment. 😜
Matt Bjornson
This is awesome thanks Chris Oliver ! Is this already in jumpstartrails/master?
Thank you for all your hard work  Chris Oliver ! This is a perfect addition to JSR and much needed. I already updated my project to take advantage of it :)

Now that notifications have been added, are there other features that you're looking to incorporate? Asking out of curiosity. JSR has proven to be an invaluable asset and I'm interested in the roadmap of the product.
Chris Oliver
Marketplace support is the big one I'd like to do and it seems like a pretty regular request, especially as everyone's starting to build products to help other business lately. 

We've gotta refactor the Pay gem a good bit to support it, so it's going to take some work. 😬
John Chambers
Have notifications integrated with my project now. All working beautifully! Thanks again Chris 🙏
Notifications
You’re not receiving notifications from this thread.