Cofacts user blocking mechanism
Previous discussion
- 20211006 Proposals that deals with spammers: https://g0v.hackmd.io/zlWWCpDTQ5iADHNw7Thpog#Delete-reply-requests
- 20211013 Change scopes: https://g0v.hackmd.io/0Cv5hmmAQYyW8SJdXvfdtw#Delete-reply-requests—blocking-user-from-submitting-visible-contents
- 20211027 Breakdown into milestones: https://g0v.hackmd.io/rf0A7MRfTOC613QZmFehQA#User-Blocking
Milestones and progress
M1: data prep :heavy_check_mark:
Schema
- add status field & “BLOCKED” state https://github.com/cofacts/rumors-db/pull/55/
- Add migration script to fill in status for
articleReplyFeedback,replyRequest,articleCategoryFeedbackhttps://github.com/cofacts/rumors-db/pull/55/- Unlike
articleReplyandarticleCategoryunderarticlesindex, those are individual indexes. articleReplyFeedback,replyRequest,articleCategoryFeedbackcan be listed out in separate API using ElasticSearchtermsfilter
- Unlike
API
- Update mutation APIs for
ArticleReply,ArticleReplyFeedback,ReplyRequest,ArticleCategory,ArticleCategoryFeedbackso that statuses can be filled in according to currently logged-in user is blocked or not https://github.com/cofacts/rumors-api/pull/263
Release
- Working schema
- Existing document fields are properly filled
- New document fields are properly filled
- Hidden reply rquests does not increase replyRequestCount
- Hidden article reply feedback does not increase feedbackCount
Not yet
- API still gives hidden items as before
M2: blocking mechanism (reply requests only) :heavy_check_mark:
API
- Implement manual script that blocks a user (given a userId and blockedReason) and marks all their existing
ReplyRequestasBLOCKED- Should also update counting fields
- https://github.com/cofacts/rumors-api/pull/267
- Expose
blockedReasoninUsertype https://github.com/cofacts/rumors-api/pull/269 - List all blocked users so that we can list blocked contents in M3 https://github.com/cofacts/rumors-api/pull/269
Website
- In website, writes
isUserBlockedto cookie (website domain) if the current user is blocked https://github.com/cofacts/rumors-site/pull/457 - load if the user is blocked from cookie and make this info available for all components (through react context or global variable) https://github.com/cofacts/rumors-site/pull/457
- The value should be available during SSR and in browser
- The value should be availble even after logout
Release
- Block known violating users after release
- Blocked user will start having
isUserBlockedcookie in their browser
- Blocked user will start having
- API & website still gives hidden items as before
M3: remove blocked reply requests from sight :heavy_check_mark:
API
WIPaddstatusesfilter to all listing APIs forReplyRequesthttps://github.com/cofacts/rumors-api/pull/262/- filter out DELETED / BLOCKED items by default
Website
- Query for
BLOCKEDreply requests from API by default - Filter out
BLOCKEDitems if cookieisUserBlockeddoes not exist
Community builder / Spreadsheet
- List out latest blocked items
Release
- Should display
BLOCKEDitems only for blocked users, even after they logout!
M4: Block all contents from blocked users :heavy_check_mark:
API
- Extend the script that blocks a user (given a userId and blockedReason) to mark all their existing
ArticleReply,ArticleReplyFeedback,ArticleCategory,ArticleCategoryFeedbackasBLOCKED- Leave
DELETEDarticle replies intact so that the contents we previously deleted won’t come out - Should also update counting fields
- https://github.com/cofacts/rumors-api/pull/274
- Leave
- add
statusesfilter to all listing APIs forArticleReply,ArticleReplyFeedback,ArticleCategory,ArticleCategoryFeedbackhttps://github.com/cofacts/rumors-api/pull/262/- filter out DELETED / BLOCKED items by default
Website
- Query for
BLOCKEDitems from API by default
M5: Report content mechanism :heavy_check_mark:
[!NOTE] Discussion: https://g0v.hackmd.io/Syl8le5xS22nLo8Vc56gmw?view#Block-user-%E5%BB%B6%E4%BC%B8%E4%BA%8B%E9%A0%85
- Google form collecting spam
- Implementation testing & improvement https://g0v.hackmd.io/tBEc2MajQkS-s-lGaG91Gg#%E6%AA%A2%E8%88%89%E9%81%95%E8%A6%8F%E8%99%95%E7%90%86%E6%B5%81%E7%A8%8B
- Website: add button
- https://github.com/cofacts/rumors-site/pull/471