Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6526 Don't reveal if user is banned or suspended when inviting as co-creator #4563

Merged
merged 7 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/models/creatorship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def check_invalid
# disabled invitations.
def check_disallowed
return if approved? || pseud.nil?
# Prevents this error from appearing in addition to the errorfor banned or suspended users.
JonathanS223 marked this conversation as resolved.
Show resolved Hide resolved
return if pseud&.user&.banned || pseud&.user&.suspended
return if pseud&.user&.preference&.allow_cocreator

errors.add(:base, ts("%{name} does not allow others to invite them to be a co-creator.",
name: pseud.byline))
end
Expand All @@ -55,7 +56,7 @@ def check_disallowed
def check_banned
return unless pseud&.user&.banned || pseud&.user&.suspended

errors.add(:base, ts("%{name} is currently banned and cannot be listed as a co-creator.",
errors.add(:base, ts("%{name} cannot be listed as a co-creator.",
name: pseud.byline))
end

Expand Down
1 change: 0 additions & 1 deletion app/models/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def new_recipients_allow_gifts
next if gift.pseud&.user&.preference&.allow_gifts?
next if self.challenge_assignments.map(&:requesting_pseud).include?(gift.pseud)
next if self.challenge_claims.reject { |c| c.request_prompt.anonymous? }.map(&:requesting_pseud).include?(gift.pseud)

self.errors.add(:base, ts("#{gift.pseud.byline} does not accept gifts."))
end
end
Expand Down
2 changes: 1 addition & 1 deletion features/works/work_create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Feature: Create Works
When I fill in "work_collection_names" with ""
And I fill in "pseud_byline" with "badcoauthor"
And I press "Preview"
Then I should see "badcoauthor is currently banned"
Then I should see "badcoauthor cannot be listed as a co-creator"
When I fill in "pseud_byline" with "coauthor"
And I fill in "Additional Tags" with "this is a very long tag more than one hundred characters in length how would this normally even be created"
And I press "Preview"
Expand Down