π Diff (Edit History) v2.0.0 - Security Enhancements, Performance Optimizations & Flarum 2.x Modernization
We are excited to announce the stable release of Diff (Edit History) v2.0.0 for Flarum 2.x! This release brings a comprehensive modernization of the extension, focusing on strengthening permission enforcement, optimizing revision history performance, ensuring cross-database compatibility, and introducing a fully modernized frontend with comprehensive automated testing.
π Security & Permission Enforcement
- Restricted Content Protection: Implemented strict query-level permission scoping in
DiffResource::scope() and DiffSearcher to ensure users can only access revision histories for posts they are authorized to view, including posts in private tags and hidden discussions.
- Permission-Aware Revision Access: Strengthened revision history access controls to prevent users with
viewEditHistory permission from accessing histories of otherwise restricted content.
β‘ Performance & Query Optimization
- N+1 Query Elimination: Optimized revision count retrieval to eliminate N+1 queries when loading post streams with revision counters.
- Request-Level Memoization: Added caching for maximum revision lookups, comparison contents, and Diff renderer instances to avoid redundant database queries and repeated object initialization when navigating revision histories.
π¨ Modernized Frontend & UX
- Pure Mithril Components: Refactored
DiffModal into modern, reactive Mithril components, removing the legacy jQuery dependency.
- Deleted User Handling: Added null-safety checks when viewing revision differences for posts authored by deleted users.
- Pagination & Redraw Fixes: Corrected offset calculations in
DiffListState and replaced legacy empty post.save({}) PATCH requests with proper Mithril redraw handling.
ποΈ Cross-Database Compatibility
- Multi-Database Support: Fixed MySQL-specific schema migrations to ensure compatibility with MySQL, MariaDB, PostgreSQL, and SQLite.
- Reliable Migrations: Improved database portability while preserving existing revision history during upgrades from the original 1.x extension.
π§ͺ Automated Testing & Code Quality
- CI Matrix Testing: Added automated testing across PHP 8.3, 8.4, and 8.5, covering MySQL, MariaDB, PostgreSQL, and SQLite.
- Migration Verification: Added data preservation tests to verify that revision history is retained when migrating from
the-turk/flarum-diff 1.x to the new Flarum 2.x extension.
- StyleCI Compliance: Achieved 100% StyleCI compliance.
π¦ Installation
To install Diff v2.0.0 on Flarum 2.x, run:
composer require huseyinfiliz/flarum-diff:"*"
php flarum migrate
php flarum cache:clear
π Upgrading from the-turk/flarum-diff (1.x)
If you are upgrading from the original 1.x extension:
- Back up your database.
- Replace
the-turk/flarum-diff with huseyinfiliz/flarum-diff in your composer.json.
- Run
composer update and php flarum migrate.
- Your existing revision history will be preserved automatically.
Note: Due to the namespace change, review your edit history permission settings in the Flarum Admin panel after upgrading.
π Links
Feedback and issue reports are always welcome. Thank you to everyone supporting the development of Diff and the Flarum 2.x ecosystem! π