Skip to content

Conversation

@charliez07
Copy link

Summary

This PR implements the ability to view previous versions of edited posts by exposing post history metadata through the Topics API.

Changes Made

Core Implementation (src/topics/posts.js)

  • Enhanced Topics.addPostData: Now includes post history metadata for all posts
    • hasHistory: Boolean indicating if post has revision history
    • revisionCount: Number of revisions available
    • canViewHistory: Boolean based on user privileges and settings
  • Added Topics.getPostRevisions: New method to retrieve detailed revision information using existing Posts.diffs infrastructure
  • Privilege Integration: Respects meta.config.enablePostHistory setting and user permissions

Test Coverage (test/topics.js)

  • Added comprehensive test suite for post history functionality
  • Tests history metadata inclusion in post objects
  • Tests detailed revision retrieval
  • Tests privilege-based access control

Technical Details

  • Leverages existing Posts.diffs system for revision storage
  • Maintains backward compatibility - no breaking changes
  • Follows NodeBB patterns for privilege checking and data aggregation
  • All functionality is controlled by the enablePostHistory config setting

User Story Fulfilled

✅ "As a user, I want to see previous versions of an edited post, so that I know what changed"

Users can now access post history through the Topics API when the feature is enabled and they have appropriate privileges.

@aarzate2 aarzate2 assigned aarzate2 and unassigned aarzate2 Oct 2, 2025
@aarzate2 aarzate2 self-requested a review October 2, 2025 13:38
Copy link

@aarzate2 aarzate2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually dont think this actually added this feature? I ran it in the code space, and I dont see anything new in regards to seeing post history, that wasnt already a feature.

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.

3 participants