mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Fix spec for post menu (#25100)
Followup to b92993fcee
I ran out of time to get this working for that fix,
also here I am making the post.url method have parity
with post.shareUrl in JS, which omits the post number
for the first post.
This commit is contained in:
@@ -645,12 +645,12 @@ class Post < ActiveRecord::Base
|
||||
publish_change_to_clients!(:acted)
|
||||
end
|
||||
|
||||
def full_url
|
||||
"#{Discourse.base_url}#{url}"
|
||||
def full_url(opts = {})
|
||||
"#{Discourse.base_url}#{url(opts)}"
|
||||
end
|
||||
|
||||
def relative_url
|
||||
"#{Discourse.base_path}#{url}"
|
||||
def relative_url(opts = {})
|
||||
"#{Discourse.base_path}#{url(opts)}"
|
||||
end
|
||||
|
||||
def url(opts = nil)
|
||||
@@ -685,7 +685,11 @@ class Post < ActiveRecord::Base
|
||||
result = +"/t/"
|
||||
result << "#{slug}/" if !opts[:without_slug]
|
||||
|
||||
"#{result}#{topic_id}/#{post_number}"
|
||||
if post_number == 1 && opts[:share_url]
|
||||
"#{result}#{topic_id}"
|
||||
else
|
||||
"#{result}#{topic_id}/#{post_number}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.urls(post_ids)
|
||||
|
||||
Reference in New Issue
Block a user