Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit 2fc1348

Browse files
committed
FIX: allow user to be assigned to post and topic
1 parent eae4470 commit 2fc1348

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

lib/assigner.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -554,16 +554,7 @@ def moderator_post_unassign_action_code(assignment)
554554
end
555555

556556
def already_assigned?(assign_to, type, note, status)
557-
return true if assignment_eq?(@target.assignment, assign_to, type, note, status)
558-
559-
# Check if the user is not assigned to any of the posts from the topic
560-
# they will be assigned to.
561-
if @target.is_a?(Topic)
562-
assignments = Assignment.where(topic_id: topic.id, target_type: "Post", active: true)
563-
return true if assignments.any? { |a| assignment_eq?(a, assign_to, type, note, status) }
564-
end
565-
566-
false
557+
assignment_eq?(@target.assignment, assign_to, type, note, status)
567558
end
568559

569560
def reassign?

spec/integration/assign_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def assert_publish_topic_state(topic, user: nil, group: nil)
149149

150150
include_context "with group that is allowed to assign"
151151

152-
it "does not allow to assign topic if post is already assigned" do
152+
it "allows to assign topic if post is already assigned" do
153153
add_to_assign_allowed_group(user)
154154

155155
assigner = Assigner.new(post, user)
@@ -162,8 +162,7 @@ def assert_publish_topic_state(topic, user: nil, group: nil)
162162

163163
assigner = Assigner.new(topic, user)
164164
response = assigner.assign(user)
165-
expect(response[:success]).to be false
166-
expect(response[:reason]).to eq(:already_assigned)
165+
expect(response[:success]).to be true
167166
end
168167
end
169168

0 commit comments

Comments
 (0)