docbrown/app/views/notifications/_article.html.erb
Vaidehi Joshi 8f0c24c167
Expand @-mention functionality to posts (#13367)
* 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>
2021-05-12 07:33:33 -07:00

27 lines
1.2 KiB
Text

<div class="crayons-card notification">
<% if notification.action == "Reaction" %>
<%= render "reaction", notification: notification %>
<% elsif notification.action.include? "Milestone" %>
<%= render "milestone", notification: notification %>
<% else %>
<% json_data = notification.json_data %>
<%= render "notifications/shared/profile_pic", json_data: json_data %>
<div class="notification__content">
<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>
made a new 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" %>
</div>
<% end %>
</div>