Skip to content
Snippets Groups Projects

Disable the "Report abuse" button if a user has already been reported

Hello,

I've implemented the feature request #2330 (closed). Here is what it looks like:

report-abuse-button-disabled

I hope that's an acceptable solution.

cc @DouweM

Merge request reports

Checking pipeline status.

Merged by avatar (Apr 10, 2025 3:42am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Added 1 commit:

    • a5297969 - Streamline the "Report button"
  • @DouweM Thanks very much for the review, I've pushed a commit that should address all your points. Also, I've decided to simplify the tooltip labels since I think that repeating the user name in the tooltips doesn't add much value in the context of a user page.

    User not already reported: Screen_Shot_2015-09-29_at_18.15.38

    User already reported (button disabled): Screen_Shot_2015-09-29_at_18.15.51

    I think this is a more acceptable and simpler solution like that!

  • Added 2 commits:

    • 5f95a5e0 - Disable the "Report abuse" button if a user has already been reported
    • 2e3de94e - Streamline the "Report button"
  • Added 1 commit:

    • ea72d53e - Streamline the "Report button"
  • Thanks a lot @rymai, looks good to me! I've retried the builds and will merge once they're green.

  • For some reason, the builds wouldn't get out of the pending status. I ran them here instead. The one failure is unrelated, so I'm merging.

  • Douwe Maan Status changed to merged

    Status changed to merged

  • Douwe Maan mentioned in commit 96c2e225

    mentioned in commit 96c2e225

  • mentioned in issue #2330 (closed)

  • 19 19 = icon('user')
    20 20 Profile settings
    21 21 - elsif current_user
    22 .pull-right
    23 %span.dropdown
    24 %a.light.dropdown-toggle.btn.btn-sm{href: '#', "data-toggle" => "dropdown"}
    22 .report_abuse.pull-right
  • 19 19 = icon('user')
    20 20 Profile settings
    21 21 - elsif current_user
    22 .pull-right
    23 %span.dropdown
    24 %a.light.dropdown-toggle.btn.btn-sm{href: '#', "data-toggle" => "dropdown"}
    22 .report_abuse.pull-right
    23 - if @user.abuse_report
    24 %span#report_abuse_btn.light.btn.btn-sm.btn-close{title: 'Already reported for abuse', data: {toggle: 'tooltip', placement: 'right', container: 'body'}}
    25 = icon('exclamation-circle')
    26 - else
    27 %a.light.btn.btn-sm{href: new_abuse_report_path(user_id: @user.id), title: 'Report abuse', data: {toggle: 'tooltip', placement: 'right', container: 'body'}}
  • 19 19 = icon('user')
    20 20 Profile settings
    21 21 - elsif current_user
    22 .pull-right
    23 %span.dropdown
    24 %a.light.dropdown-toggle.btn.btn-sm{href: '#', "data-toggle" => "dropdown"}
    22 .report_abuse.pull-right
    23 - if @user.abuse_report
    24 %span#report_abuse_btn.light.btn.btn-sm.btn-close{title: 'Already reported for abuse', data: {toggle: 'tooltip', placement: 'right', container: 'body'}}
  • 22 22 user_mike
    23 23 end
    24 24
    25 step 'I should see a red "Report abuse" button' do
    26 expect(find(:css, '.report_abuse')).to have_selector(:css, 'span.btn-close')
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading