PeerTube puts canReply on a video whose comments wait for approval, and answers each comment with ApproveReply. A persona's reply to such a post now waits (privapub.approval: pending), its Create going to the author alone; the author's ApproveReply, signed by the author and naming the post answered, lets it out to its audience with replyApproval, and RejectReply leaves it ours. A null canReply (PeerTube's open comments) says nothing; an empty one refuses. The PeerTube scenario holds a comment for review and approves it through PeerTube's API (28 checks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using PrivaPub.Domain.Statuses;
|
|
using PrivaPub.Models.User;
|
|
|
|
using System.Text.Json.Nodes;
|
|
|
|
namespace PrivaPub.Federation.Inbox.Handlers
|
|
{
|
|
// FEP-5624 (PeerTube): the author of a post whose canReply asks it to approve each reply lets one of ours in, which then
|
|
// goes to its audience carrying the approval (replyApproval)
|
|
public class ReplyApprovalHandler : IActivityHandler
|
|
{
|
|
readonly IInteractionApprovals _approvals;
|
|
|
|
public ReplyApprovalHandler(IInteractionApprovals approvals) => _approvals = approvals;
|
|
|
|
public virtual string Type => "ApproveReply";
|
|
|
|
protected virtual bool Approves => true;
|
|
|
|
public async Task Handle(JsonNode activity, ForeignAvatar actor, CancellationToken token) =>
|
|
await _approvals.Answered(activity, actor, Approves, token);
|
|
}
|
|
|
|
// and refuses one, which stays ours alone
|
|
public class ReplyRejectionHandler : ReplyApprovalHandler
|
|
{
|
|
public ReplyRejectionHandler(IInteractionApprovals approvals) : base(approvals)
|
|
{
|
|
}
|
|
|
|
public override string Type => "RejectReply";
|
|
|
|
protected override bool Approves => false;
|
|
}
|
|
}
|