Skip to content

Commit a604425

Browse files
committed
fix: More fixes regarding package change
1 parent 28c76e8 commit a604425

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

admin/src/pluginId.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
const pluginId = 'versioning'
1+
import pluginPkg from '../../package.json'
22

3-
module.exports = pluginId
3+
const pluginId = pluginPkg.name.replace(/^strapi-plugin-/i, '')
4+
5+
export default pluginId

config/functions/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = async () => {
44
section: 'plugins',
55
displayName: 'Access to restore and view old entry versions',
66
uid: 'restore',
7-
pluginName: 'versioning'
7+
pluginName: 'versioning-mongo'
88
}
99
]
1010

controllers/versioning.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module.exports = {
22
list: async (ctx) => {
33
const { id } = ctx.params
4-
const versionModel = strapi.plugins.versioning.models.version
4+
const versionModel = strapi.plugins['versioning-mongo'].models.version
55
const versions = await versionModel.find({ entryId: id }).lean()
66

77
ctx.send(versions)
88
},
99

1010
getVersion: async (ctx) => {
1111
const { id } = ctx.params
12-
const versionModel = strapi.plugins.versioning.models.version
12+
const versionModel = strapi.plugins['versioning-mongo'].models.version
1313
const version = await versionModel.findById(id).lean()
1414

1515
ctx.send(version)

extensions/content-manager/admin/src/containers/EditView/Header/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const Header = ({
127127
label: 'View Versions',
128128
onClick: () => {
129129
const id = location.pathname.split('/').pop()
130-
push(`/plugins/versioning?entryId=${id}`)
130+
push(`/plugins/versioning-mongo?entryId=${id}`)
131131
},
132132
color: 'secondary',
133133
type: 'button'

middlewares/versioning/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = strapi => ({
22
initialize () {
3-
const versioningPlugin = strapi.plugins.versioning
4-
const versioningService = versioningPlugin.services['versioning-mongo']
3+
const versioningPlugin = strapi.plugins['versioning-mongo']
4+
const versioningService = versioningPlugin.services.versioning
55
const versionModel = versioningPlugin.models.version
66

77
const newVersionMethods = ['PUT', 'POST']

0 commit comments

Comments
 (0)