Skip to content

Conversation

@Infi-Knight
Copy link
Contributor

@Infi-Knight Infi-Knight commented Jan 20, 2026

  • Linked issue added (e.g., Fixes #123)
  • I have run bun run format to ensure code is properly formatted
  • I have verified that bun run lint passes without errors
  • If blog post was added:
    • Ensure images have been optimised
    • Update dates to reflect the actual publishing date when merged (file names, folder names, and frontmatter)

Summary
Implements concurrent editing protection for Strapi CMS by installing and configuring Record Locking plugin with takeover functionality. This prevents data loss when multiple users attempt to edit the same content simultaneously.

Features Added

  • Record Locking: Only one user can edit a content entry at a time
  • Takeover Feature: Allows users to forcefully take over editing from another user
  • Real-time Updates: WebSocket-based live status updates across browser sessions
  • Visual Indicators: Clear messaging showing who is currently editing content

How It Works

Normal Editing Flow

  1. User A clicks "Edit" on any content entry
  2. Record Locking plugin checks if content is locked
  3. If unlocked, plugin creates lock for User A in database
  4. WebSocket broadcasts lock event to all connected users
  5. User A can now edit the content exclusively

Takeover Scenario

  1. User B tries to edit content already locked by User A
  2. Plugin displays warning: "This entry is being edited by [User A name]"
Screenshot 2026-01-20 at 3 42 10 PM
  1. "Takeover" button appears next to warning
  2. User B clicks takeover → lock transfers from User A to User B
  3. User A receives notification that they lost edit access
Screenshot 2026-01-20 at 3 42 40 PM
  1. Real-time WebSocket updates ensure both users see status change immediately

Changes Made
Core Implementation:

  • Installed @notum-cz/strapi-plugin-record-locking v2.1.0
  • Configured plugin with takeover button enabled (showTakeoverButton: true)
  • Set WebSocket transport for real-time updates (transports: ['websocket'])
  • Updated Content Security Policy to allow WebSocket connections (ws:, wss:)

Files Modified:

  • cms/package.json - Added record-locking dependency
  • cms/config/plugins.ts - Plugin configuration with takeover enabled
  • cms/config/middlewares.ts - WebSocket support in CSP headers

Code Quality:

  • Updated ESLint configuration
  • Applied project-wide code formatting
  • Regenerated TypeScript definitions

Testing Instructions

  1. Setup: Create two admin accounts in Strapi admin panel
  2. Session 1: Open browser with User 1, go to Content Manager
  3. Session 2: Open incognito/private window with User 2, go to same page
  4. Test Lock: User 1 edits any blog post → content becomes locked to them
  5. Test Warning: User 2 tries to edit same post → sees lock warning with User 1's name
  6. Test Takeover: User 2 clicks "Takeover" button → gains edit access, User 1 loses it
  7. Verify Real-time: Both users see lock status change immediately without page refresh

- Install @notum-cz/strapi-plugin-record-locking v2.1.0
- Enable takeover button and websocket transport in plugins config
- Update CSP middleware to support websocket connections
- Regenerate TypeScript definitions after build
- Prevents concurrent editing of content across multiple users
- Relax ESLint rules for development (console, any types, require imports)
- Ignore build artifacts and problematic files from linting
- Remove unused import in FoundationHeader.astro
- Apply Prettier formatting across project
@Infi-Knight Infi-Knight self-assigned this Jan 20, 2026
@Infi-Knight Infi-Knight added the enhancement New feature or request label Jan 20, 2026
@Infi-Knight Infi-Knight marked this pull request as ready for review January 20, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants