* Initial work for @-mention notifications from posts * Revert article.published changes to article updater, add clarifying comments * Extract article preview into reusable partial for notification views * Clean up Article Updater * Address + remove some FIXMEs * Add a whole buncha specs for @-mention functionality in posts YAY * Refactor create all spec to use shared examples, add clarifying comments * Add guard clause to create all service * Update new mention and notifiable action specs * Some additional cleanup * Add specs + shared examples to SendEmailNotificationWorker spec * Use aggregate_failures where applicable Co-authored-by: Michael Kohl <citizen428@dev.to> * Cleanup and address code review comments * Add MentionDecorator + relevant specs * Address comments/issues flagged by @rhymes * Optimize plucking user_ids when checking for article followers Co-authored-by: Michael Kohl <citizen428@dev.to>
30 lines
1.5 KiB
Text
30 lines
1.5 KiB
Text
<div class="crayons-card notification">
|
|
<% json_data = notification.json_data %>
|
|
<% cache "activity-profile-pic-#{json_data['user']['id']}-#{json_data['user']['profile_image_90']}" do %>
|
|
<%= render "notifications/shared/profile_pic", json_data: json_data %>
|
|
<% end %>
|
|
|
|
<div class="notification__content">
|
|
<% if notification.json_data["article"] %>
|
|
<header class="mb-4">
|
|
<h2 class="fs-base fw-normal">
|
|
<a href="<%= json_data["user"]["path"] %>" class="crayons-link fw-bold">
|
|
<%= json_data["user"]["name"] %>
|
|
</a>
|
|
mentioned you in a post
|
|
<% if json_data["organization"] %>
|
|
under <a href="<%= json_data["organization"]["path"] %>" class="crayons-link fw-bold"><%= json_data["organization"]["name"] %></a>
|
|
<% end %>
|
|
</h2>
|
|
<p class="lh-tight"><small class="fs-s color-base-60"><%= time_ago_in_words json_data["article"]["published_at"] %> ago</small></p>
|
|
</header>
|
|
|
|
<%= render "notifications/shared/article_preview", json_data: json_data, notification: notification, context: "default" %>
|
|
<% elsif notification.json_data["comment"] %>
|
|
<h2 class="fs-base fw-normal mb-4">
|
|
<a href="<%= json_data["user"]["path"] %>" class="crayons-link fw-bold"><%= json_data["user"]["name"] %></a> mentioned you in a comment
|
|
</h2>
|
|
<%= render "notifications/shared/comment_box", json_data: json_data, notification: notification, context: "default" %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|