From ad66de213c5f3cb3c0c6e95a95a938c42cec343b Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Mon, 23 May 2022 17:04:43 +0200 Subject: [PATCH 1/2] Make use of new productversion field if available --- .../unreleased/enhancement-productversion-log | 6 +++++ .../web-runtime/src/container/versions.ts | 10 ++++---- .../tests/unit/container/versions.spec.ts | 23 +++++++++++++++---- 3 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 changelog/unreleased/enhancement-productversion-log diff --git a/changelog/unreleased/enhancement-productversion-log b/changelog/unreleased/enhancement-productversion-log new file mode 100644 index 00000000000..681e234308d --- /dev/null +++ b/changelog/unreleased/enhancement-productversion-log @@ -0,0 +1,6 @@ +Enhancement: Log correct oCIS version if available + +oCIS has introduced a new `productversion` field to announce it's correct version while maintaining a fake 10.x.x version in the `versionstring` field to keep clients compatible. We're using the new productversion field when it exists and use versionstring as a fallback. Thus the backend product information prints the correct oCIS version now. + +https://github.com/owncloud/ocis/pull/3805 +https://github.com/owncloud/web/pull/7045 diff --git a/packages/web-runtime/src/container/versions.ts b/packages/web-runtime/src/container/versions.ts index 655ba1b4745..16e0a65b545 100644 --- a/packages/web-runtime/src/container/versions.ts +++ b/packages/web-runtime/src/container/versions.ts @@ -6,12 +6,12 @@ export const getWebVersion = (): string => { } export const getBackendVersion = ({ store }: { store: Store }): string => { - const backendVersion = store.getters.user.version - if (!backendVersion || !backendVersion.string) { + const backendStatus = store.getters.capabilities?.core?.status + if (!backendStatus || !backendStatus.versionstring) { return undefined } - const product = backendVersion.product || 'ownCloud' - const version = backendVersion.string - const edition = backendVersion.edition + const product = backendStatus.product || 'ownCloud' + const version = backendStatus.productversion || backendStatus.versionstring + const edition = backendStatus.edition return `${product} ${version} ${edition}` } diff --git a/packages/web-runtime/tests/unit/container/versions.spec.ts b/packages/web-runtime/tests/unit/container/versions.spec.ts index 558d89bc118..6b801eba7a6 100644 --- a/packages/web-runtime/tests/unit/container/versions.spec.ts +++ b/packages/web-runtime/tests/unit/container/versions.spec.ts @@ -21,13 +21,13 @@ describe('collect version information', () => { it('returns undefined when the backend version object has no "string" field', () => { const store = versionStore({ product: 'ownCloud', - string: undefined + versionstring: undefined }) expect(getBackendVersion({ store })).toBeUndefined() }) it('falls back to "ownCloud" as a product when none is defined', () => { const store = versionStore({ - string: '10.8.0', + versionstring: '10.8.0', edition: 'Community' }) expect(getBackendVersion({ store })).toBe('ownCloud 10.8.0 Community') @@ -35,18 +35,33 @@ describe('collect version information', () => { it('provides the backend version as concatenation of product, version and edition', () => { const store = versionStore({ product: 'oCIS', - string: '1.16.0', + versionstring: '1.16.0', edition: 'Reva' }) expect(getBackendVersion({ store })).toBe('oCIS 1.16.0 Reva') }) + it('prefers the productversion over versionstring field if both are provided', () => { + const store = versionStore({ + product: 'oCIS', + versionstring: '10.8.0', + productversion: '2.0.0', + edition: 'Community' + }) + expect(getBackendVersion({ store })).toBe('oCIS 2.0.0 Community') + }) }) }) const versionStore = (version: any): Store => { return new Vuex.Store({ getters: { - user: jest.fn(() => ({ version })) + capabilities: jest.fn(() => ({ + core: { + status: { + ...version + } + } + })) } }) } From a79556e2e4c4e03e23ebd7b020346809640161dc Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Tue, 24 May 2022 10:01:59 +0200 Subject: [PATCH 2/2] Bump ocis commit id --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 01d7b73d249..9044b9627c9 100644 --- a/.drone.env +++ b/.drone.env @@ -1,3 +1,3 @@ # The version of OCIS to use in pipelines that test against OCIS -OCIS_COMMITID=ea435449d2843a96c6b5d030e139eb6658a17078 +OCIS_COMMITID=4aeac5c93f1bf6a74e1962a51efebbdf30164cf2 OCIS_BRANCH=master