From d213173d3d99b9d689af4244fcbe6a2602422912 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 8 Dec 2018 11:24:26 -0600 Subject: [PATCH] Fix #4002: Always include "updated by" line when creator != updater --- app/views/application/_update_notice.html.erb | 7 +++++++ app/views/comments/partials/show/_comment.html.erb | 4 +--- app/views/forum_posts/_forum_post.html.erb | 4 +--- app/views/user_feedbacks/index.html.erb | 4 +--- app/views/user_name_change_requests/show.html.erb | 4 +--- 5 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 app/views/application/_update_notice.html.erb diff --git a/app/views/application/_update_notice.html.erb b/app/views/application/_update_notice.html.erb new file mode 100644 index 000000000..2f8e0a056 --- /dev/null +++ b/app/views/application/_update_notice.html.erb @@ -0,0 +1,7 @@ +<%# record, interval %> + +<% if record.respond_to?(:updater) && record.updater != record.creator %> +

Updated by <%= link_to_user record.updater %> <%= time_ago_in_words_tagged(record.updated_at) %>

+<% elsif record.updated_at - record.created_at > (local_assigns[:interval] || 5.minutes) %> +

Updated <%= time_ago_in_words_tagged(record.updated_at) %>

+<% end %> diff --git a/app/views/comments/partials/show/_comment.html.erb b/app/views/comments/partials/show/_comment.html.erb index ebf40b634..de5bf1b63 100644 --- a/app/views/comments/partials/show/_comment.html.erb +++ b/app/views/comments/partials/show/_comment.html.erb @@ -16,9 +16,7 @@
<%= format_text(comment.body) %> - <% if comment.updated_at - comment.created_at > 5.minutes %> -

Updated by <%= link_to_user comment.updater %> <%= time_ago_in_words_tagged(comment.updated_at) %>

- <% end %> + <%= render "update_notice", record: comment %>
<% if CurrentUser.is_member? %> diff --git a/app/views/forum_posts/_forum_post.html.erb b/app/views/forum_posts/_forum_post.html.erb index 4e461b7d1..caf34f263 100644 --- a/app/views/forum_posts/_forum_post.html.erb +++ b/app/views/forum_posts/_forum_post.html.erb @@ -17,9 +17,7 @@
<%= format_text(forum_post.body) %>
- <% if forum_post.updated_at - forum_post.created_at > 5.minutes %> -

Updated by <%= link_to_user forum_post.updater %> <%= time_ago_in_words_tagged(forum_post.updated_at) %>

- <% end %> + <%= render "update_notice", record: forum_post %>
  • ID: <%= forum_post.id %>
  • <% if CurrentUser.is_member? && @forum_topic %> diff --git a/app/views/user_feedbacks/index.html.erb b/app/views/user_feedbacks/index.html.erb index 171c9b0f4..4fbe9d8d0 100644 --- a/app/views/user_feedbacks/index.html.erb +++ b/app/views/user_feedbacks/index.html.erb @@ -20,9 +20,7 @@ <%= compact_time(feedback.created_at) %> <%= format_text(feedback.body) %> - <% if feedback.updated_at > feedback.created_at %> -

    Updated <%= time_ago_in_words_tagged(feedback.updated_at) %>

    - <% end %> + <%= render "update_notice", record: feedback, interval: 0.minutes %> <% if feedback.editable_by?(CurrentUser.user) %> diff --git a/app/views/user_name_change_requests/show.html.erb b/app/views/user_name_change_requests/show.html.erb index 8114a104b..217854638 100644 --- a/app/views/user_name_change_requests/show.html.erb +++ b/app/views/user_name_change_requests/show.html.erb @@ -8,9 +8,7 @@ Date <%= compact_time @change_request.created_at %> - <% if @change_request.updated_at - @change_request.created_at > 5.minutes %> - (updated <%= time_ago_in_words_tagged @change_request.updated_at %>) - <% end %> + <%= render "update_notice", record: @change_request %>