Delete a comment's title if it is deleted (#3249)
* Remove cursor pointer for notification cards * Delete the comment title if deleted * Update title to use comment's title
This commit is contained in:
parent
8ec4e338ed
commit
4ca7197696
5 changed files with 12 additions and 2 deletions
|
|
@ -348,6 +348,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.single-notification {
|
||||
cursor: default;
|
||||
}
|
||||
.unseen {
|
||||
@include themeable(
|
||||
background,
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ class Comment < ApplicationRecord
|
|||
end
|
||||
|
||||
def title
|
||||
return "[deleted]" if deleted
|
||||
|
||||
ActionController::Base.helpers.truncate(ActionController::Base.helpers.strip_tags(processed_html), length: 80)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<% if @root_comment.present? %>
|
||||
<% title truncate(strip_tags(@root_comment.processed_html), length: 100) + " — DEV" %>
|
||||
<% title @root_comment.title + " — DEV" %>
|
||||
<% else %>
|
||||
<% title "Discussion of " + @commentable.title + " — DEV" %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<% @notifications.each do |notification| %>
|
||||
<% next if notification.notified_at < 24.hours.ago && notification.aggregated? %>
|
||||
<% notification_count += 1 %>
|
||||
<div class="single-article single-article-small-pic <%= "unseen" unless notification.read? %>" data-notification-id="<%= notification.id %>">
|
||||
<div class="single-article single-article-small-pic single-notification <%= "unseen" unless notification.read? %>" data-notification-id="<%= notification.id %>">
|
||||
<%= render notification.notifiable_type.downcase.to_s, notification: notification %>
|
||||
</div>
|
||||
<% rescue => e %>
|
||||
|
|
|
|||
|
|
@ -174,6 +174,11 @@ RSpec.describe Comment, type: :model do
|
|||
text = comment.title.gsub("...", "").delete("\n")
|
||||
expect(comment.processed_html).to include CGI.unescapeHTML(text)
|
||||
end
|
||||
|
||||
it "is converted to deleted if the comment is deleted" do
|
||||
comment.update_column(:deleted, true)
|
||||
expect(comment.title).to eq "[deleted]"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#custom_css" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue