Posts for later, hashtags followed, and Explore
The composer's clock button gives a post a time (scheduled_at, at least five minutes ahead; located and group posts have none), and /scheduled moves or drops what waits. A hashtag's feed tab shows its week and follows it, so its public posts come home. Explore (/explore) shows what PrivaPub says is trending, hashtags, posts and links from public posts it holds, the directory by activity or by joining, and the hashtags the persona follows. DiscoveryService does the calls; the e2e tests check each against PrivaPub's own answer. 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
9a752d9288
commit
6d5cf17723
17 files changed
+1001
-7
No files matched your search
@@ -54,15 +54,52 @@ namespace decePubClient.Services
|
||||
Sensitive = form.HasContentWarning,
|
||||
SpoilerText = form.HasContentWarning ? form.SpoilerText : null,
|
||||
Visibility = form.Visibility,
|
||||
Language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName
|
||||
Language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName,
|
||||
ScheduledAt = form.ScheduledAtUtc?.ToString("o", CultureInfo.InvariantCulture)
|
||||
}, cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
|
||||
if (form.ScheduledAtUtc is not null)
|
||||
return new WebResult { Data = await response.MastodonReadFromJsonAsync<ScheduledStatus>(cancellationToken) };
|
||||
var status = await response.MastodonReadFromJsonAsync<Status>(cancellationToken);
|
||||
return new WebResult { Data = FeedPost.Of(status) };
|
||||
}
|
||||
|
||||
/// <summary>The persona's posts waiting for their time, soonest first.</summary>
|
||||
public async Task<List<ScheduledStatus>> Scheduled(CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Get(APIs.Mastodon.GET_ScheduledStatuses, ["limit=40"], cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var failure = await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
await logger.ProcessWarning(failure.ToString(localizer), $"{nameof(StatusService)}.{nameof(Scheduled)}", cancellationToken);
|
||||
return [];
|
||||
}
|
||||
return [.. (await response.MastodonReadFromJsonAsync<List<ScheduledStatus>>(cancellationToken) ?? []).OrderBy(s => s.ScheduledAt)];
|
||||
}
|
||||
|
||||
/// <summary>Moves a scheduled post to another time; Data is the ScheduledStatus.</summary>
|
||||
public async Task<WebResult> Reschedule(string scheduledId, DateTime atUtc, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Put(APIs.Mastodon.PUT_M_ScheduledStatus(scheduledId),
|
||||
new ScheduleForm { ScheduledAt = atUtc.ToString("o", CultureInfo.InvariantCulture) }, cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
|
||||
return new WebResult { Data = await response.MastodonReadFromJsonAsync<ScheduledStatus>(cancellationToken) };
|
||||
}
|
||||
|
||||
/// <summary>Drops a scheduled post: it is never published.</summary>
|
||||
public async Task<WebResult> Unschedule(string scheduledId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var response = await httpService.Delete(APIs.Mastodon.DELETE_M_ScheduledStatus(scheduledId), cancellationToken: cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return await response.Content.ReadWebResult(response.StatusCode, localizer, cancellationToken);
|
||||
|
||||
return new WebResult();
|
||||
}
|
||||
|
||||
/// <summary>A located or group post: text only, through /clientapi/post/insert.</summary>
|
||||
async Task<WebResult> PublishThroughClientApi(ComposeForm form, string personaId, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user