diff --git a/src/api/app/assets/javascripts/webui/report.js b/src/api/app/assets/javascripts/webui/report.js
index 8704da90944..a5157821f83 100644
--- a/src/api/app/assets/javascripts/webui/report.js
+++ b/src/api/app/assets/javascripts/webui/report.js
@@ -40,6 +40,28 @@ function hideReportButton(element) {
$(element).addClass('d-none');
}
+/* exported showYouReportedMessage */
+function showYouReportedMessage(reportLinkId, reportableType, reportableId, message) {
+ switch(reportableType) {
+ case 'Comment':
+ // Comments differ depending on where they are, so this is why we have two ways. If an element isn't found, nothing will happen...
+ // For comments on a project/package - In the comment, insert the 'You reported the comment' message after 'User X wrote (...)'
+ $('#comment-' + reportableId + '-user').after(message);
+ // For comments on a request - In the comment, insert the 'You reported the comment' message before the comment body
+ $('#comment-' + reportableId + '-body').prepend(message);
+ break;
+ case 'Project':
+ case 'Package':
+ // The 'You reported the project/package' is displayed in the side links of the project/package
+ $('ul.side_links').append(message);
+ break;
+ case 'User':
+ // The 'You reported the user' message is displayed after the (now) hidden 'Report' link
+ $(reportLinkId).after(message);
+ break;
+ }
+}
+
$(document).ready(function(){
$('#report-category').on('change', '.form-check-input', function(e) {
$('#report-reason textarea').attr('required', (e.target.value !== 'other' ? null : true));
diff --git a/src/api/app/components/bs_request_comment_component.html.haml b/src/api/app/components/bs_request_comment_component.html.haml
index 88462eb1b6e..cd4efd2e6c1 100644
--- a/src/api/app/components/bs_request_comment_component.html.haml
+++ b/src/api/app/components/bs_request_comment_component.html.haml
@@ -38,7 +38,7 @@
= link_to request_changes_path(number: action.bs_request, request_action_id: action, anchor: comment.diff_ref) do
= render(DiffSubjectComponent.new(state: diff['state'], old_filename: diff.dig('old', 'name'), new_filename: diff.dig('new', 'name')))
= render(DiffComponent.new(diff: diff.dig('diff', '_content'), range:))
- .comment-bubble-content
+ .comment-bubble-content{ id: "comment-#{comment.id}-body" }
= render ReportsNoticeComponent.new(reportable: comment, user: User.session)
= helpers.render_as_markdown(comment)
diff --git a/src/api/app/controllers/webui/reports_controller.rb b/src/api/app/controllers/webui/reports_controller.rb
index 12b2dfa3d66..4814e32e265 100644
--- a/src/api/app/controllers/webui/reports_controller.rb
+++ b/src/api/app/controllers/webui/reports_controller.rb
@@ -3,16 +3,16 @@ class Webui::ReportsController < Webui::WebuiController
after_action :verify_authorized
def create
- user = User.session!
- report = user.submitted_reports.new(report_params)
- authorize report
+ @user = User.session!
+ @report = @user.submitted_reports.new(report_params)
+ authorize @report
@link_id = params[:link_id]
- if report.save
- flash[:success] = "#{report.reportable_type} reported successfully"
+ if @report.save
+ flash[:success] = "#{@report.reportable_type} reported successfully"
else
- flash[:error] = report.errors.full_messages.to_sentence
+ flash[:error] = @report.errors.full_messages.to_sentence
end
respond_to do |format|
diff --git a/src/api/app/views/webui/comment/_content.html.haml b/src/api/app/views/webui/comment/_content.html.haml
index 80dd88c0fd4..4fe04fcd547 100644
--- a/src/api/app/views/webui/comment/_content.html.haml
+++ b/src/api/app/views/webui/comment/_content.html.haml
@@ -3,7 +3,7 @@
.flex-shrink-0
= image_tag_for(comment.user, size: 35, custom_class: 'me-3 d-none d-sm-block')
.comment.flex-grow-1.text-break
- .mb-3
+ .mb-3{ id: "comment-#{comment.id}-user" }
= link_to(comment.user, user_path(comment.user))
wrote
= link_to("#comment-#{comment.id}", title: I18n.l(comment.created_at.utc), name: "comment-#{comment.id}") do
diff --git a/src/api/app/views/webui/package/_side_links.html.haml b/src/api/app/views/webui/package/_side_links.html.haml
index e1e3ac6829f..eb6bbeb44fe 100644
--- a/src/api/app/views/webui/package/_side_links.html.haml
+++ b/src/api/app/views/webui/package/_side_links.html.haml
@@ -1,4 +1,4 @@
-%ul.list-unstyled
+%ul.side_links.list-unstyled
- if failures.positive?
= render partial: 'webui/package/side_links/show_failures', locals: { failures: failures, package_name: package.name, project: project }
diff --git a/src/api/app/views/webui/project/_side_links.html.haml b/src/api/app/views/webui/project/_side_links.html.haml
index ea9a430b5eb..0d22bfc0ab4 100644
--- a/src/api/app/views/webui/project/_side_links.html.haml
+++ b/src/api/app/views/webui/project/_side_links.html.haml
@@ -1,4 +1,4 @@
-%ul.list-unstyled
+%ul.side_links.list-unstyled
- if project.is_maintenance?
= render partial: 'webui/project/side_links/maintenance_project', locals: { open_maintenance_incidents: open_maintenance_incidents,
project: project,
diff --git a/src/api/app/views/webui/reports/create.js.erb b/src/api/app/views/webui/reports/create.js.erb
index 2bdd8945541..4e1f3ddcfbb 100644
--- a/src/api/app/views/webui/reports/create.js.erb
+++ b/src/api/app/views/webui/reports/create.js.erb
@@ -2,4 +2,7 @@ $('#report-modal').modal('hide');
$('#flash').html("<%= escape_javascript(render(partial: 'layouts/webui/flash'))%>")
hideReportButton("#<%= @link_id %>");
+showYouReportedMessage("#<%= @link_id %>", "<%= @report.reportable_type %>",
+ "<%= @report.reportable_id %>",
+ "<%= escape_javascript(render ReportsNoticeComponent.new(reportable: @report.reportable, user: @user)) %>");
collectReportModalsAndSetValues();
diff --git a/src/api/spec/cassettes/Reports/after_reporting_a_comment_on_a_package/displays_the_You_reported_this_comment_message_instantly.yml b/src/api/spec/cassettes/Reports/after_reporting_a_comment_on_a_package/displays_the_You_reported_this_comment_message_instantly.yml
new file mode 100644
index 00000000000..645bb77c636
--- /dev/null
+++ b/src/api/spec/cassettes/Reports/after_reporting_a_comment_on_a_package/displays_the_You_reported_this_comment_message_instantly.yml
@@ -0,0 +1,281 @@
+---
+http_interactions:
+- request:
+ method: put
+ uri: http://backend:5352/source/some_random_project/_meta?user=user_4
+ body:
+ encoding: UTF-8
+ string: |
+
+ The Waste Land
+
+
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '110'
+ body:
+ encoding: UTF-8
+ string: |
+
+ The Waste Land
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:52 GMT
+- request:
+ method: put
+ uri: http://backend:5352/source/some_random_project/some_random_package/_meta?user=user_5
+ body:
+ encoding: UTF-8
+ string: |
+
+ Stranger in a Strange Land
+ Quidem aut beatae distinctio.
+
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '181'
+ body:
+ encoding: UTF-8
+ string: |
+
+ Stranger in a Strange Land
+ Quidem aut beatae distinctio.
+
+ recorded_at: Fri, 01 Dec 2023 13:00:52 GMT
+- request:
+ method: get
+ uri: http://backend:5352/source/some_random_project/some_random_package
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 644437c2-ed1f-4084-b5b7-87c863e14ff5
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '94'
+ body:
+ encoding: UTF-8
+ string: |
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:53 GMT
+- request:
+ method: get
+ uri: http://backend:5352/source/some_random_project/some_random_package?expand=1
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '94'
+ body:
+ encoding: UTF-8
+ string: |
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:53 GMT
+- request:
+ method: get
+ uri: http://backend:5352/source/some_random_project/some_random_package/_history?deleted=0&meta=0
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 644437c2-ed1f-4084-b5b7-87c863e14ff5
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '31'
+ body:
+ encoding: UTF-8
+ string: |
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:53 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?lastbuild=1&locallink=1&multibuild=1&package=some_random_package&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - de0839a3-8939-4a4e-86d7-553f37c820dd
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:54 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?lastbuild=1&locallink=1&multibuild=1&package=some_random_package&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 841a9b7f-1fda-4545-b09d-439323ce55c5
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:54 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?package=some_random_package&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 0fac4534-a31c-4594-9a92-f0998b79b1d8
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:54 GMT
+recorded_with: VCR 6.2.0
diff --git a/src/api/spec/cassettes/Reports/after_reporting_a_comment_on_a_project/displays_the_You_reported_this_comment_message_instantly.yml b/src/api/spec/cassettes/Reports/after_reporting_a_comment_on_a_project/displays_the_You_reported_this_comment_message_instantly.yml
new file mode 100644
index 00000000000..040c2b9a069
--- /dev/null
+++ b/src/api/spec/cassettes/Reports/after_reporting_a_comment_on_a_project/displays_the_You_reported_this_comment_message_instantly.yml
@@ -0,0 +1,109 @@
+---
+http_interactions:
+- request:
+ method: put
+ uri: http://backend:5352/source/some_random_project/_meta?user=user_1
+ body:
+ encoding: UTF-8
+ string: |
+
+ Gone with the Wind
+
+
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '114'
+ body:
+ encoding: UTF-8
+ string: |
+
+ Gone with the Wind
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:41 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?code=unresolvable&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 148d6d63-dd8f-468c-81a3-0efce9425965
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:46 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?view=summary
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 3d5206ce-64ea-457b-9f19-6044d9fe0e4e
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:47 GMT
+recorded_with: VCR 6.2.0
diff --git a/src/api/spec/cassettes/Reports/after_reporting_a_package/displays_the_You_reported_this_package_message_instantly.yml b/src/api/spec/cassettes/Reports/after_reporting_a_package/displays_the_You_reported_this_package_message_instantly.yml
new file mode 100644
index 00000000000..59ca01ff502
--- /dev/null
+++ b/src/api/spec/cassettes/Reports/after_reporting_a_package/displays_the_You_reported_this_package_message_instantly.yml
@@ -0,0 +1,281 @@
+---
+http_interactions:
+- request:
+ method: put
+ uri: http://backend:5352/source/some_random_project/_meta?user=jane_doe
+ body:
+ encoding: UTF-8
+ string: |
+
+ The Monkey's Raincoat
+
+
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '117'
+ body:
+ encoding: UTF-8
+ string: |
+
+ The Monkey's Raincoat
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:55 GMT
+- request:
+ method: put
+ uri: http://backend:5352/source/some_random_project/some_random_package/_meta?user=jane_doe
+ body:
+ encoding: UTF-8
+ string: |
+
+ Those Barren Leaves, Thrones, Dominations
+ Explicabo consequatur vel commodi.
+
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '201'
+ body:
+ encoding: UTF-8
+ string: |
+
+ Those Barren Leaves, Thrones, Dominations
+ Explicabo consequatur vel commodi.
+
+ recorded_at: Fri, 01 Dec 2023 13:00:55 GMT
+- request:
+ method: get
+ uri: http://backend:5352/source/some_random_project/some_random_package
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - aec58d15-e647-498a-9250-89d74f3ab540
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '94'
+ body:
+ encoding: UTF-8
+ string: |
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:55 GMT
+- request:
+ method: get
+ uri: http://backend:5352/source/some_random_project/some_random_package?expand=1
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '94'
+ body:
+ encoding: UTF-8
+ string: |
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:55 GMT
+- request:
+ method: get
+ uri: http://backend:5352/source/some_random_project/some_random_package/_history?deleted=0&meta=0
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - aec58d15-e647-498a-9250-89d74f3ab540
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '31'
+ body:
+ encoding: UTF-8
+ string: |
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:55 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?lastbuild=1&locallink=1&multibuild=1&package=some_random_package&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - d52c0510-080b-4e6f-87d5-011896743dab
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:56 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?lastbuild=1&locallink=1&multibuild=1&package=some_random_package&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 32749889-bd33-44b7-b5a6-66637b2a1ef3
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:56 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?package=some_random_package&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - f6e9e7ed-d09c-4c2b-b3c3-cd56b1f8c97b
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:56 GMT
+recorded_with: VCR 6.2.0
diff --git a/src/api/spec/cassettes/Reports/after_reporting_a_project/displays_the_You_reported_this_project_message_instantly.yml b/src/api/spec/cassettes/Reports/after_reporting_a_project/displays_the_You_reported_this_project_message_instantly.yml
new file mode 100644
index 00000000000..9198226614a
--- /dev/null
+++ b/src/api/spec/cassettes/Reports/after_reporting_a_project/displays_the_You_reported_this_project_message_instantly.yml
@@ -0,0 +1,109 @@
+---
+http_interactions:
+- request:
+ method: put
+ uri: http://backend:5352/source/some_random_project/_meta?user=jane_doe
+ body:
+ encoding: UTF-8
+ string: |
+
+ Mr Standfast
+
+
+ headers:
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '108'
+ body:
+ encoding: UTF-8
+ string: |
+
+ Mr Standfast
+
+
+ recorded_at: Fri, 01 Dec 2023 13:00:51 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?code=unresolvable&view=status
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - fb80c6a9-0062-459b-98d1-985dba5c347a
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:51 GMT
+- request:
+ method: get
+ uri: http://backend:5352/build/some_random_project/_result?view=summary
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ X-Request-Id:
+ - 1109d581-cc5a-4a8c-b12a-d8ff75804944
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Content-Type:
+ - text/xml
+ Cache-Control:
+ - no-cache
+ Connection:
+ - close
+ Content-Length:
+ - '55'
+ body:
+ encoding: UTF-8
+ string: '
+
+'
+ recorded_at: Fri, 01 Dec 2023 13:00:51 GMT
+recorded_with: VCR 6.2.0
diff --git a/src/api/spec/features/beta/webui/reports_spec.rb b/src/api/spec/features/beta/webui/reports_spec.rb
new file mode 100644
index 00000000000..0df9987c4cd
--- /dev/null
+++ b/src/api/spec/features/beta/webui/reports_spec.rb
@@ -0,0 +1,109 @@
+require 'browser_helper'
+
+RSpec.describe 'Reports', :js, :vcr do
+ before do
+ Flipper.enable(:content_moderation)
+ end
+
+ describe 'after reporting a comment on a project' do
+ let(:user) { create(:confirmed_user, login: 'jane_doe') }
+ let(:project) { create(:project, name: 'some_random_project') }
+ let!(:comment) { create(:comment, commentable: project) }
+
+ before do
+ login user
+ visit project_show_path(project)
+ end
+
+ it 'displays the "You reported this comment." message instantly' do
+ click_link('Report', id: "js-comment-#{comment.id}")
+ within('#report-modal') { click_button('Submit') }
+ expect(page).to have_text('You reported this comment.')
+ end
+ end
+
+ describe 'after reporting a comment on a package' do
+ let(:user) { create(:confirmed_user, login: 'jane_doe') }
+ let(:project) { create(:project, name: 'some_random_project') }
+ let(:package) { create(:package, project: project, name: 'some_random_package') }
+ let!(:comment) { create(:comment, commentable: package) }
+
+ before do
+ login user
+ visit package_show_path(project, package)
+ end
+
+ it 'displays the "You reported this comment." message instantly' do
+ click_link('Report', id: "js-comment-#{comment.id}")
+ within('#report-modal') { click_button('Submit') }
+ expect(page).to have_text('You reported this comment.')
+ end
+ end
+
+ describe 'after reporting a comment on a request' do
+ let(:user) { create(:confirmed_user, login: 'jane_doe') }
+ let(:project) { create(:project, name: 'some_random_project') }
+ let(:bs_request) { create(:delete_bs_request, target_project: project, description: 'Delete this project!', creator: user) }
+ let!(:comment) { create(:comment, commentable: bs_request) }
+
+ before do
+ login user
+ visit request_show_path(bs_request)
+ end
+
+ it 'displays the "You reported this comment." message instantly' do
+ click_link('Report', id: "js-comment-#{comment.id}")
+ within('#report-modal') { click_button('Submit') }
+ expect(page).to have_text('You reported this comment.')
+ end
+ end
+
+ describe 'after reporting a project' do
+ let(:user) { create(:confirmed_user, login: 'jane_doe') }
+ let(:project) { create(:project, name: 'some_random_project') }
+
+ before do
+ login user
+ visit project_show_path(project)
+ end
+
+ it 'displays the "You reported this project." message instantly' do
+ desktop? ? click_link('Report Project') : click_menu_link('Actions', 'Report Project')
+ within('#report-modal') { click_button('Submit') }
+ expect(page).to have_text('You reported this project.')
+ end
+ end
+
+ describe 'after reporting a package' do
+ let(:user) { create(:confirmed_user, login: 'jane_doe') }
+ let(:project) { create(:project, name: 'some_random_project') }
+ let(:package) { create(:package, project: project, name: 'some_random_package') }
+
+ before do
+ login user
+ visit package_show_path(project, package)
+ end
+
+ it 'displays the "You reported this package." message instantly' do
+ desktop? ? click_link('Report Package') : click_menu_link('Actions', 'Report Package')
+ within('#report-modal') { click_button('Submit') }
+ expect(page).to have_text('You reported this package.')
+ end
+ end
+
+ describe 'after reporting a user' do
+ let(:user) { create(:confirmed_user, login: 'jane_doe') }
+ let(:another_user) { create(:confirmed_user) }
+
+ before do
+ login user
+ visit user_path(another_user)
+ end
+
+ it 'displays the "You reported this user." message instantly' do
+ click_link('Report', id: "js-user-#{another_user.id}")
+ within('#report-modal') { click_button('Submit') }
+ expect(page).to have_text('You reported this user.')
+ end
+ end
+end