DEV: Remove dreprecated review queue code (#47)

This commit is contained in:
Roman Rizzi 2019-09-11 09:51:23 -03:00 committed by GitHub
parent 927fdca0a0
commit dc6041abcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1 additions and 96 deletions

View File

@ -1,20 +0,0 @@
{{#unless canAct}}
{{#if actableFilter}}
{{#if flaggedPost.topic.assigned_to_user}}
<div class='cant-act-flagged-post'>
<div class='cant-act-message'>
{{i18n "discourse_assign.cant_act"}}
</div>
<div class='assigned-to'>
{{assigned-to user=flaggedPost.topic.assigned_to_user}}
</div>
</div>
{{else}}
<div class='cant-act-flagged-post'>
<div class='cant-act-message'>
{{i18n "discourse_assign.cant_act_unclaimed"}}
</div>
</div>
{{/if}}
{{/if}}
{{/unless}}

View File

@ -1 +0,0 @@
{{claim-topic topic=flaggedPost.topic}}

View File

@ -1,5 +0,0 @@
export default {
shouldRender(args) {
return args.actableFilter && !args.topic;
}
};

View File

@ -1,4 +0,0 @@
<div class='assign-controls'>
{{flagged-topic-listener topic=topic}}
{{claim-topic topic=topic}}
</div>

View File

@ -1 +0,0 @@
<th class='topic-assigned-to'>{{i18n "discourse_assign.assigned"}}</th>

View File

@ -1,3 +0,0 @@
<td>
{{claim-topic topic=topic}}
</td>

View File

@ -1 +0,0 @@
{{flagged-topic-listener flaggedTopics=flaggedTopics}}

View File

@ -4,9 +4,6 @@ import { iconNode } from "discourse-common/lib/icon-library";
import { h } from "virtual-dom";
import { iconHTML } from "discourse-common/lib/icon-library";
import { queryRegistry } from "discourse/widgets/widget";
// TODO: This has to be removed when 2.3 becomes the new stable version.
import { ListItemDefaults } from "discourse/components/topic-list-item";
import { getOwner } from "discourse-common/lib/get-owner";
function registerTopicFooterButtons(api) {
@ -140,10 +137,7 @@ function initialize(api) {
"user-plus"
)}${assignedTo}</a>`;
if (
ListItemDefaults === undefined &&
topic.archetype === "private_message"
) {
if (topic.archetype === "private_message") {
assignLabels += `<div>${iconHTML("envelope")} Message</div>`;
}

View File

@ -9,9 +9,7 @@ en:
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_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"
assign_mailer_enabled: "When enabled, the assigned user will receive a notification email on each assignment"
flags_require_assign: "When enabled, flags cannot be handled unless assigned to a user."
remind_assigns: "Remind users about pending assigns."
remind_assigns_frequency: "Frequency for reminding users about assigned topics."
max_assigned_topics: "Maximum number of topics that can be assigned to a user."

View File

@ -12,12 +12,6 @@ plugins:
assigns_user_url_path:
client: true
default: "/latest?assigned={username}"
assign_locks_flags:
default: true
client: true
flags_require_assign:
default: false
client: true
assign_mailer_enabled: false
remind_assigns_frequency:
client: true

View File

@ -46,14 +46,6 @@ after_initialize do
self.value = self.value.to_i if self.name == frequency_field
end
=begin
TODO: Remove this once 2.3 becomes the new stable.
Also remove:
- flagged-* connectors
- flagged queue code inside the JS initializer
=end
reviewable_api_enabled = defined?(Reviewable)
# TODO: Remove this once 2.4 becomes the new stable.
attribute = above_min_version ? 'id' : 'name'
@ -96,32 +88,6 @@ after_initialize do
SiteSetting.assign_allowed_on_groups = new_setting
end
# Raise an invalid access error if a user tries to act on something
# not assigned to them
DiscourseEvent.on(:before_staff_flag_action) do |args|
if !reviewable_api_enabled && SiteSetting.assign_locks_flags?
if custom_fields = args[:post].topic&.custom_fields
if assigned_to_id = custom_fields[TopicAssigner::ASSIGNED_TO_ID]
unless assigned_to_id.to_i == args[:user].id
raise Discourse::InvalidAccess.new(
"That flag has been assigned to another user",
nil,
custom_message: 'discourse_assign.flag_assigned'
)
end
elsif SiteSetting.flags_require_assign?
raise Discourse::InvalidAccess.new(
"Flags must be assigned before they can be acted on",
nil,
custom_message: 'discourse_assign.flag_unclaimed'
)
end
end
end
end
DiscourseEvent.on(:assign_topic) do |topic, user, assigning_user, force|
if force || !topic.custom_fields[TopicAssigner::ASSIGNED_TO_ID]
TopicAssigner.new(topic, assigning_user).assign(user)
@ -315,18 +281,6 @@ after_initialize do
end
end
# Unassign if there are no more flags in the topic
on(:flag_reviewed) do |post|
if !reviewable_api_enabled &&
SiteSetting.assign_locks_flags? &&
post.topic &&
FlagQuery.flagged_post_actions(topic_id: post.topic_id, filter: "old").count > 0 &&
FlagQuery.flagged_post_actions(topic_id: post.topic_id).count == 0
::TopicAssigner.new(post.topic, Discourse.system_user).unassign
end
end
add_class_method(:topic_tracking_state, :publish_assigned_private_message) do |topic, user_id|
return unless topic.private_message?