Skip to content

Commit

Permalink
Merge pull request #1852 from nextcloud/backport/1851/stable27
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Aug 10, 2023
2 parents ed1d947 + 82f5b84 commit 14fe700
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

27 changes: 24 additions & 3 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default {
filters: {
uniqueKey(file) {
return file.fileid || file.source
return '' + file.fileid + file.source
},
},
Expand Down Expand Up @@ -397,6 +397,27 @@ export default {
'viewer--split': this.comparisonFile,
}
},
isSameFile() {
return (fileInfo = null, path = null) => {
if (
path && path === this.currentFile.path
&& !this.currentFile.source
) {
return true
}
if (
fileInfo && fileInfo.fileid === this.currentFile.fileid
&& fileInfo.mtime && fileInfo.mtime === this.currentFile.mtime
&& fileInfo.source && fileInfo.source === this.currentFile.source
) {
return true
}
return false
}
},
},
watch: {
Expand Down Expand Up @@ -558,7 +579,7 @@ export default {
this.cancelRequestFile()
// do not open the same file again
if (path === this.currentFile.path && !this.currentFile.source) {
if (this.isSameFile(null, path)) {
return
}
Expand Down Expand Up @@ -609,7 +630,7 @@ export default {
this.cancelRequestFolder()
// do not open the same file info again
if (fileInfo.basename === this.currentFile.basename && fileInfo.source !== this.currentFile.source) {
if (this.isSameFile(fileInfo)) {
return
}
Expand Down

0 comments on commit 14fe700

Please sign in to comment.