Coder Social home page Coder Social logo

notum-cz / strapi-plugin-record-locking Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 7.0 1.45 MB

This plugin provides the functionality to prevent data loss in cases where multiple users are simultaneously editing the same record within STRAPI v4.

JavaScript 100.00%
record-locking strapi strapi-plugin

strapi-plugin-record-locking's People

Contributors

dependabot[bot] avatar fikoun avatar ihmpavel avatar martincapek avatar moucznik avatar omikulcik avatar ondrej-janosik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

strapi-plugin-record-locking's Issues

Bug: TypeError: Cannot read properties of undefined (reading 'query')

Hi there,

I've stumbled across this type of error while generating the types using npm run strapi ts:generate-types --verbose and I'm not sure if I'm doing something wrong or if is a real bug.

Output:

npm run strapi ts:generate-types --verbose
npm verb cli /.nvm/versions/node/v20.10.0/bin/node /Users/*****/.nvm/versions/node/v20.10.0/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verb title npm run strapi ts:generate-types
npm verb argv "run" "strapi" "ts:generate-types" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/.npm/_logs/2024-02-07T19_34_38_766Z-
npm verb logfile /.npm/_logs/2024-02-07T19_34_38_766Z-debug-0.log

> [email protected] strapi
> strapi ts:generate-types

