docbrown/app/views/notifications/_comment.html.erb
rhymes 7dd2ae9fe0 Remove notifiable access from articles and comments notifications (#5415) [deploy]
* Add created_at to comment notification data

* Remove notifiable usage from notifications partials

* Fix typo
2020-01-09 10:19:45 -05:00

56 lines
2.7 KiB
Text

<% if notification.action == "Reaction" %>
<%= render "reaction", notification: notification %>
<% else %>
<% json_data = notification.json_data %>
<% cache "activity-profile-pic-#{json_data['user']['id']}-#{json_data['user']['profile_image_90']}" do %>
<a href="<%= json_data["user"]["path"] %>" class="small-pic-link-wrapper">
<div class="small-pic">
<img src="<%= json_data["user"]["profile_image_90"] %>" alt="link to <%= json_data["user"]["username"] %>'s profile">
</div>
</a>
<% end %>
<div class="content notification-content comment-content">
<% if notification.action.blank? %>
<a href="<%= json_data["user"]["path"] %>"><%= json_data["user"]["name"] %></a>
<% if json_data["comment"]["depth"] && json_data["comment"]["depth"] > 0 %>
replied to a thread in
<% else %>
commented on
<% end %>
<a href="<%= json_data["comment"]["commentable"]["path"] %>">
<%= h(json_data["comment"]["commentable"]["title"]) %>
</a>
<% if json_data["comment"]["created_at"] %>
<div>
<small><%= time_ago_in_words json_data["comment"]["created_at"] %> ago</small>
</div>
<% end %>
<%= render "notifications/shared/comment_box", json_data: json_data, notification: notification, context: "default" %>
<% elsif notification.action == "Moderation" %>
<a href="/<%= json_data["comment"]["path"].split("/")[1] %>">@<%= json_data["comment"]["path"].split("/")[1] %></a> just left a comment. Since they are new to the community, could you leave a nice reply to help them feel welcome?
<b>Thank you!</b>
<br /><br />
<em style="font-size: 0.9em">Alternatively, if this comment violates the code of conduct, please downvote/report as appropriate.</em>
<br /><br>
<b>re:
<a href="<%= json_data["comment"]["commentable"]["path"] %>">
<%= h(json_data["comment"]["commentable"]["title"]) %>
</a></b>
<%= render "notifications/shared/comment_box", json_data: json_data, notification: notification, context: "moderation" %>
<br>
<div class="footnote">All negative reactions are 100% private.</div>
<% elsif notification.action == "First" %>
<a href="<%= json_data["user"]["path"] %>"><%= json_data["user"]["name"] %></a>
wrote their first comment on:
<a href="<%= json_data["comment"]["commentable"]["path"] %>">
<%= h(json_data["comment"]["commentable"]["title"]) %>
</a>
<div>
<small><%= time_ago_in_words notification.created_at %> ago</small>
</div>
<%= render "notifications/shared/comment_box", activity: activity, context: "moderation" %>
Give them their first reply! 🎉
<br>
<% end %>
</div>
<% end %>