implement pending approvals
The challenges API for pending approvals should be:
const pendingApprovalChallengeSubplebbit = {
title: 'pending approval challenge subplebbit',
settings: {
challenges: [
{
// always fail this challenge, so all publications are pending approval
name: 'fail',
pendingApproval: true
},
{
name: 'text-math',
options: {difficulty: '3'},
description: 'Complete a math challenge.'
}
]
}
}
const pendingApprovalExcludeHighKarmaChallengeSubplebbit = {
title: 'pending approval exclude high karma challenge subplebbit',
settings: {
challenges: [
{
// a challenge that fails based on author karma
name: 'karma',
options: {
{
postScore: 100,
replyScore: 100,
firstCommentTimestamp: 60*60*24*100
}
},
pendingApproval: true
},
{
name: 'text-math',
options: {difficulty: '3'},
description: 'Complete a math challenge.'
}
]
}
}
other APIs related to pending approvals:
the pending approval comments would be visible on subplebbit.moderation.pageCids.pendingApproval, the list would cut out at subplebbit.settings.maxPendingApprovalCount = 500, comments pending approval would contain commentUpdate.pendingApproval: true. The author would receive ChallengeVerificationMessage.commentUpdate.pendingApproval: true to know about the pending approval.
the approvals would be sent by doing createCommentModeration({commentCid, {approved: true}})
ChallengeVerificationMessage.commentUpdate.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.commentUpdate.pendingApproval: true should be defined, it should not be part of the commentIpfs 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, the pendingApproval value will always be false, so no reason to include it in commentIpfs
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.commentUpdate.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.commentUpdate.pendingApproval would 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.pendingApprovalbe 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.
I think we probably dont want to put pending approval in subplebbit.posts, because it'll be more confusing when implementing subplebbit.encrypted (it'll be weird to encrypt only part of a nested prop) and also we dont want the user to think it's real sort type in cases where it's not encrypted.
so it could be called subplebbit.modQueue, subplebbit.moderatorQueue, subplebbit.moderator, subplebbit.moderation or something else?
it should be an instance of Pages. so it would be like this:
subplebbit.modQueue.pageCids.reports subplebbit.moderatorQueue.pageCids.reports subplebbit.moderator.pageCids.reports subplebbit.moderation.reports
subplebbit.modQueue.pageCids.pendingApproval subplebbit.moderatorQueue.pageCids.pendingApproval subplebbit.moderator.pageCids.pendingApproval subplebbit.moderation.pageCids.pendingApproval
old reddit has these moderator queues:
https://old.reddit.com/r/
new reddit has these:
https://www.reddit.com/mod/
I think the most sensical name would probably be subplebbit.moderation, considering we have plebbit.createCommentModeration. also in english is reads like "subplebbit moderation pages" which is very accurate since subplebbit.moderation would be a pages instance.
So at first the only page would be subplebbit.moderation.pageCids.pendingApproval. we probably don't want to use 'unmoderated' like on reddit because it's not clear enough, also on reddit you can 'approve' posts even if they are not pending approval. eventually we could potentially have subplebbit.moderation.pageCids.reports, removed, spam, edited, etc and show all of them in a feed of multiple 'mod queues'.
we probably never want to include preloaded pages in subplebbit.moderation since that would be a waste to download them for anyone that isn't a mod
Shouldn't
subplebbit.posts.pageCids.pendingApprovalbe hidden?
I think eventually we will have commentUpdate.encrypted and subplebbit.encrypted, which would probably use a similar API as PubsubMessage.encrypted. And once we have this, we should add subplebbit.moderation to subplebbit.encrypted.moderation, and only mods should be able to decrypt it and have access to subplebbit.moderation.
I think we should do this either before or after pending approvals are implemented, I think trying to implement both at the same time would be too difficult and confusing.