Add new SiteSetting to disable locking of flags when assigned
This commit is contained in:
parent
a69bd40401
commit
246de40653
|
@ -12,7 +12,7 @@ function initialize(api) {
|
||||||
api.modifyClass('component:flagged-post', {
|
api.modifyClass('component:flagged-post', {
|
||||||
@computed('flaggedPost.topic.assigned_to_user_id', 'filter')
|
@computed('flaggedPost.topic.assigned_to_user_id', 'filter')
|
||||||
canAct(assignedToUserId, filter) {
|
canAct(assignedToUserId, filter) {
|
||||||
if (assignedToUserId && this.currentUser.id !== assignedToUserId) {
|
if (this.siteSettings.assign_locks_flags && assignedToUserId && this.currentUser.id !== assignedToUserId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ en:
|
||||||
assign_other_regex: "Regex that needs to pass for assigning topics to others via mention. Example 'your list'."
|
assign_other_regex: "Regex that needs to pass for assigning topics to others via mention. Example 'your list'."
|
||||||
unassign_on_group_archive: "When a message is archived by a group, unassign message (reassign if moved back to inbox)"
|
unassign_on_group_archive: "When a message is archived by a group, unassign message (reassign if moved back to inbox)"
|
||||||
unassign_on_close: "When a topic is closed unassign topic"
|
unassign_on_close: "When a topic is closed unassign topic"
|
||||||
|
assign_locks_flags: "When a topic is assigned to a staff member, its flags can only be handled by that person"
|
||||||
discourse_assign:
|
discourse_assign:
|
||||||
assigned_to: "Topic assigned to @%{username}"
|
assigned_to: "Topic assigned to @%{username}"
|
||||||
unassigned: "Topic was unassigned"
|
unassigned: "Topic was unassigned"
|
||||||
|
|
|
@ -12,3 +12,6 @@ plugins:
|
||||||
assigns_user_url_path:
|
assigns_user_url_path:
|
||||||
client: true
|
client: true
|
||||||
default: "/latest?assigned={username}"
|
default: "/latest?assigned={username}"
|
||||||
|
assign_locks_flags:
|
||||||
|
default: true
|
||||||
|
client: true
|
||||||
|
|
|
@ -20,6 +20,7 @@ after_initialize do
|
||||||
# Raise an invalid access error if a user tries to act on something
|
# Raise an invalid access error if a user tries to act on something
|
||||||
# not assigned to them
|
# not assigned to them
|
||||||
DiscourseEvent.on(:before_staff_flag_action) do |args|
|
DiscourseEvent.on(:before_staff_flag_action) do |args|
|
||||||
|
if SiteSetting.assign_locks_flags?
|
||||||
if custom_fields = args[:post].topic.custom_fields
|
if custom_fields = args[:post].topic.custom_fields
|
||||||
if assigned_to_id = custom_fields['assigned_to_id']
|
if assigned_to_id = custom_fields['assigned_to_id']
|
||||||
unless assigned_to_id.to_i == args[:user].id
|
unless assigned_to_id.to_i == args[:user].id
|
||||||
|
@ -32,6 +33,7 @@ after_initialize do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
TopicList.preloaded_custom_fields << "assigned_to_id"
|
TopicList.preloaded_custom_fields << "assigned_to_id"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue