Open estebanabaroa opened 11 months ago
Do we need to change the code in challenges to implement this?
Is pending approvals only for posts? Or does it include replies and votes?
Do we need to change the code in challenges to implement this?
yes, SubplebbitChallenge
and SubplebbitChallengeSettings
have a new optional field, pendingApproval: boolean
. if a challenge has this field true and fails, the publication is put in pending approval queue instead of being published. In my example I use the 'fail' challenge which always fails, so it puts all posts and replies in pending approval. To only put posts in pending approval, the sub owner could add exclude: [reply: true]
e.g.
const pendingApprovalChallengeSubplebbit = {
title: 'pending approval challenge subplebbit',
settings: {
challenges: [
{
// always fail this challenge, so all publications are pending approval
name: 'fail',
pendingApproval: true,
// do not put replies in pending approval
exclude: [{reply: true}]
},
{
name: 'text-math',
options: {difficulty: '3'},
description: 'Complete a math challenge.'
}
]
}
}
I guess getChallengeVerification()
needs a new field, pendingApproval?: boolean
, so that you can add ChallengeVerificationMessage.publication.pendingApproval
you would need to write the logic for checking if a SubplebbitChallengeSettings
has pendingApproval
and fails, and when this happens, getChallengeVerification()
must return pendingApproval: true
, then using the response from getChallengeVerification, ChallengeVerificationMessage.publication.pendingApproval
must be communicated to the author, and the publication must be added to the pending approval queue
Is pending approvals only for posts? Or does it include replies and votes?
The pendingApproval option applies to all comments, replies and posts. But not to votes. It's possible to combine pendingApproval with exclude to only target replies or posts.
I could potentially modify getChallengeVerification() myself since I'm most familiar with the code, but I don't know when I'm gonna have time to do that, if you can do it that would be good.
NOTE: I don't think pendingApproval needs to be added to challengeVerificationMessage, just to ChallengeVerificationMessage.publication.pendingApproval might be fine.
Shouldn't subplebbit.posts.pageCids.pendingApproval
be hidden? Everyone would be able to see which comments are awaiting approval. Maybe mods instead can publish an encrypted pubsub message to sub owner asking for approvals, and sub owner can respond with cid of pageCids.pendingApproval
.
Shouldn't
subplebbit.posts.pageCids.pendingApproval
be hidden? Everyone would be able to see which comments are awaiting approval.
seems desirable to me. we want plebbit to be as transparent as possible
Maybe mods instead can publish an encrypted pubsub message to sub owner asking for approvals, and sub owner can respond with cid of pageCids.pendingApproval
a lot more complex to implement, also pubsub requires as lot more resources than just fetching ipfs/ipns, which can also just be done from a gateway. we want to avoid pubsub as much as possible, it's the least scalable part of plebbit. also I dont think them not being publicly visible is desirable, we want plebbit to be as transparent as possible.
The challenges API for pending approvals should be:
other APIs related to pending approvals:
the pending approval comments would be visible on
subplebbit.posts.pageCids.pendingApproval
, the list would cut out atsubplebbit.settings.maxPendingApprovalCount = 500
, comments pending approval would containcomment.pendingApprovalId: 'random string'
the approvals would be sent by doing
createCommentEdit({pendingApprovalId: 'random string', approved: true})
ChallengeVerificationMessage.publication.cid
should be defined (so the author can start listening for a comment update), but the sub owner should not pin this CID yet or start publishing comment updates (to save resources for not yet approved and never approved comments)ChallengeVerificationMessage.publication.pendingApproval = true
should be defined, but should not be part of thecommentIpfs
since it doesn't seem to serve any purpose, the goal is just to signal to the author that his comment is pending approval, once the CID is fetchable, thependingApproval
value will always be false, so no reason to include it incommentIpfs