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:
I hope that's an acceptable solution.
cc @DouweM
Merge request reports
Activity
@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 already reported (button disabled):
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.
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 we use
dash-style
for css class names in GitLab. cc @DouweM
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'}} It better to use
link_to
unless you explicitly need%a
. cc @DouweM
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'}} Do not assign
#report_abuse_btn
ID if its not used. cc @DouweM
@dzaporozhets
Will fix.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') Try to avoid using html tags and style css classes in tests. Its easy to break such test. For example:
- I change
btn-close
tobtn-danger
- I change
span
tobutton
cc @DouweM
- I change