Edit history from formerRepresentations
Pleroma and Akkoma send a post's earlier versions with it. A post PrivaPub first meets after its edits now has its history, and an edit that carries them brings the versions missed in between; each is read as the post itself is. The Akkoma scenario checks a post fetched after two edits by an account no persona follows. 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
02928caac1
commit
679463eb3f
12 files changed
+288
-24
No files matched your search
@@ -13,7 +13,7 @@ namespace PrivaPub.Federation.Inbox
|
||||
{
|
||||
public static class RemoteEdits
|
||||
{
|
||||
public const int MaxRevisions = 20;
|
||||
public const int MaxRevisions = NoteParser.MaxRevisions;
|
||||
|
||||
//newer than what we hold; or, for a first edit, no older and actually different, because GoToSocial's timestamps are
|
||||
//whole seconds and an edit made in the second the post was published carries updated == published
|
||||
@@ -47,14 +47,18 @@ namespace PrivaPub.Federation.Inbox
|
||||
return false;
|
||||
}
|
||||
|
||||
post.Revisions.Add(new PostRevision
|
||||
{
|
||||
Title = post.Title,
|
||||
SpoilerText = post.SpoilerText,
|
||||
ContentHtml = post.ContentHtml,
|
||||
HasContentWarning = post.HasContentWarning,
|
||||
EditedAt = post.EditedAt ?? post.CreationDate
|
||||
});
|
||||
//the author's server's own history (Pleroma's, Akkoma's) holds the version we had, and the edits we missed
|
||||
if (note.FormerRepresentations.Count > 0)
|
||||
post.Revisions = note.FormerRepresentations.ToList();
|
||||
else
|
||||
post.Revisions.Add(new PostRevision
|
||||
{
|
||||
Title = post.Title,
|
||||
SpoilerText = post.SpoilerText,
|
||||
ContentHtml = post.ContentHtml,
|
||||
HasContentWarning = post.HasContentWarning,
|
||||
EditedAt = post.EditedAt ?? post.CreationDate
|
||||
});
|
||||
if (post.Revisions.Count > MaxRevisions)
|
||||
post.Revisions.RemoveRange(0, post.Revisions.Count - MaxRevisions);
|
||||
|
||||
|
||||
@@ -133,7 +133,8 @@ namespace PrivaPub.Federation.Inbox
|
||||
AuthorGone = author.AccountState == AvatarAccountState.Deleted,
|
||||
CreationDate = note.Published,
|
||||
UpdateDate = note.Updated ?? note.Published,
|
||||
EditedAt = note.Updated
|
||||
EditedAt = note.Updated,
|
||||
Revisions = note.FormerRepresentations.ToList()
|
||||
};
|
||||
await Episode(post, note, author, token);
|
||||
return post;
|
||||
|
||||
Reference in new issue
Block a user