Novusphere / discussions-app

[DEPRECATED]
14 stars 4 forks source link

NSFW support #260

Open Novusphere opened 4 years ago

Novusphere commented 4 years ago

Supporting NSFW requires a refactor to the mod system --

Retrieve post policies for a group of post

/discussions/moderation/postpolicy/
    ids=hp3cm4en1y2e,8678r4fcjm00
    mods=EOS5epmzy9PGex6uS6r6UzcsyxYhsciwjMdrx1qbtF51hXhRjnYYH

Retrieve posts that are pinned for a given tag

/discussions/moderation/pinned/
    tag=atmos
    mods=EOS5epmzy9PGex6uS6r6UzcsyxYhsciwjMdrx1qbtF51hXhRjnYYH

Authenticated endpoint to obtain a list of posts that the user (moderator) has added tags to

/discussions/moderation/tagged

Authenticated endpoint to add tags to a post / set additional tags via moderation

/discussions/moderation/settags
    id=8678r4fcjm00
    tags=nsfw,pinned,sometag

How does this work on back end?

Unpack all the ids into { txid32, createdAt } form Find if there's any posts that have been moderated by mods with txid32 also satisfying createdAt range Foreach id, return back

    {
        id, // serialized id
        txid32,
        createdAt,
        tags // tags that the mod has added to this post
    }

How does this work on front end?

Each post should be passed to /moderation/postpolicy where multiple posts can be passed at once as well as specifying the mods that user is using. In the response,

We should introduce another field to Post for tags that were added only as a result of coming from mod-added tags, modTags We should then also introduce the method isTagged which checks if a tag is present in post.tags or post.modTags where as isModTagged only checks if its present in post.modTags If isModTagged("modspam") the post is treated as hidden/spam If isTagged("nsfw") the post is treated as nsfw

Additional notes

Pinned posts can be treated as well as a mod-assigned tag and an additional end point could be used to provide this all pinned posts for a particular tag, given a list of mods.