Polls, quotes and edits from the composer
The composer can hold a poll instead of media (two to four choices, a length, one choice or several), quote a post (offered on a card when the server says the persona may quote it), and edit the persona's own post: its words and warning come from /source, and saving keeps its media, visibility and poll. A card's menu offers Edit and Quote, and now opens sideways: upwards, the first card's menu was cut off by the top of the feed. The e2e tests publish a poll, edit a post and quote it, each checked on PrivaPub. 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
a4d9831691
commit
5c11727f58
12 files changed
+434
-12
No files matched your search
@@ -55,7 +55,9 @@ namespace decePubClient.Services
|
||||
SpoilerText = form.HasContentWarning ? form.SpoilerText : null,
|
||||
Visibility = form.Visibility,
|
||||
Language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
|
||||
ScheduledAt = form.ScheduledAtUtc?.ToString("o", CultureInfo.InvariantCulture)
|
||||
ScheduledAt = form.ScheduledAtUtc?.ToString("o", CultureInfo.InvariantCulture),
|
||||
Poll = form.HasPoll ? new PollForm { Options = [.. form.PollOptions.Select(o => o.Trim()).Where(o => o.Length > 0)], ExpiresIn = form.PollExpiresIn, Multiple = form.PollMultiple } : null,
|
||||
QuotedStatusId = form.QuotedStatusId
|
||||
}, cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
@@ -66,6 +68,29 @@ namespace decePubClient.Services
|
||||
return new WebResult { Data = FeedPost.Of(status) };
|
||||
}
|
||||
|
||||
/// <summary>The persona's own text of a post, to edit it; null when it cannot be read.</summary>
|
||||
public async Task<StatusSource> Source(string statusId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Get(APIs.Mastodon.GET_M_StatusSource(statusId), cancellationToken: cancellationToken);
|
||||
return response.IsSuccessStatusCode ? await response.MastodonReadFromJsonAsync<StatusSource>(cancellationToken) : null;
|
||||
}
|
||||
|
||||
/// <summary>Edits the persona's own post: new words and warning, the media kept; Data is the edited Status.</summary>
|
||||
public async Task<WebResult> Edit(string statusId, ComposeForm form, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Put(APIs.Mastodon.PUT_M_Status(statusId), new StatusEditForm
|
||||
{
|
||||
Status = form.Content ?? string.Empty,
|
||||
SpoilerText = form.HasContentWarning ? form.SpoilerText : null,
|
||||
Sensitive = form.HasContentWarning,
|
||||
Language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName
|
||||
}, cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
|
||||
return new WebResult { Data = await response.MastodonReadFromJsonAsync<Status>(cancellationToken) };
|
||||
}
|
||||
|
||||
/// <summary>The persona's posts waiting for their time, soonest first.</summary>
|
||||
public async Task<List<ScheduledStatus>> Scheduled(CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user