Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different description in overwrite dialog when versioning is enabled #3050

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
}),
computed: {
...mapGetters('Files', ['searchTerm', 'files', 'highlightedFile', 'publicLinkPassword']),
...mapGetters(['getToken']),
...mapGetters(['getToken', 'capabilities']),

_sidebarOpen () {
return this.highlightedFile !== null
Expand Down Expand Up @@ -152,7 +152,13 @@ export default {
} else {
const translated = this.$gettext('File %{file} already exists.')
this.setOverwriteDialogTitle(this.$gettextInterpolate(translated, { file: item.name }, true))
this.setOverwriteDialogMessage(this.$gettext('Do you want to overwrite it?'))

if (this.capabilities.files.versioning) {
this.setOverwriteDialogMessage(this.$gettext('Do you want to create a new version?'))
} else {
this.setOverwriteDialogMessage(this.$gettext('Do you want to overwrite it?'))
}

const overwrite = await this.$_ocUpload_confirmOverwrite()
if (overwrite) {
item.file(file => {
Expand All @@ -177,7 +183,13 @@ export default {

const translated = this.$gettext('File %{file} already exists.')
this.setOverwriteDialogTitle(this.$gettextInterpolate(translated, { file: files[i].name }, true))
this.setOverwriteDialogMessage(this.$gettext('Do you want to overwrite it?'))

if (this.capabilities.files.versioning) {
this.setOverwriteDialogMessage(this.$gettext('Do you want to create a new version?'))
} else {
this.setOverwriteDialogMessage(this.$gettext('Do you want to overwrite it?'))
}

const overwrite = await this.$_ocUpload_confirmOverwrite()
if (overwrite === true) {
this.$_ocUpload(files[i], files[i].name, exists.etag)
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/3047
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Different message in overwrite dialog when versioning is enabled

We've added a new message in the overwrite dialog when versioning is enabled.
This message is intended to make it clear that the resource won't be overwritten but a new version of it will be created.

https://github.com/owncloud/phoenix/issues/3047
https://github.com/owncloud/phoenix/pull/3050
10 changes: 10 additions & 0 deletions tests/acceptance/features/webUIUpload/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ Feature: File Upload

@smokeTest
Scenario: overwrite an existing file
When the user uploads overwriting file "lorem.txt" using the webUI
Then no message should be displayed on the webUI
And file "lorem.txt" should be listed on the webUI
And as "user1" the content of "lorem.txt" should be the same as the local "lorem.txt"
And the versions list for resource "lorem.txt" should contain 1 entry
But file "lorem (2).txt" should not be listed on the webUI

@smokeTest
Scenario: overwrite an existing file when versioning is disabled
Given the app "files_versions" has been disabled
When the user uploads overwriting file "lorem.txt" using the webUI
Then no message should be displayed on the webUI
And file "lorem.txt" should be listed on the webUI
Expand Down
13 changes: 13 additions & 0 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,19 @@ Then('the versions list should contain {int} entries', async function (expectedN
)
})

Then('the versions list for resource {string} should contain {int} entry/entries', async function (resourceName, expectedNumber) {
await client.page.FilesPageElement.filesList().getVersions(resourceName)
const count = await client.page.filesPage().getVersionsCount()

assert.strictEqual(
expectedNumber, count
)

client.page.FilesPageElement.filesList().closeSidebar(100)

return this
})

Then('the content of file {string} for user {string} should be {string}', async function (file, user, content) {
const remote = await download(user, file)
return client.assert.strictEqual(
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/stepDefinitions/generalContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,10 @@ After(function () {
fs.writeFileSync(this.fullPathOfConfigFile,
JSON.stringify(initialConfigJsonSettings, null, 4))
})

Given('the app {string} has been disabled', function (app) {
return occHelper.runOcc(
[
'app:disable', app
])
})