Skip to content

Conversation

@seanconrad1
Copy link

@seanconrad1 seanconrad1 commented May 14, 2025

Summary
This PR fixes a bug related to inconsistent parameter usage when retrieving status by slug for single types in a Strapi integration. It aligns backend parameter names with what is sent from the frontend and removes unnecessary logic.

Changes
Renamed parameter from entityDocumentId to entityId in controllers.ts (getStatusBySlug()) and routes.ts (/get-status/:entityId) to match the frontend input.

Removed unused entityDocumentId when closing an entity — we now delete all items by entityId.

Removed unused entityId in getStatusByIdAndSlug() — lookup is handled via entityDocumentId and user.

Notes
No breaking changes or migrations.

No related issues — this was identified while integrating the package into a project.

Testing: Install the package into a Strapi project. The modal should now behave correctly and now pop up when two accounts access the same single type or collection type.

@Dan-Spector-NYO
Copy link

Dan-Spector-NYO commented May 14, 2025

Hey @dominik-juriga @marek-fiala

@seanconrad1 and I were facing an issue where the record locking was not working in single types. This PR fixes that. If you have any questions, please let us know, and thank you in advance!!

@seanconrad1 seanconrad1 changed the title Bug Fix: Entity ID Mismatch in Status Retrievalp unused params Bug Fix: Entity ID Mismatch in Status Retrieval, unused params May 14, 2025
Copy link
Member

@LeonGatt LeonGatt left a comment

Choose a reason for hiding this comment

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

IMHO, it’s solid. Just one small nit regarding code style.
Could you, @dominik-juriga or @martincapek , please double check?

},
});
if (entityDocumentId) {
await strapi.db.query('plugin::record-locking.open-entity').create({
Copy link
Member

Choose a reason for hiding this comment

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

Please change it to not duplicate code

await strapi.db.query("plugin::record-locking.open-entity").create({
  data: {
    user: String(userId),
    entityId,
    entityDocumentId: entityDocumentId,
    connectionId: socket.id,
    ...(entityDocumentId && { entityDocumentType }),
  },
});

@LeonGatt
Copy link
Member

LeonGatt commented Oct 7, 2025

@seanconrad1 and @Dan-Spector-NYO Thanks a lot for helping us fix this open source plugin! And sorry for the late reply.

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