harvard-lil / perma

Indelible links
413 stars 70 forks source link

Revised private by policy #3392

Closed rebeccacremona closed 1 year ago

rebeccacremona commented 1 year ago

See ENG-295.

We have decided to make it simpler for domains to request that new Perma Links of their site be made private. Instead of inspecting robots.txt, the page's meta tags, and the requests' headers, we will instead compare the domain of the captured URL to a list, and will add domains to the list (settings.PRIVATE_BY_POLICY_DOMAINS) upon request, according to policy.

This PR renames the "keys" of the Link.private_reason to be descriptive, rather than "new/old", and adds two new ones: domain, for use with the new policy, and flagged, for use when a user has reported that a Perma Link contains flagged content (which admins sometimes recorded as private due to policy). The manage/stats page is updated accordingly.

The data migration is speedy locally with a prod-like database; I'm not worried about it.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 82.35% and project coverage change: -0.13% :warning:

Comparison is base (60f5600) 68.75% compared to head (ab4a032) 68.63%. Report is 5 commits behind head on develop.

:exclamation: Current head ab4a032 differs from pull request most recent head d0eb433. Consider uploading reports for the commit d0eb433 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3392 +/- ## =========================================== - Coverage 68.75% 68.63% -0.13% =========================================== Files 53 53 Lines 7263 7221 -42 =========================================== - Hits 4994 4956 -38 + Misses 2269 2265 -4 ``` | [Files Changed](https://app.codecov.io/gh/harvard-lil/perma/pull/3392?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=harvard-lil) | Coverage Δ | | |---|---|---| | [perma\_web/perma/celery\_tasks.py](https://app.codecov.io/gh/harvard-lil/perma/pull/3392?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=harvard-lil#diff-cGVybWFfd2ViL3Blcm1hL2NlbGVyeV90YXNrcy5weQ==) | `47.96% <57.14%> (-1.37%)` | :arrow_down: | | [perma\_web/api/serializers.py](https://app.codecov.io/gh/harvard-lil/perma/pull/3392?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=harvard-lil#diff-cGVybWFfd2ViL2FwaS9zZXJpYWxpemVycy5weQ==) | `93.20% <100.00%> (ø)` | | | [perma\_web/perma/models.py](https://app.codecov.io/gh/harvard-lil/perma/pull/3392?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=harvard-lil#diff-cGVybWFfd2ViL3Blcm1hL21vZGVscy5weQ==) | `86.34% <100.00%> (ø)` | | | [perma\_web/perma/views/user\_management.py](https://app.codecov.io/gh/harvard-lil/perma/pull/3392?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=harvard-lil#diff-cGVybWFfd2ViL3Blcm1hL3ZpZXdzL3VzZXJfbWFuYWdlbWVudC5weQ==) | `94.86% <100.00%> (+0.02%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/harvard-lil/perma/pull/3392/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=harvard-lil)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.