* Move save over and add button labels
* comment notification design and functionality
* controller error handling
* add ternery operator for background class
* minor cleanup
* add proper styling toggles
* tests and mobile spec
* add for all buttons
* add article as a param
* comment is not required on article preview
* update policy spec
* add test for coverage
* add proper button titles
* use the last user comment as comment id
* add better error handling and remove multiple fetch calls in js
* copy change to threads
* update copy, fix multiple fetch calls, add observer for loading more notifications
* update spec
* add rspecs
* more test specs
* fix test specs
* subscribe button text tests
* add export
* optimistically update ui function tests
* button initialize test
* check for comment ancestry
* add feature flag block
* some cleanup
* update logic and specs
* oops
* rubocop issues
* change config names
* change config names
* fix spec
* add one more conditional
* check for comments
* service-object the toggler
* separate routes
* continual refactoring
* refine spec tests
* clean up policy
* Adjust js and view files to match be params
* some service object refactoring
* separate endpoints on client-side
* broken spec
* service specs
* policy spec fixes
* remove action param
* remove action param from spec
* minor updates
* trigger build
* update to post
* Services don't need permitted params
* Notifications continue to be a mess, decorator specs to follow
* Not toggling now
* This doesn't really belong here
* Fix tests after moving
* Streamline front-end
* There could be errors?
* polymorphic_name is a class thing
* ☠️ json_data in notification views
* Use feature_flag helper to get current_user
* Cannot derive current subscription status from notification, only from subscription
* Default is subscribe to all article comments
* Sync up matching unsubscribe, make subscribe idempotent-ish
* Temporarily comment-out button jest tests to see if I can unstick CI
* Stop trying to detect potential subscribe-to-comment
* Stop trying to detect potential subscribe-to-comment
* Minor spec refactoring
* Add specs for article notification decoration
* NotificationDecorator specs are rather long
* Rubocop likes it?
* Minor spec refactoring
* Doesn't need to stay pending
* Add spec for subscription finder
* Expand Subscribe service specs
* YAGNI, but I don't like hard-coded config
* Refactor Unsubscribe service specs
* nobody expects the infinite scroll
* This *might* work, except for feature flag
* Ancestry can be quite deep actually
* Rubocop
* Update subscribe button for subscribe-to-thread
* Jest tests are just tests
* hasAttribute != getAttribute
* Test knows **nothing** about window size
* Tests have been lying about mobileLabel this whole time
* Make payload/endpoint testable
* Is Jest actually happy???
* Still cleaning up jest/eslint
* Temporarily comment-out cypress tests pending feature flag
* Thanks, Rubocop, what would we do without you
* Preserve round-trip for 'top-level' and 'only-author' subscriptions
* Update specs
* Move save button icon
* Update test with better config param
* Try feature flag specific to cypress env
* Tell cypress to wait for (un)subscribing to work
---------
Co-authored-by: Lawrence S <lawrence@forem.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
54 lines
2.8 KiB
Text
54 lines
2.8 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">
|
|
<% params = { user: link_to(json_data["user"]["name"], json_data["user"]["path"], class: "crayons-link fw-bold"), title: link_to(h(json_data["comment"]["commentable"]["title"]), json_data["comment"]["commentable"]["path"], class: "crayons-link fw-bold") } %>
|
|
<% if notification.action.blank? %>
|
|
<% if json_data["comment"]["created_at"] %>
|
|
<header class="mb-4">
|
|
<h2 class="fs-base fw-normal">
|
|
<% if json_data["comment"]["depth"] && json_data["comment"]["depth"] > 0 %>
|
|
<%= t("views.notifications.comment.replied_html", **params) %>
|
|
<% else %>
|
|
<%= t("views.notifications.comment.commented_html", **params) %>
|
|
<% end %>
|
|
</h2>
|
|
<p class="lh-tight"><a href="<%= json_data["comment"]["path"] %>" class="crayons-link fs-s crayons-link--secondary"><%= time_ago_in_words json_data["comment"]["created_at"], scope: :"datetime.distance_in_words_ago" %></a></p>
|
|
</header>
|
|
<% end %>
|
|
|
|
<%= render "notifications/shared/comment_box", notification: notification, context: "default" %>
|
|
|
|
<% elsif notification.action == "Moderation" %>
|
|
<% new_user = mod_comment_user(json_data) %>
|
|
<header class="mb-4">
|
|
<h2 class="fs-xl"><%= t("views.notifications.comment.mod_greeting", user: @user.name) %></h2>
|
|
<p class="mb-4"><%= t("views.notifications.comment.welcome_html", user: new_user["name"]) %></p>
|
|
<p><%= t("views.notifications.comment.commented_html", user: link_to(new_user["name"], new_user["path"], class: "crayons-link fw-bold"), title: params[:title]) %></p>
|
|
</header>
|
|
|
|
<%= render "notifications/shared/comment_box", json_data: json_data, notification: notification, context: "default" %>
|
|
|
|
<div class="flex justify-between fs-s color-base-60 pt-4">
|
|
<p><%= t("views.notifications.comment.mod_opt_out") %></p>
|
|
<%= link_to t("views.notifications.comment.change_settings"), user_settings_path(:notifications) %>
|
|
</div>
|
|
|
|
<% elsif notification.action == "First" %>
|
|
<header class="mb-4">
|
|
<h2 class="fs-base fw-normal">
|
|
<%= t("views.notifications.comment.first_html", **params) %>
|
|
</h2>
|
|
<p class="lh-tight"><small class="fs-s color-base-60"><%= time_ago_in_words notification.created_at, scope: :"datetime.distance_in_words_ago" %></small></p>
|
|
|
|
<p><%= t("views.notifications.comment.first_reply") %></p>
|
|
</header>
|
|
|
|
<%= render "notifications/shared/comment_box", activity: activity, context: "moderation" %>
|
|
|
|
<% end %>
|
|
</div>
|
|
</div>
|