Git Product home page Git Product logo

strapi-plugin-content-versioning's People

Contributors

abidfs avatar alexzhangreslv avatar aplavsa avatar ayhankerim avatar camiblanch avatar cedrtang avatar cliarena avatar daynnnnn avatar dependabot[bot] avatar eskeminha avatar fikoun avatar harrycarp avatar jesperwe avatar jonwangm avatar joshuaalzate avatar markhughes avatar martincapek avatar moucznik avatar omikulcik avatar ondrej-janosik avatar ridoo avatar rzdev avatar vlivanov avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

strapi-plugin-content-versioning's Issues

The latest patch for 4.5.0 cannot be applied to Strapi 4.5.4

Bug report

The latest patch file in the repository @strapi+admin+4.5.0.patch fails with an error when running patch-package on Strapi 4.5.4.

Steps to reproduce the behavior

  1. Install Strapi 4.5.4.
  2. Add the patch file for 4.5.0 to patches/.
  3. Run patch-package.

Expected behavior

Patch is applied without any errors or warnings.

Actual behavior

$ patch-package
patch-package 6.5.0
Applying patches...

**ERROR** Failed to apply patch for package @strapi/admin at path
  
    node_modules/@strapi/admin

  This error was caused because patch-package cannot apply the following patch file:

    patches/@strapi+admin+4.5.4.patch

  Try removing node_modules and trying again. If that doesn't work, maybe there was
  an accidental change made to the patch file? Try recreating it by manually
  editing the appropriate files and running:
  
    patch-package @strapi/admin
  
  If that doesn't work, then it's a bug in patch-package, so please submit a bug
  report. Thanks!

    https://github.com/ds300/patch-package/issues
    

---
patch-package finished with 1 error(s).

System

  • Node.js version: v16
  • Strapi version: 4.5.4

Additional context

Downgrading to Strapi 4.5.3 allows to run the patch without any errors.

Missing 'moment' dependency as of Strapi v4.3.0

Bug report

Describe the bug

When running npm install on a project with this plugin and strapi v4.3.0+, I receive the following Error:

ModuleNotFoundError: Module not found: Error: Can't resolve 'moment' in '/opt/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions'

Steps to reproduce the behavior

  1. Have a strapi app with this plugin and strapi version 4.3.0
  2. Run npm i
  3. See error

Expected behavior

Strapi app should install successfully.

System

  • Node.js version: v14
  • NPM version: v6
  • Strapi version: v4.3.2
  • Database: MySQL v5.7.38
  • Operating system: Windows 10

Additional context

It seems like strapi removed their 'moment' dependency as of PR #13728.

I create patch for @strapi+admin+4.9.0.patch

This is patch for Strapi 4.9.0. Feel free to use

diff --git a/node_modules/@strapi/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js b/node_modules/@strapi/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js

--- a/node_modules/@strapi/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js

+++ b/node_modules/@strapi/admin/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js

@@ -247,9 +247,15 @@

replace(redirectionLink);

}, [redirectionLink, replace]);

+ const currentContentTypeLayout = get(allLayoutData, ['contentType'], {});

+

+ const hasVersions = useMemo(() => {

+ return get(currentContentTypeLayout, ['pluginOptions', 'versions', 'versioned'], false);

+ }, [currentContentTypeLayout]);

+

const onPost = useCallback(

async (body, trackerProperty) => {

- const endPoint = `${getRequestUrl(`collection-types/${slug}`)}${rawQuery}`;

+ const endPoint = hasVersions ? `/content-versioning/${slug}/save` : `${getRequestUrl(`collection-types/${slug}`)}${rawQuery}`;

try {

// Show a loading button in the EditView/Header.js && lock the app => no navigation

@@ -269,7 +275,13 @@

// Enable navigation and remove loaders

dispatch(setStatus('resolved'));

- replace(`/content-manager/collectionType/${slug}/${data.id}${rawQuery}`);

+ if (hasVersions) {

+ replace({

+ pathname: `/content-manager/collectionType/${slug}/${data.id}`,

+ });

+ } else {

+ replace(`/content-manager/collectionType/${slug}/${data.id}${rawQuery}`);

+ }

return Promise.resolve(data);

} catch (err) {

@@ -322,14 +334,14 @@

const onPut = useCallback(

async (body, trackerProperty) => {

- const endPoint = getRequestUrl(`collection-types/${slug}/${id}`);

+ const endPoint = hasVersions ? `/content-versioning/${slug}/save` : getRequestUrl(`collection-types/${slug}/${id}`);

try {

trackUsageRef.current('willEditEntry', trackerProperty);

dispatch(setStatus('submit-pending'));

- const { data } = await axiosInstance.put(endPoint, body);

+ const { data } = hasVersions ? await axiosInstance.post(endPoint, body) : await axiosInstance.put(endPoint, body);

trackUsageRef.current('didEditEntry', { trackerProperty });

toggleNotification({

@@ -341,6 +353,12 @@

dispatch(setStatus('resolved'));

+ if (hasVersions) {

+ replace({

+ pathname: `/content-manager/collectionType/${slug}/${data.id}`,

+ });

+ }

+

return Promise.resolve(data);

} catch (err) {

trackUsageRef.current('didNotEditEntry', { error: err, trackerProperty });

diff --git a/node_modules/@strapi/admin/admin/src/content-manager/components/EditViewDataManagerProvider/index.js b/node_modules/@strapi/admin/admin/src/content-manager/components/EditViewDataManagerProvider/index.js

--- a/node_modules/@strapi/admin/admin/src/content-manager/components/EditViewDataManagerProvider/index.js

+++ b/node_modules/@strapi/admin/admin/src/content-manager/components/EditViewDataManagerProvider/index.js

@@ -56,6 +56,10 @@

return get(currentContentTypeLayout, ['options', 'draftAndPublish'], false);

}, [currentContentTypeLayout]);

+ const hasVersions = useMemo(() => {

+ return get(currentContentTypeLayout, ['pluginOptions', 'versions', 'versioned'], false);

+ }, [currentContentTypeLayout]);

+

const shouldNotRunValidations = useMemo(() => {

return hasDraftAndPublish && !initialData.publishedAt;

}, [hasDraftAndPublish, initialData.publishedAt]);

@@ -515,7 +519,7 @@

) : (

<>

<Prompt

- when={!isEqual(modifiedData, initialData)}

+ when={!hasVersions && !isEqual(modifiedData, initialData)}

message={formatMessage({ id: 'global.prompt.unsaved' })}

/>

<form noValidate onSubmit={handleSubmit}>

Not working with strapi v4.6.2

Bug report

This plugin does not work when updating to strapi v4.6.2

Describe the bug

After updating to strapi v4.6.2 publishing content doesn't work. When I click 'Publish' it saves a new blank version of the content and the original content is still in draft.

This might be due to the fact that axiosInstance has now been deprecated..?

Steps to reproduce the behavior

  1. Update strapi to v4.6.2
  2. Either create some new content or edit existing content which is version controlled
  3. Click 'Save', everything works as expected
  4. Click 'Publish' a blank new item of content is created
  5. Navigate back to the content dashboard and you'll see the original content we were trying publish remains in draft, and additional a new blank item of content is created which is also in draft

Expected behavior

The original content is published

Internationalized content

Bug report

Describe the bug

The plugin does not work well with internationalized content.

Steps to reproduce the behavior

  1. Create a Collection type (eg: LandingPage)
  2. Enable i18n for it
  3. Translate the content of a entry (LandingPage)
  4. Install the plugin and enable it
  5. Navigate to the listing of landing pages
  6. You can't see your entry

Expected behavior

I should be able to see the entry I created. Also noticed one bug if I create a new entry and add a translation for it, then the publish button will unpublish the English version (initial translation)

System

  • Node.js version: v16.14.0
  • NPM version:6.14.16
  • Strapi version: v4
  • Database: filebased (default)
  • Operating system: Linux pop-os 5.15.15-76051515-generic

Additional context

Fill in from another locale is also not working correctly. I'm guessing the internationalization part does not play well with the versioning schema.

Redirecting to latest version

Description

Hey guys, really love your package. Still a bit of a ways to got but getting there. I was trying to implement my own redirects, as currently, the shown version displays the Published page, I was trying to set it so when a versioned type is clicked in Content Manager. it would display the most recent version by forcing a redirect, which is how most of our CMS's work.

Is there any way you could recommend how I approach this?

Code snippets

So, I made some middleware that does almost exactly what I want. Only problem is when you redirect within selecting a react link it doesn't do a proper redirect. It will just replace the content of what is in the text fields, which works.... until you select publish. here's the middleware code.

module.exports = (config, {strapi}) => {
  return async (ctx, next) => {
    if (ctx.url.includes('/content-manager/single-types')) {
      const dataVersions = ctx.response.body.versions;
      if (dataVersions && dataVersions.length > 1) {
        let newestVersion;
        dataVersions.forEach(version => {
          if (!newestVersion || newestVersion.versionNumber < version.versionNumber) {
            newestVersion = version;
          }
        });
        ctx.redirect('/admin/content-manager/collectionType/api::about-content.about-content/' + newestVersion.id);
      }
    }
  }
};

Any other suggestions or recommendations are welcome

Content-Versioning Not Working Properly with Strapi v4.3.2

Bug report

Describe the bug

Content-versioning behave abnormal with Strapi v4.3.2

Steps to reproduce the behavior

Step 1: - Create a Content and save.
Step 2: - Modify some changes in content and save as new version.
Step 3: - You will get a an alert prompt that you will lost your changes.
Step 4: - Reload the page and then you will get your new version content in the dropdown.

Expected behavior

Rather than It should prompt a green message that you have successfully made your changes. Previously it was working with strapi v4.0.3

Screenshots

issue
Screenshot from 2022-08-16 18-10-41

Code snippets

Plugin Configuration

    "content-versioning": {
        enabled: true,
    },

System

  • Node.js version: v14.18.1
  • NPM version: 8.3.0
  • Strapi version: 4.3.2
  • Database: Mysql
  • Operating system: Ubuntu

Any attempts to version media files?

I would like to have versioning on uploaded files. I hope to get an idea if using/extending this plugin would be a reasonable approach.

The upload plugin adds a file content-type. I would like this plugin to version it in a way similar to normal content-types. However, there is more to this plugin than just incrementing a version:

  • The media-library would have to provide plugin components (e.g. version selector) to be injected
  • To my current understanding versioning relies on the draft/publish capabilities of a content-type

I did not dig into the draft/publish workflow yet, but the file content-type does not provide draft/publish state. Also, there are no injection zones in the media-library component to add a version selector or "save as new version" button. I start to think if extending this plugin to enable file versioning is as straight forward I thought of in the beginning.

Do you have had any plans already to version uploaded files? If so, I am pretty sure, you will have a more comprehensive idea what would be needed and what is required to do to make this work.

Any thoughts/guides/alternatives on that?

Error Validation is not working properly

Hi,
Please help us,
As as strapi admin i want to create multiple version of the content using strapi content versioning.When i save a content as new version the API is directly called and throws if there any error in prompt Message component.But the native save button will validates and shows the error in the input fields instantly.

Steps to reproduce the behavior
1.Open content Manager
2.Select any collection type and click editany content.
3.click save a a new version "Button".
4.You will receive Error prompt message instant of showing the message in the input field.
5.If you click regular save button the validation message is shown in the input field itself.

Expected behavior

Image 10-05-23 at 5 17 PM

Current behavior

Image 10-05-23 at 5 19 PM

System

  • Node.js version: 14.19.1
  • NPM version:9.2.0
  • Strapi version: 4.9.1
  • Database: postgres
  • Operating system: Mac Os

Webhook publish-trigger provides unpublished entry

Bug report

Describe the bug

I'm using next.js on the frontend of my service, and for my On-demand Incremental Static Regeneration I'm using Strapi's webhooks so I can rebuild certain paths on-demand whenever their Strapi instance changes.

When I save and publish a content entry it usually triggers the event "update" with the updated object, and right after it, the event "publish" with the updated object again. So far so good, these triggers are what I would expect from this kind of action.

However, when I've just saved a new version of the entry and hit "publish", I get both events (update & publish), but the object which is attached to the publish-event has isVisibleInListView: false and publishedAt: null.
The update-event's object is triggered with a published version, but since it is triggered before the publish-event; it is overwritten and the newly published version is instantly removed from my build.

Do you have any idea why this happens? Why is the publish-event's object not published?

Steps to reproduce the behavior

  1. Setup a Strapi webhook which listens to all events
  2. Add some logs of the webhook's body on the receiving API part.
  3. Trigger the webhook by updating an entry and publishing it. Observe that you get two triggers, both of which reflect the actual publish state of the entry.
  4. Save a new version of the entry, and publish this new version. Observe that you again get two triggers, but the event-trigger's body.entry doesn't reflect the publish state of the actual Strapi entry.

Expected behavior

I would expect the publish-trigger to include a published entry, not an unpublished one.

System

  • Node.js version: 16.18.1
  • NPM version: 8.19.2
  • Strapi version: 4.6.0
  • Database: Postgres
  • Operating system: OSX
  • Content versioning version: ^0.4.7 (and 1.0.0-beta.0)

Is there a way to access the version data from the api?

We are trying to implement a preview button for the latest version. We's love to be able to access the data of the versions from the api. For example,

localhost:1337/articles?versions=all

And this would return all of the versions? Does something like this exist?

The latest patch for 4.5.4 cannot be applied to Strapi 4.6.0

Bug report

The latest patch file in the repository @strapi+admin+4.5.4.patch fails with an error when running patch-package on Strapi 4.6.0.

Steps to reproduce the behavior

  1. Install Strapi 4.6.0.
  2. Add the patch file for 4.5.4 to patches/.
  3. Run patch-package.

Expected behavior

Patch is applied without any errors or warnings.

Actual behavior

$ patch-package
patch-package 6.5.0
Applying patches...

**ERROR** Failed to apply patch for package @strapi/admin at path
  
    node_modules/@strapi/admin

  This error was caused because patch-package cannot apply the following patch file:

    patches/@strapi+admin+4.5.4.patch

  Try removing node_modules and trying again. If that doesn't work, maybe there was
  an accidental change made to the patch file? Try recreating it by manually
  editing the appropriate files and running:
  
    patch-package @strapi/admin
  
  If that doesn't work, then it's a bug in patch-package, so please submit a bug
  report. Thanks!

    https://github.com/ds300/patch-package/issues
    

---
patch-package finished with 1 error(s).

System

  • Node.js version: v16
  • Strapi version: 4.6.0

Additional context

Downgrading to Strapi 4.5.6 allows to run the patch without any errors.

Loading error with ckeditor

Hi,

I have a problem on Ckeditor content while switching version.
I created a content type with a text field and a ckeditor field. When I switch version using the selector "Change to version", the new version page is loaded, the text field is ok, but the ckeditor field keeps the old version content. I have to manually reload the page to find back the content of the current version in the ckeditor field.

I have not the problem on localhost but on the strapi production server.

Do yo guys have any idea ?
thanks

System

  • Node.js version: v14
  • NPM version:
  • Strapi version: v4.10
  • Database:
  • Operating system:

relation-dropdown lists all the versions instead of just the latest ones

Describe the bug

When a collection (A) has a relation to versioned collection (B) the dropdown in the edit view lists all the entries of collection (B) instead of just the latest ones. In other words: the relation-dropdown doesn't respect the "is_visible_in_list_view"-flag.

Steps to reproduce the behavior

  1. Create a collection (B) and turn versioning on.
  2. Create a few entries into collection B and create a few versions of each entry
  3. Create another collection (A) and add a relation to collection (B).
  4. Create an entry for collection (A) and open the collection (B) relation dropdown
  5. All the versions of every entry are in the dropdown and not just the latest ones.

Expected behavior

Only the latest versions of every entry of collection (B) should appear in the dropdown.

System

  • Node.js version: v14.18.3
  • NPM version: 6.14.15
  • Strapi version: 4.15.
  • Database: MySQL
  • Operating system: MacOS

Create new versioned content through API

Hello,
I am trying to create a new version of a resource through the API without success.
Screenshot 2022-10-13 at 14 39 28

I tried to PUT the same resource incrementing the versionNumber and passing the same vuid but the exact same resource got updated.
I also tried to POST the same resource content, still passing versionNumber and the same vuid but using the endpoint /:slug/:resourceId (the resourceId is the strapi integer id) as I see from the source code but I got 405 Method Not Allowed.

Where Am I doing wrong?
On the permission level, the token that I use got the full permission to play that slug property.

Recent changes break the plugin if using non-Postgres db

Bug report

Describe the bug

A recent fix for making this plugin compatible with localization #47 provided by @Fikoun includes multiple instances of SELECT DISTINCT ON, which is a Postgres-specific query that does NOT work with other databases like MySQL.

Our project is using MySQL, so these queries are considered syntactically invalid and cause fatal errors whenever they are triggered (e.g. when updating an entry).

Although the queries would become more verbose, it would be ideal to replace them with non-db-specific ones (and also avoid introducing db-specific queries in the future) so that devs are not limited to using a specific db like Postgres for their Strapi project if they want to use this plugin.

Steps to reproduce the behavior

  1. Use plugin version 1.0.0-beta.0 to apply the recent changes
  2. Create a new content type with versioning and internationalization enabled
  3. Create a new entry of this type and save (this works)
  4. Update the entry and click "Save" or "Save as a new version".
  5. Saving fails, with error along the lines of error: SELECT DISTINCT ON (locale) id, version_number, published_at, locale FROM tests WHERE vuid='88b6e1e7-c360-4a24-b1e3-5460493b1c3c' ORDER BY locale, published_at DESC NULLS LAST, version_number DESC - near "ON": syntax error

Expected behavior

The updated entry is successfully saved, whether in the current version or in a new version.

Code snippets

Instances of SELECT DISTINCT ON added in #47: 1 2 3

System

  • Node.js version: 14.20.0
  • NPM version: 8.18.0
  • Strapi version: 4.6.0
  • Database: MySQL
  • Operating system:

TypeError: uuid is not a function when creating content

Bug report

When trying to create any content type, we are getting a 500 error and when digging into it locally the error we are getting looks like this

Describe the bug

error: uuid is not a function
TypeError: uuid is not a function
    at Object.beforeCreate (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/server/services/lifecycles/beforeCreate.js:9:30)
    at Object.beforeCreate (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/server/bootstrap.js:54:34)
    at Object.run (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/database/lib/lifecycles/index.js:57:35)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/database/lib/entity-manager.js:158:7)
    at async Object.create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/services/entity-service/index.js:172:18)
    at async Object.<anonymous> (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/services/entity-service/index.js:67:20)
    at async Object.create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/plugin-i18n/server/services/entity-service-decorator.js:117:19)
    at async Object.create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/plugin-content-manager/server/controllers/collection-types.js:85:20)
    at async returnBodyMiddleware (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async module.exports (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/plugin-content-manager/server/middlewares/routing.js:39:3)
    at async policiesMiddleware (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/middlewares/body.js:25:7
    at async /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/middlewares/logger.js:22:5
    at async /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5

Steps to reproduce the behavior

On the latest version of the plugin, try to create any content item.

Expected behavior

Content saves as expected.

Screenshots

If applicable, add screenshots to help explain your problem.

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version: v14
  • NPM version: 6.14.16
  • Strapi version: 4.1.7
  • Database: mysql
  • Operating system: alpine linux

Additional context

removing plugin and creating content works as expected

latest version of content versioning does not work with strapi 4.1.5

Bug report

Build fails with publisher plugin enabled on latest strapi version 4.1.5

Describe the bug

npm run build --clean

build fails with this error

ModuleNotFoundError: Module not found: Error: Can't resolve '@strapi/design-system/Text' in '/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions' at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/Compilation.js:2011:28 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:795:13 at eval (eval at create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1) at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:275:22 at eval (eval at create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1) at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:431:22 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:124:11 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:667:25 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:852:8 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:972:5 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/neo-async/async.js:6883:13 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:955:45 at finishWithoutResolve (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/enhanced-resolve/lib/Resolver.js:312:11) at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/enhanced-resolve/lib/Resolver.js:386:15 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/enhanced-resolve/lib/Resolver.js:435:5 at eval (eval at create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1) resolve '@strapi/design-system/Text' in '/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions' Parsed request is a module using description file: /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/package.json (relative path: ./admin/src/components/Versions) Field 'browser' doesn't contain a valid alias configuration resolve as module /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/node_modules doesn't exist or is not a directory looking for modules in /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/node_modules /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/node_modules/@strapi/design-system doesn't exist /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/node_modules doesn't exist or is not a directory looking for modules in /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules existing directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system using description file: /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/package.json (relative path: .) using description file: /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/package.json (relative path: ./Text) no extension Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text.jsx doesn't exist .react.js Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text.react.js doesn't exist as directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text doesn't exist /Users/jordanschinella/Sites/connectedfitness/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/node_modules doesn't exist or is not a directory /Users/jordanschinella/node_modules doesn't exist or is not a directory /Users/node_modules doesn't exist or is not a directory /node_modules doesn't exist or is not a directory looking for modules in /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/admin/node_modules /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/admin/node_modules/@strapi/design-system doesn't exist ModuleNotFoundError: Module not found: Error: Can't resolve '@strapi/design-system/Text' in '/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions' at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/Compilation.js:2011:28 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:795:13 at eval (eval at create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1) at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:275:22 at eval (eval at create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1) at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:431:22 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:124:11 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:667:25 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:852:8 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:972:5 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/neo-async/async.js:6883:13 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/webpack/lib/NormalModuleFactory.js:955:45 at finishWithoutResolve (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/enhanced-resolve/lib/Resolver.js:312:11) at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/enhanced-resolve/lib/Resolver.js:386:15 at /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/enhanced-resolve/lib/Resolver.js:435:5 at eval (eval at create (/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1) resolve '@strapi/design-system/Text' in '/Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions' Parsed request is a module using description file: /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/package.json (relative path: ./admin/src/components/Versions) Field 'browser' doesn't contain a valid alias configuration resolve as module /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/Versions/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/components/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/src/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/admin/node_modules doesn't exist or is not a directory looking for modules in /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/node_modules /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/strapi-plugin-content-versioning/node_modules/@strapi/design-system doesn't exist /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@notum-cz/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/node_modules doesn't exist or is not a directory looking for modules in /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules existing directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system using description file: /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/package.json (relative path: .) using description file: /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/package.json (relative path: ./Text) no extension Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text.jsx doesn't exist .react.js Field 'browser' doesn't contain a valid alias configuration /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text.react.js doesn't exist as directory /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/design-system/Text doesn't exist /Users/jordanschinella/Sites/connectedfitness/node_modules doesn't exist or is not a directory /Users/jordanschinella/Sites/node_modules doesn't exist or is not a directory /Users/jordanschinella/node_modules doesn't exist or is not a directory /Users/node_modules doesn't exist or is not a directory /node_modules doesn't exist or is not a directory looking for modules in /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/admin/node_modules /Users/jordanschinella/Sites/connectedfitness/connectedfitness-v2/node_modules/@strapi/admin/node_modules/@strapi/design-system doesn't exist npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build: strapi build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jordanschinella/.npm/_logs/2022-03-18T15_24_23_631Z-debug.log`

A clear and concise description of what the bug is.

Steps to reproduce the behavior

npm run build --clean

Expected behavior

build completes successfully

System

  • Node.js version: v14 or v16
  • NPM version: 6.0.0
  • Strapi version: 4.1.5
  • Database: mysql
  • Operating system: alpine based container also fails with debian based container

Deactivating and Activating the plugin causes corruption in the database

Bug report

Describe the bug

I have an issue regarding the way the plugin version the entities with its internal identifier. I was testing it in some branch, and I change to other branch where the plugin was not activated yet because it was in a older version of the project.I found that the entities that where versioned were now in the admin panel like 'normal' entities. I changed again to the branch with the plugin (with the enabled: true attribute inside the plugin.js) and now the entities that were versioned are not acting like versioned anymore. I check the database and the vuid that seems to identify the group of entities is empty so there is no way to identify those entities that were versioned before.

Steps to reproduce the behavior

To reproduce the error:

  1. Go to the plugin.js of your project and deactivate the plugin
  2. Reload Strapi
  3. Check that the entities that where versioned before are not versioned anymore.
  4. Activate the plugin again.

Expected behavior

It should maintain the previous state of the application in case you accidentally change to some branch or part of your project that does not have the plugin yet or you deactivated for some reason.

image

In the picture, the ones with vuid are currently working and were added after I deactivated/activated the plugin. The ones that don't have vuid are added before I deactivated/activated the plugin.

System

  • Node.js version: 16.19.0
  • NPM version: 8.19.3
  • Strapi version: 4.6.1
  • Database: MariaDB
  • Operating system: MacOs Ventura 13.0.1

A few comments from alpha-testing

Bug report

Describe the bug

Hello! I hope you don't mind an issue for this not yet released plugin. Consider it an Alpha QA report :-)
I am very keen on this project, so I have done a bit of testing and just wanted to let you know the experience.

Observations for plugin v0.1.4

  1. When saving new versions the created_by_id and updated_by_id columns in DB are not set.
  2. The patch file references the Sentry plugin. So it needs to be installed. Mention in readme?
  3. The line "postinstall": "patch-package", is needed in package.json. Mention in readme?

System

  • Node.js version: v16
  • Strapi version: v4.0.6
  • Database: Postgres
  • Operating system: MacOS

Plugin does not work with db schemas other than "public"

Bug report

Describe the bug

If Strapi is using postgres db schema other than the default public or the one named the same as the db user e.g. DB_USERNAME=strapi SCHEMA_NAME=strapi, it fails in places where custom SQL queries are written, e.g. beforeUpdate.js lifecycle hook or beforeDelete.js hook.

Steps to reproduce the behavior

  1. Setup Strapi to use db schema other than 'public'
  2. Go to any versioned and localized content type
  3. Click on 'Delete Entry' or try to update and publish versioned content!
  4. An error occurs

Expected behavior

User should be able to delete or update/publish versioned entry

Code snippets

 // Relink logic for localizations
  if (isLocalized) {
    const latestInLocales = (await strapi.db.connection.raw(
      `SELECT DISTINCT ON (locale) id, locale, version_number, published_at FROM ${collectionName} // missing schema name
        WHERE vuid='${item.vuid}' AND id!='${item.id}' 
        ORDER BY locale, published_at DESC NULLS LAST, version_number DESC`

same applies for beforeUpdate.js

System

  • Node.js version: 16.8.1
  • NPM version: 8.19.2
  • Strapi version: 4.5.6
  • Database: postgresql
  • Operating system: Linux

Content duplication does not work with the versioning plugin in Strapi 4.5.3

Bug report

When attempting to duplicate item in the content manager, the new saved entry is treated as another version of an existing item instead of a separate item.

Steps to reproduce the behavior

  1. Go to the content manager.
  2. Enter an item list.
  3. Click on the "Duplicate item line" button within the list.
  4. Save entry.

Expected behavior

A new item is created with the data from the duplicated item.

Actual behavior

The data is saved as a new version of the duplicated item.

System

  • Node.js version: v16
  • Strapi version: 4.5.3
  • Database: PostgreSQL 15.1
  • Operating system: Debian (via Docker)

Additional context

  • The duplicated items have nested component types.
  • Localization is turned on.
  • Patch for 4.5.0 is used.

content-versioning plugin ain't working in prod

I have been trying to work with content versioning plugin for so long but even after installing the plugin and enabling it in the plugins.js it is not working or not showing any changes in content-type as before creating the collection-type or single-type we have to enable content-versioning just like i18n but that option is not available there, but when I open up the watch-admin mode I get to see that enable content versioning option and it is working fine in watch-admin mode.

Save new version triggers the global.prompt.unsaved message.

Steps to reproduce the behavior

  1. Go to Content manager, open an item of a versioned content type
  2. Make a change
  3. Click "Save new version"
  4. Get "Are you sure you want to leave this page? All your modifications will be lost" popup

Expected behavior

"Saved" message shown, no "Are you sure..." shown.

System

  • Strapi version: 4.1.7

All the versions are visible in the collection list view (Strapi V 4.8.2)

Bug report

Describe the bug

All the versions are visible in collection list view.
In other words rows with "isVisibleInListView: false" are visible in the collection list view

The bug occurred after I updated to Strapi from 4.4.5 to 4.8.2
I also reproduce the bug on a fresh Strapi 4.8.2 installation

Steps to reproduce the behavior

  1. Install the plugin on Strapi v4.8.2
  2. Create collection type
  3. Create new entry
  4. Save as a new version
  5. Back to collection list view

Expected behavior

Only "the main" version of each entry should be visible in the collection list view
In other words only rows with "isVisibleInListView: true" should be visible in the collection list view

System

  • Node.js version: 14.19.1
  • NPM version: 6.14.16
  • Strapi version: 4.8.2
  • Database: mySQL
  • Operating system: MacOS 11.4

Additional context

It used to work for me on Strapi v4.4.5

Versioning of Content types with Unique field

Bug report

Describe the bug

If a content type has a field declared as "Unique Field" in the Content type builder, saving new versions after the initial v1 fails with

Validation Error: This field must be unique

System

  • Node.js version: v16
  • Plugin version: 0.2.1
  • Strapi version: 4.0.7
  • Database: Postgres v12

When create new Content-Type include number, table name will be split with "_"

Bug report

Describe the bug

When create new Content-Type include number, table name will be split with "_". and save a new version of content-type ,will be get error. For detail please see below.

Steps to reproduce the behavior

  1. Go to 'Content-Type Builder'
  2. Create new Single Type and with name 'CustomAPI2demo'
  3. In Database, will create a new table is 'custom_api_2_demos_version_links', but when we save a new version of this content-type. will get an error.
  4. See error

Expected behavior

Data table names should be consistent

Screenshots

issue steps

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version: v16.14.2
  • NPM version: v8.5.0
  • Strapi version: v4.4.5
  • Database: sqlite3
  • Operating system: Windows 11

Editors cannot create item for versioned type

Bug report

Describe the bug

  1. When logged in as Super Admin I activate versioning for a Content Type.
  2. I can then go to Content Manager and create new items of that Content Type without issues.
  3. The system has users with the standard Editor role, which has been granted full CRUD access to the Content Type.
  4. If I log in as such an editor user, I am not able to create new items, I get a 403 error on the API save request and a

Warning: Policy Failed.

If I as Super Admin disable versioning on the Content Type and reload the Editor users browser, the editor can again create new items.

System

  • Node.js version: v16
  • Strapi version: 4.0.7
  • Database: Postgres

Timestamp is not properly set on versions saved by the native Save button

Bug report

Describe the bug

I've overwritten the default functionality of the Save-button (following these instructions), to save a new version when you click the native Save-button.

It seems to work fine. However, the version date does not get updated. So if I hit "Save" on an entry with the timestamp X showing under "Showed version", the new version would also get timestamp X. This kind of breaks the purpose of the timestamp.
I'm using the 4.6.0 patch, with Strapi 4.6.0 and content versioning 1.0.0-beta.0.

When using the "Save new version" button, the timestamp is properly set to the timestamp when I clicked the button.

Steps to reproduce the behavior

  1. Setup the project so it has its Save-button overwritten (following these instructions)
  2. Go to an existing entry (preferably an old one, to underline the problem). Note the timestamp under "Showed version".
  3. Save the entry
  4. Notice how the timestamp under "Showed version" still is the same as the one noted in 2). Not the timestamp of when you clicked the button

Expected behavior

I expect a new timestamp to be generated and set to the new version, like the "Save new version" button would do.

Screenshots

Screenshot 2023-02-22 at 10 19 37
The "Showed Version" shows Dec 23 2022, even though I just saved this version using the native Save button (Feb 22 2023).

System

Node.js version: 16.18.1
NPM version: 8.19.2
Strapi version: 4.5.0
Database: postgres
Operating system: OSX 12.15.1

Patch package no longer applies cleanly

@strapi/admin patch package out of date

Describe the bug

Since Strapi 4.1.7 the supplied patch package no longer applies without errors.

Steps to reproduce the behavior

  1. Install Strapi ^4.1.7
  2. Attempt to apply patch

Module doesn't appear in Strapi 4.3.8

Hi,
I've installed your module on the last Strapi 4.3.8 version , unfortunately, the module doesn't appear in the catalog.
Reading the first step is about "Versioning must be enabled in settings of Content Type. Same as localization plugin."
Unfortunately, I didn't see any flag in the popup of Advanced settings.
Is there any workaround I can do setting a row in the db or config file in order to enable first step?

Moreover the patch is not available for 4.3.8, I've renamed 4.3.6 version, is it ok?

Thanks
Maurizio

Incorrect sql query in core-api.js

Hello ๐Ÿ‘‹

The original query was
INSERT INTO ${model.collectionName}_versions_links VALUES (${version},${result.id}) and I had a problem creating a new version I kept getting a 500 error from the server, eventually changing query to node_modules/@notum-cz/strapi-plugin-content-versioning/server/services/core-api.js for INSERT INTO ${model.collectionName}_versions_links (post_id, inv_post_id) VALUES (${version}, ${result.id}) helped.

Internal server while Saving new version

Bug report

Describe the bug

Internal server while Saving new version

Steps to reproduce the behavior

  1. Go to Content Manager
  2. Click on Save New Version
  3. Internal server error is thrown
  4. In terminal SQL error was shown "INSERT INTO test_versions_versions_links VALUES (29,30) - ER_WRONG_VALUE_COUNT_ON_ROW: Column count doesn't match value count at row 1"

Expected behavior

Should save the new version

Screenshots

image

System

  • Node.js version: v16.15.0
  • NPM version: 8.5.5
  • Strapi version: 4.3.8
  • Database: MySQL
  • Operating system: Windows

Access versioned content via API

I was eventually able to successfully install this plugin by reverting to Strapi 4.0.2, however I'm not able to access any of the alternate version content in the API? Is it expected that we should be able to, or is the intent of this plugin only to be able to access the multiple versions within the Strapi admin interface?

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.