Starting the compilation for TypeScript files in ***********/************/*********/***
[INFO]  [2024-02-07T19:34:42.749Z] (Typegen) Starting the type generation process
[INFO]  [2024-02-07T19:34:42.749Z] (Typegen) Generating types for contentTypes
(node:76434) Warning: The upload provider "strapi-provider-upload-static-service" doesn't implement the uploadStream function. Strapi will fallback on the upload method. Some performance issues may occur.
(Use `node --trace-warnings ...` to show where the warning was created)
[INFO]  [2024-02-07T19:34:42.971Z] (Typegen) Generating types for components
[INFO]  [2024-02-07T19:34:43.077Z] (Typegen) Saved contentTypes types in ../../../../../types/generated/contentTypes.d.ts
[INFO]  [2024-02-07T19:34:43.077Z] (Typegen) Saved components types in ../../../../../types/generated/components.d.ts
[INFO]  [2024-02-07T19:34:43.077Z] (Typegen) The task completed successfully with 0 warning(s) and 0 error(s) in 0.328s.
/node_modules/@notum-cz/strapi-plugin-record-locking/server/destroy.js:7
  strapi.db.query("plugin::record-locking.open-entity").deleteMany();
            ^

TypeError: Cannot read properties of undefined (reading 'query')
    at module.exports [as destroy] (node_modules/@notum-cz/strapi-plugin-record-locking/server/destroy.js:7:13)
    at Object.destroy (/node_modules/@strapi/strapi/lib/core/domain/module/index.js:54:45)
    at Object.destroy (/node_modules/@strapi/strapi/lib/core/registries/modules.js:38:19)
    at async Strapi.runLifecyclesFunctions (/node_modules/@strapi/strapi/lib/Strapi.js:546:5)
    at async Strapi.destroy (/node_modules/@strapi/strapi/lib/Strapi.js:231:5)

Node.js v20.10.0
npm verb exit 1
npm verb code 1

I'm using the following dependencies

  • @notum-cz/strapi-plugin-record-locking version 1.6.6
  • typescript version 4.9.5
  • @strapi/strapi version 4.10.5
  • @strapi/utils version 4.9.0

Let me know if you need more information

Thank you

Bug, Socket keeps returning 400

In dev environment the plugin works well but on production env socket keeps retrying connection and it returns 400 with message "Unknown session ID"

Zrzut ekranu 2022-06-13 o 11 25 09

Record lock even when the content manager has left the page

Record lock even when the content manager has left the page ( go back, close tab/browser)

steps to reproduce:
1 open any entry
2 close tab
3 open another browser/incognito window
4 login under another account
5 open the same record

Strapi Version: 4.10.2
Node/Yarn Version: yarn/1.22.11 npm/? node/v18.16.0 darwin x64
Edition: Community
Database: postgres
"@notum-cz/strapi-plugin-record-locking": "^0.3.3"

Bug:Screen whiteout after record lock.

Hi!
Thanks for the nice plugin!

I have tried record locking with two admin users.
The user who edited later was indeed unable to edit, but that was because the screen was whiteed out and an error was output to the console

Since a record was created in "record-locking_open-entity" for an exclusivity check, there may be a problem on the "admin panel" source side.

│ Environment        │ development                                      │
│ Process PID        │ 70604                                            │
│ Version            │ 4.1.12 (node v16.14.0)                           │
│ Edition            │ Enterprise                         

Content_Manager

.

Plan to increase dependencies?

Great plugin - thanks for doing this!

I saw there were dependabot PRs, but there are other out-of-date/insecure dependencies as well. Is there a plan to do an upgrade cycle soon and push a release? how can the community help?

Question: Can the plugin store the state in redis?

I assume that at the moment the socket connection state lies inside the application. This is a problem for my project, because my application is on different replicas at the same time and because of this, sockets cannot establish the correct connection. Is such an opportunity planned?

English translation suggestion

Since we started using this more, had one suggestion for a translation for the English - change This entry is currently edited by {username} to This entry is currently being edited by {username} (i.e. adding being)

Put a PR in at #84

Having plugin installed breaks `npm run strapi report`

Example results here:

> strapi report

Launched In: 859 ms
Environment: development
OS: darwin-arm64
Strapi Version: 4.22.0
Node/Yarn Version: npm/10.5.1 node/v20.12.1 darwin arm64 workspaces/false
Edition: Community
Database: mysql2
TypeError: Cannot read properties of undefined (reading 'query')
    at module.exports [as destroy] (/Users/REDACTED/REDACTED/REDACTED/node_modules/@notum-cz/strapi-plugin-record-locking/server/destroy.js:7:13)
    at Object.destroy (/Users/REDACTED/REDACTED/REDACTED/node_modules/@strapi/strapi/dist/core/domain/module/index.js:53:45)
    at Object.destroy (/Users/REDACTED/REDACTED/REDACTED/node_modules/@strapi/strapi/dist/core/registries/modules.js:33:19)
    at async Strapi.runLifecyclesFunctions (/Users/REDACTED/REDACTED/REDACTED/node_modules/@strapi/strapi/dist/Strapi.js:440:5)
    at async Strapi.destroy (/Users/REDACTED/REDACTED/REDACTED/node_modules/@strapi/strapi/dist/Strapi.js:226:5)
    at async action (/Users/REDACTED/REDACTED/REDACTED/node_modules/@strapi/strapi/dist/commands/actions/report/action.js:26:3)

Enabling Record Locking Blocks Access to Single Types

Bug report

Required System information

  • Node.js version: 14.19.3
  • NPM version: 8.10.0
  • Strapi version: 4.2.0 (also happens in 4.1.11)
  • Database: Postgres via Amazon RDS
  • Operating system: Ubuntu 20.04

Package dependencies and plugins:

"dependencies": {
    "@babel/core": "^7.18.0",
    "@notum-cz/strapi-plugin-record-locking": "^0.2.4",
    "@strapi/admin": "^4.2.0",
    "@strapi/database": "^4.2.0",
    "@strapi/helper-plugin": "^4.2.0",
    "@strapi/plugin-content-manager": "^4.2.0",
    "@strapi/plugin-content-type-builder": "^4.2.0",
    "@strapi/plugin-documentation": "^4.2.0",
    "@strapi/plugin-email": "^4.2.0",
    "@strapi/plugin-graphql": "^4.2.0",
    "@strapi/plugin-i18n": "4.2.0",
    "@strapi/plugin-sentry": "^4.2.0",
    "@strapi/plugin-seo": "^1.7.3",
    "@strapi/plugin-upload": "^4.2.0",
    "@strapi/plugin-users-permissions": "^4.2.0",
    "@strapi/provider-upload-aws-s3": "^4.2.0",
    "@strapi/provider-upload-local": "^4.2.0",
    "@strapi/strapi": "4.2.0",
    "@strapi/utils": "^4.2.0",
    "css-loader": "^6.7.1",
    "knex": "^0.21.21",
    "objection": "^2.2.18",
    "pg": "8.7.1",
    "strapi-plugin-email-designer": "^2.1.1",
    "strapi-plugin-import-export-entries": "^1.4.1",
    "strapi-plugin-notes": "^1.0.1",
    "strapi-plugin-publisher": "^1.1.3",
    "strapi-plugin-react-editorjs": "^2.0.1",
    "strapi-provider-upload-aws-s3": "4.2.0",
    "style-loader": "^3.3.1",
    "webpack": "^5.72.1"
  },

Describe the bug

Single Types do not load in the admin panel Content Manager. I have tested this with and without internationalization, with and without React Dev Tools active on the site, and running the server in develop and production modes.

Steps to reproduce the behavior

  1. Create a Single Type in the Content-Type Builder. Does not matter what fields are present even a simple short text box is fine.
  2. Save and go to the Content Manager.
  3. Click on the Single Type to make an entry.
  4. Experience white screen of death and cry.

Expected behavior

The Single Type edit page should load and allow entries added.

Screenshots

This screenshot shows the exact error shown in Chrome Dev Tools
image

This screenshot shows the API requests for the single type comes back successful.
image

Here are the permissions set for Single Types in our server:
image

Additional context

Note that Strapi can successfully retrieve all relevant information via API requests to Single Types still. This appears to solely be a bug related to how the record locking plugin interacts with rendering the Strapi frontend.

Upgrading to Strapi v 4.2.0 nor returning to original v 4.1.11 resolved the issue.

I am confident that the record locking plugin is the culprit as removing the plugin immediately restores access to Single Types.

Cannot open detail/create of Content Types when version 1.3.0 is installed

When i updated version from 0.3.0 to 1.3.0 i cannot open any existing content-type or create new one. I have this errors in console.

Current version of strapi 4.14.0
Node Version: 18

Steps to reproduce the behavior

  1. Go to 'Content Manager'
  2. Click on 'Any existing entity or try to create new'
  3. See error

Snímek obrazovky 2024-02-27 v 12 24 49
Snímek obrazovky 2024-02-27 v 12 24 43

Takeover button

In certain situations, it may be necessary to allow users to continue editing content. For example when another user unintentionally leaves the editor open in one browser tab while working on something else in a different tab, thus forgetting about the open editor. To address such scenarios, it is advisable to implement a "Takeover" button.

Additionally, it is crucial to conduct role-based checks to ensure so roles with lower access can not overtake for example super admin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.