Skip to content

Comments

Jm/strapi 2 customclasses#193

Draft
JonathanMatthey wants to merge 213 commits intomainfrom
jm/strapi_2_customclasses
Draft

Jm/strapi 2 customclasses#193
JonathanMatthey wants to merge 213 commits intomainfrom
jm/strapi_2_customclasses

Conversation

@JonathanMatthey
Copy link
Contributor

PR Checklist

  • 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

strapi and others added 28 commits December 12, 2025 10:18
- [x] Linked issue added (e.g., `Fixes #123`)
- [x] I have run `bun run format` to ensure code is properly formatted
- [x] 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]"
<img width="914" height="289" alt="Screenshot 2026-01-20 at 3 42 10 PM"
src="https://github.com/user-attachments/assets/4f3d8930-700d-4643-9952-72400208eab9"
/>

4. "Takeover" button appears next to warning
5. User B clicks takeover → lock transfers from User A to User B
6. User A receives notification that they lost edit access

<img width="932" height="287" alt="Screenshot 2026-01-20 at 3 42 40 PM"
src="https://github.com/user-attachments/assets/ee5e9878-9162-4b3a-86be-b30ec4524551"
/>

8. 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
9. **Verify Real-time**: Both users see lock status change immediately
without page refresh

---------

Co-authored-by: Jonathan Matthey <mattheyj@gmail.com>
@netlify
Copy link

netlify bot commented Jan 27, 2026

Deploy Preview for developers-preview ready!

Name Link
🔨 Latest commit 26a5558
🔍 Latest deploy log https://app.netlify.com/projects/developers-preview/deploys/6978bc9ede556200071ff596
😎 Deploy Preview https://deploy-preview-193--developers-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…stomclasses

# Conflicts:
#	cms/src/admin/app.tsx
#	cms/src/api/blog-post/content-types/blog-post/lifecycles.ts
#	cms/src/index.ts
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