FEATURE: small post action with link to post (#232)
When a post is assigned/unassigned, we want small action to have a link to the specific post.
This commit is contained in:
parent
a876821ab1
commit
22025b35b8
|
@ -7,12 +7,12 @@ en:
|
||||||
action_codes:
|
action_codes:
|
||||||
assigned: "assigned %{who} %{when}"
|
assigned: "assigned %{who} %{when}"
|
||||||
assigned_group: "assigned %{who} %{when}"
|
assigned_group: "assigned %{who} %{when}"
|
||||||
assigned_to_post: "assigned %{who} to post %{when}"
|
assigned_to_post: "assigned %{who} to <a href='%{href}' data-auto-route='true'>post</a> %{when}"
|
||||||
assigned_group_to_post: "assigned %{who} to post %{when}"
|
assigned_group_to_post: "assigned %{who} to <a href='%{href}' data-auto-route='true'>post</a> %{when}"
|
||||||
unassigned: "unassigned %{who} %{when}"
|
unassigned: "unassigned %{who} %{when}"
|
||||||
unassigned_group: "unassigned %{who} %{when}"
|
unassigned_group: "unassigned %{who} %{when}"
|
||||||
unassigned_from_post: "unassigned %{who} from post %{when}"
|
unassigned_from_post: "unassigned %{who} from <a href='%{href}' data-auto-route='true'>post</a> %{when}"
|
||||||
unassigned_group_from_post: "unassigned %{who} from post %{when}"
|
unassigned_group_from_post: "unassigned %{who} from <a href='%{href}' data-auto-route='true'>post</a> %{when}"
|
||||||
discourse_assign:
|
discourse_assign:
|
||||||
add_unassigned_filter: "Add 'unassigned' filter to category"
|
add_unassigned_filter: "Add 'unassigned' filter to category"
|
||||||
cant_act: "You cannot act on flags that have been assigned to other users"
|
cant_act: "You cannot act on flags that have been assigned to other users"
|
||||||
|
|
|
@ -250,13 +250,19 @@ class ::Assigner
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if !silent
|
if !silent
|
||||||
|
custom_fields = { "action_code_who" => assign_to.is_a?(User) ? assign_to.username : assign_to.name }
|
||||||
|
|
||||||
|
if post_target?
|
||||||
|
custom_fields.merge!("action_code_href" => "/p/#{@target.id}")
|
||||||
|
end
|
||||||
|
|
||||||
topic.add_moderator_post(
|
topic.add_moderator_post(
|
||||||
@assigned_by,
|
@assigned_by,
|
||||||
nil,
|
nil,
|
||||||
bump: false,
|
bump: false,
|
||||||
post_type: SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper],
|
post_type: SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper],
|
||||||
action_code: moderator_post_assign_action_code(assignment),
|
action_code: moderator_post_assign_action_code(assignment),
|
||||||
custom_fields: { "action_code_who" => assign_to.is_a?(User) ? assign_to.username : assign_to.name }
|
custom_fields: custom_fields
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -323,11 +329,18 @@ class ::Assigner
|
||||||
|
|
||||||
if SiteSetting.unassign_creates_tracking_post && !silent
|
if SiteSetting.unassign_creates_tracking_post && !silent
|
||||||
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
|
post_type = SiteSetting.assigns_public ? Post.types[:small_action] : Post.types[:whisper]
|
||||||
|
|
||||||
|
custom_fields = { "action_code_who" => assigned_to.is_a?(User) ? assigned_to.username : assigned_to.name }
|
||||||
|
|
||||||
|
if post_target?
|
||||||
|
custom_fields.merge!("action_code_href" => "/p/#{@target.id}")
|
||||||
|
end
|
||||||
|
|
||||||
topic.add_moderator_post(
|
topic.add_moderator_post(
|
||||||
@assigned_by, nil,
|
@assigned_by, nil,
|
||||||
bump: false,
|
bump: false,
|
||||||
post_type: post_type,
|
post_type: post_type,
|
||||||
custom_fields: { "action_code_who" => assigned_to.is_a?(User) ? assigned_to.username : assigned_to.name },
|
custom_fields: custom_fields,
|
||||||
action_code: moderator_post_unassign_action_code(assignment),
|
action_code: moderator_post_unassign_action_code(assignment),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue