Skip to content

Commit

Permalink
Always show subscription form for report events in the admin interface
Browse files Browse the repository at this point in the history
Admin user should be able to configure all event subscription types,
even if they are not participating in the corresponding beta program
or do not have the moderator role themself.
  • Loading branch information
krauselukas committed Dec 13, 2023
1 parent 10de50a commit 60ae0b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/api/app/models/event_subscription/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ def find_or_initialize_subscription(eventtype, receiver_role, channel)

def show_form_for_create_report_event?(event_class:, subscriber:)
if event_class.name.in?(['Event::ReportForProject', 'Event::ReportForPackage', 'Event::ReportForComment', 'Event::ReportForUser'])
# There is no subscriber for the global subscription configuration
return false if subscriber.blank?
# There is no subscriber associated to "global" event subscriptions
# which are set through the admin configuration interface.
# Admin user should be able to configure all event subscription types,
# even if they are not participating in the corresponding beta program
return true if subscriber.blank?

Check warning on line 52 in src/api/app/models/event_subscription/form.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/models/event_subscription/form.rb#L52

Added line #L52 was not covered by tests
return false unless ReportPolicy.new(subscriber, Report).notify?
end

Expand Down

0 comments on commit 60ae0b3

Please sign in to comment.