Post follow and updates notifications V1 (#111)

* It is now possible to follow a post in order to receive updates about it
* Notifications are now sent when updates are published
* Post status changes are now tracked
* Update sidebar now shows the post status history
* Mark a comment as a post update using the comment form
* ... more ...
This commit is contained in:
Riccardo Graziosi
2022-05-28 11:03:36 +02:00
committed by GitHub
parent ce7be1b30c
commit dad382d2b1
59 changed files with 1080 additions and 71 deletions

View File

@@ -17,7 +17,7 @@
</div>
<div class="form-group">
<%= f.label :notifications_enabled %> <br />
<%= f.label :notifications_enabled %>&nbsp;
<%= f.check_box :notifications_enabled, style: "transform: scale(1.5)" %>
<small id="notificationsHelp" class="form-text text-muted">
if disabled, you won't receive any notification

View File

@@ -7,6 +7,7 @@
postStatuses: @post_statuses,
isLoggedIn: user_signed_in?,
isPowerUser: user_signed_in? ? current_user.power_user? : false,
userFullName: user_signed_in? ? current_user.full_name : nil,
userEmail: user_signed_in? ? current_user.email : nil,
authenticityToken: form_authenticity_token,
}

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello, <%= @user.full_name %></h1>
<p>
There is a new reply by <b><%= @comment.user.full_name %></b> on your comment from post <b><%= @comment.post.title %></b>:
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to "Click here", post_url(@comment.post) %> to have your say!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello!</h1>
<p>
The post you're following <b><%= @post.title %></b> has a new status:
<span style='background-color: <%= @post.post_status.color %>; color: white;'%>>
<%= @post.post_status.name %>
</span>
</p>
<p>
<%= link_to "Click here", post_url(@post) %> to learn more!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello!</h1>
<p>
There is a new update on the post you're following <b><%= @comment.post.title %></b>:
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to "Click here", post_url(@comment.post) %> to have your say!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>

View File

@@ -1,17 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello, <%= @user.full_name %></h1>
<p>
There is a new comment by <%= @comment.user.full_name %> on your post <b><%= @comment.post.title %></b>
There is a new comment by <b><%= @comment.user.full_name %></b> on your post <b><%= @comment.post.title %></b>:
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to "Click here", post_url(@comment.post) %> to have your say!
</p>
<p>
Have a great day!
</p>
<p> To see this comment, <%= link_to "Click here", post_url(@comment.post) %> </p>
<p>Have a great day!</p>
</body>
<footer>
Annoyed ? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>