An event card joins and leaves the event

PrivaPub lets a persona join another server's event (owner decision
2026-10-05). The card of a remote event shows the persona's participation
(pending, accepted, rejected) with Join or Leave, except for events by
invitation or taken on another site. Joining is public on the event's
server, so the first join asks the persona once, as reactions and votes do,
remembered apart from them (PublicAct).

The e2e joins the event SocialPub's Mobilizon scenario keeps, checks the
participant on Mobilizon and PrivaPub's answer, and leaves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-05 15:19:07 +02:00
1 parent 6f8472bc9f
commit 5e8fdc43af
12 files changed
+216 -15

No files matched your search

+11 -6
View File
@@ -5,9 +5,9 @@ using decePubClient.Models;
namespace decePubClient.Services
{
/// <summary>
/// Asks a persona, once, before its first reaction or poll vote, to accept that these are public and visible as that
/// persona (an owner decision). PublicNoticeHost shows the question; Confirm returns true at once for a persona that
/// already accepted it, and false when the reader declines.
/// Asks a persona, once, before its first reaction or poll vote, and once before it first joins an event, to accept
/// that these are public and visible as that persona (an owner decision). PublicNoticeHost shows the question; Confirm
/// returns true at once for a persona that already accepted it, and false when the reader declines.
/// </summary>
public class PublicNoticeService(ILocalStorageService localStorage)
{
@@ -17,14 +17,19 @@ namespace decePubClient.Services
public bool IsAsking => pending is not null;
public async Task<bool> Confirm(string personaId, CancellationToken cancellationToken = default)
/// <summary>What the persona is being told about.</summary>
public PublicAct Act { get; private set; } = PublicAct.Reaction;
public async Task<bool> Confirm(string personaId, PublicAct act = PublicAct.Reaction, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(personaId))
return false;
var seen = await localStorage.GetItemAsync<PublicActionNotices>(nameof(PublicActionNotices), cancellationToken) ?? new();
if (seen.PersonaIds.Contains(personaId))
var told = act == PublicAct.Participation ? seen.EventPersonaIds : seen.PersonaIds;
if (told.Contains(personaId))
return true;
Act = act;
pending = new TaskCompletionSource<bool>();
Changed?.Invoke();
var accepted = await pending.Task;
@@ -33,7 +38,7 @@ namespace decePubClient.Services
if (!accepted)
return false;
seen.PersonaIds.Add(personaId);
told.Add(personaId);
await localStorage.SetItemAsync(nameof(PublicActionNotices), seen, cancellationToken);
return true;
}
+9
View File
@@ -172,6 +172,15 @@ namespace decePubClient.Services
return await StatusResult(response, cancellationToken);
}
/// <summary>Joins a remote event as the persona (its server is told, and shows who takes part), or leaves it; Data is
/// the updated Status, whose event says how the participation stands.</summary>
public async Task<WebResult> Participate(string statusId, bool join, CancellationToken cancellationToken = default)
{
using var response = await httpService.Post(join ? APIs.PrivaPub.POST_M_Join(statusId) : APIs.PrivaPub.POST_M_Leave(statusId),
cancellationToken: cancellationToken);
return await StatusResult(response, cancellationToken);
}
/// <summary>Votes in a poll as the persona (each option by its index); Data is the updated Poll.</summary>
public async Task<WebResult> Vote(string pollId, IReadOnlyCollection<int> choices, CancellationToken cancellationToken = default)
{