UX: change text of public_topic action code in login required sites. (#14764)
The wording "made this topic public" made confusion in login required forums.
This commit is contained in:
parent
2ee9a09c8c
commit
6626089034
|
@ -432,6 +432,11 @@ class PostSerializer < BasicPostSerializer
|
|||
scope.is_staff? ? object.version : object.public_version
|
||||
end
|
||||
|
||||
def action_code
|
||||
return "open_topic" if object.action_code == "public_topic" && SiteSetting.login_required?
|
||||
object.action_code
|
||||
end
|
||||
|
||||
def include_action_code?
|
||||
object.action_code.present?
|
||||
end
|
||||
|
|
|
@ -145,6 +145,7 @@ en:
|
|||
|
||||
action_codes:
|
||||
public_topic: "made this topic public %{when}"
|
||||
open_topic: "converted this to a topic %{when}"
|
||||
private_topic: "made this topic a personal message %{when}"
|
||||
split_topic: "split this topic %{when}"
|
||||
invited_user: "invited %{who} %{when}"
|
||||
|
|
|
@ -282,6 +282,16 @@ describe PostSerializer do
|
|||
|
||||
end
|
||||
|
||||
context "post with small action" do
|
||||
fab!(:post) { Fabricate(:small_action, action_code: "public_topic") }
|
||||
|
||||
it "returns `action_code` based on `login_required` site setting" do
|
||||
expect(serialized_post_for_user(nil)[:action_code]).to eq("public_topic")
|
||||
SiteSetting.login_required = true
|
||||
expect(serialized_post_for_user(nil)[:action_code]).to eq("open_topic")
|
||||
end
|
||||
end
|
||||
|
||||
def serialized_post(u)
|
||||
s = PostSerializer.new(post, scope: Guardian.new(u), root: false)
|
||||
s.add_raw = true
|
||||
|
|
Loading…
Reference in New Issue