2026-10-06 16:16:34 +02:00
|
|
|
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)
|
2026-11-10 01:24:43 +01:00
|
|
|
public class ReplyApprovalHandler(
|
|
|
|
|
IInteractionApprovals approvals) : IActivityHandler
|
2026-10-06 16:16:34 +02:00
|
|
|
{
|
|
|
|
|
public virtual string Type => "ApproveReply";
|
|
|
|
|
|
|
|
|
|
protected virtual bool Approves => true;
|
|
|
|
|
|
|
|
|
|
public async Task Handle(JsonNode activity, ForeignAvatar actor, CancellationToken token) =>
|
2026-11-10 01:24:43 +01:00
|
|
|
await approvals.Answered(activity, actor, Approves, token);
|
2026-10-06 16:16:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
}
|