File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,6 @@ def reports_other_user?
2020 end
2121
2222 def receiver_available?
23- ReportMailer . default_params . fetch ( :to ) . present?
23+ CodeOcean :: Config . new ( :code_ocean ) . read . dig ( :content_moderation , :report_emails ) . present?
2424 end
2525end
Original file line number Diff line number Diff line change 1515 it 'dose not allow reports when no report email is configured' do
1616 user = build_stubbed ( :external_user )
1717
18- allow ( ReportMailer ) . to receive ( :default_params ) . and_return ( ReportMailer . default_params . merge ( to : [ ] ) )
18+ codeocean_config = instance_double ( CodeOcean ::Config )
19+ allow ( CodeOcean ::Config ) . to receive ( :new ) . with ( :code_ocean ) . and_return ( codeocean_config )
20+ allow ( codeocean_config ) . to receive ( :read ) . and_return ( { } )
1921
2022 expect ( policy ) . not_to permit ( user , Comment . new )
2123 end
4547 it 'dose not allow reports when no report email is configured' do
4648 user = build_stubbed ( :external_user )
4749
48- allow ( ReportMailer ) . to receive ( :default_params ) . and_return ( ReportMailer . default_params . merge ( to : [ ] ) )
50+ codeocean_config = instance_double ( CodeOcean ::Config )
51+ allow ( CodeOcean ::Config ) . to receive ( :new ) . with ( :code_ocean ) . and_return ( codeocean_config )
52+ allow ( codeocean_config ) . to receive ( :read ) . and_return ( { } )
4953
5054 expect ( policy ) . not_to permit ( user , Comment . new )
5155 end
You can’t perform that action at this time.
0 commit comments