harvard-lil / perma

Indelible links
420 stars 71 forks source link

Make a stand-alone form for reporting inappropriate content #3351

Closed rebeccacremona closed 1 year ago

rebeccacremona commented 1 year ago

Currently, when a user clicks on the “Flag Inappropriate” button on the “Record Details” tray of a Perma Link they are redirected to our Contact Form with a pre-filled message.

We decided to extract that into its own form for special handling: see ENG-96 for more discussion about details and design.

Flow

This PR adds a form with two new fields: a select/dropdown of reasons for reporting, and a text field requesting info on where the user found the Perma Link.

image image

If the reporting user is logged in, their email address is pre-populated for them.

If required fields are missing, users are prompted to fill them in, but otherwise, they are directed to the "Thanks!" page.

image

Perma admins are sent an email something like:

Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [perma-contact] Reporting Inappropriate Content
From: webmaster@localhost
To: webmaster@localhost
Date: Mon, 12 Jun 2023 20:33:16 -0000
Message-ID: <168660199633.1417.8184645293545937667@d807b0a87676>
Reply-To: me@me.com

A user has reported that CMU9-DXVG contains inappropriate material.

https://perma.test:8000/admin/perma/link/?guid=CMU9-DXVG

Reason for Reporting
--------------------
Graphic or Dangerous Content

How did you discover this Perma Link?
-------------------------------------
I saw it on Internet Archive.

----
Troubleshooting Info:
User email: me@me.com
Logged in: false
Affiliations: (none)
Referring Page: https://perma.test:8000/CMU9-DXVG
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Design decisions

I chose not to have the form perform any checks to see if the GUID in question exists. While no more expensive than a regular 404, I wanted to minimize database usage, should a bot slip past our protections and make a gazillion submissions. But, I only send the email if something is supplied for GUID.

I'm not that worried about it, but it could be that we'd rather check for the existence of the link instead.

codecov[bot] commented 1 year ago

Codecov Report

Merging #3351 (87bafe1) into develop (b108f48) will increase coverage by 0.04%. The diff coverage is 85.71%.

@@             Coverage Diff             @@
##           develop    #3351      +/-   ##
===========================================
+ Coverage    69.99%   70.04%   +0.04%     
===========================================
  Files           55       55              
  Lines         7026     7054      +28     
===========================================
+ Hits          4918     4941      +23     
- Misses        2108     2113       +5     
Impacted Files Coverage Δ
perma_web/perma/urls.py 80.95% <ø> (ø)
perma_web/perma/views/common.py 82.54% <81.48%> (-0.60%) :arrow_down:
perma_web/perma/forms.py 95.49% <100.00%> (+0.16%) :arrow_up:
rebeccacremona commented 1 year ago

With the optional "message" field removed: image