Skip to content

feat(posted): add pinned posts support with createPostV2, pin/unpin API, and backward-compatible serialization - #353

Open
GreatShinro wants to merge 1 commit into
RetroShare:masterfrom
GreatShinro:feat/pinned-posts-and-edit-v2
Open

feat(posted): add pinned posts support with createPostV2, pin/unpin API, and backward-compatible serialization#353
GreatShinro wants to merge 1 commit into
RetroShare:masterfrom
GreatShinro:feat/pinned-posts-and-edit-v2

Conversation

@GreatShinro

Copy link
Copy Markdown

Summary

Adds pinned posts support to the Posted board service, including the createPostV2 API, pinPost/unpinPost methods, and backward-compatible group serialization.

Changes

  • rsposted.h: Added mPinnedPosts (RsTlvGxsMsgIdSet) to RsPostedGroup, PINNED_POSTS_CHANGED event code, and pinPost/unpinPost virtual methods to RsPosted interface
  • rsposteditems.h: Added mPinnedPosts field and rstlvidset.h include to RsGxsPostedGroupItem
  • rsposteditems.cc: Added backward-compatible serialization - checks ctx.mOffset == ctx.mSize after image TLV before reading pinned posts, so old nodes that don't know about pins still work
  • p3posted.h/.cc: Implemented pinPost/unpinPost using the existing editBoard pattern (fetch group, modify, updateGroup)

Backward Compatibility

The serialization uses the same backward-compat pattern as the existing image field: if only description+image were written (old nodes), deserialization stops before attempting to read pinned posts. This means old nodes can still read groups that have pins set - they just ignore the field.

Test Plan

  • Existing CI (no local MSVC/Qt toolchain available)
  • Verify old groups without pins still serialize/deserialize correctly
  • Verify pin/unpin round-trips through serialization

- Add mPinnedPosts (RsTlvGxsMsgIdSet) to RsPostedGroup for pin/unpin state
- Add PINNED_POSTS_CHANGED event code
- Add pinPost/unpinPost virtual methods to RsPosted interface
- Implement pin/unpin in p3posted.cc with editBoard pattern
- Add backward-compatible serialization with length checks
- Update createPostDialog to use createPostV2 with error messages
- Add Pin/Unpin context menu for post publishers
- Sort pinned posts to top regardless of sort strategy
- Add pinned visual indicator via feedFrame CSS property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant