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:
1 parent
6f8472bc9f
commit
5e8fdc43af
12 files changed
+216
-15
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user