comments: fix incorrect comment links in mentions.
Fix mentions incorrectly linking to comments like this:
https://danbooru.donmai.us/posts/1234#comment-5678
when it should have been this
https://danbooru.donmai.us/posts/1234#comment_5678
Change comment links to this to ensure they're permanent:
https://danbooru.donmai.us/comments/5678
The comment show action will redirect from there to the post with the
comment in context.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= link_to time_ago_in_words_tagged(comment.created_at), post_path(comment.post, anchor: "comment_#{comment.id}"), class: "message-timestamp" %>
|
||||
<%= link_to time_ago_in_words_tagged(comment.created_at), comment, class: "message-timestamp" %>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
||||
@@ -21,7 +21,7 @@ class Comment < ApplicationRecord
|
||||
mentionable(
|
||||
:message_field => :body,
|
||||
:title => ->(user_name) {"#{creator.name} mentioned you in a comment on post ##{post_id}"},
|
||||
:body => ->(user_name) {"@#{creator.name} mentioned you in a \"comment\":#{Routes.post_path(post, anchor: "comment-#{id}")} on post ##{post_id}:\n\n[quote]\n#{DText.extract_mention(body, "@" + user_name)}\n[/quote]\n"}
|
||||
:body => ->(user_name) {"@#{creator.name} mentioned you in comment ##{id} on post ##{post_id}:\n\n[quote]\n#{DText.extract_mention(body, "@" + user_name)}\n[/quote]\n"}
|
||||
)
|
||||
|
||||
module SearchMethods
|
||||
|
||||
@@ -71,7 +71,7 @@ class CommentTest < ActiveSupport::TestCase
|
||||
|
||||
dmail = Dmail.last
|
||||
assert_equal(<<-EOS.strip_heredoc, dmail.body)
|
||||
@#{@comment.creator.name} mentioned you in a \"comment\":/posts/#{@comment.post_id}#comment-#{@comment.id} on post ##{@comment.post_id}:
|
||||
@#{@comment.creator.name} mentioned you in comment ##{@comment.id} on post ##{@comment.post_id}:
|
||||
|
||||
[quote]
|
||||
Hey @#{@user2.name} check this out!
|
||||
|
||||
Reference in New Issue
Block a user