mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 18:11:41 -04:00
fix(dialogs): Make sure conflict dialog is loaded before adding conflicts
Fixes a possible race condition where conflicts are added and the dialog loading finishes only afterwards. The race condition sometimes led to missing files in the conflict dialog when uploading several existing files at once. Fixes: #45661
This commit is contained in:
parent
3663c4a719
commit
f3cd03b141
1 changed files with 17 additions and 16 deletions
|
|
@ -918,27 +918,28 @@ const Dialogs = {
|
|||
var dialogName = 'oc-dialog-fileexists-content'
|
||||
var dialogId = '#' + dialogName
|
||||
if (this._fileexistsshown) {
|
||||
// add conflict
|
||||
this._fileexistsshown.then(() => {
|
||||
// add conflict
|
||||
|
||||
var $conflicts = $(dialogId + ' .conflicts')
|
||||
addConflict($conflicts, original, replacement)
|
||||
var $conflicts = $(dialogId + ' .conflicts')
|
||||
addConflict($conflicts, original, replacement)
|
||||
|
||||
var count = $(dialogId + ' .conflict').length
|
||||
var title = n('core',
|
||||
'{count} file conflict',
|
||||
'{count} file conflicts',
|
||||
count,
|
||||
{ count: count }
|
||||
)
|
||||
$(dialogId).parent().children('.oc-dialog-title').text(title)
|
||||
var count = $(dialogId + ' .conflict').length
|
||||
var title = n('core',
|
||||
'{count} file conflict',
|
||||
'{count} file conflicts',
|
||||
count,
|
||||
{ count: count }
|
||||
)
|
||||
$(dialogId).parent().children('.oc-dialog-title').text(title)
|
||||
|
||||
// recalculate dimensions
|
||||
$(window).trigger('resize')
|
||||
dialogDeferred.resolve()
|
||||
// recalculate dimensions
|
||||
$(window).trigger('resize')
|
||||
dialogDeferred.resolve()
|
||||
})
|
||||
} else {
|
||||
// create dialog
|
||||
this._fileexistsshown = true
|
||||
$.when(this._getFileExistsTemplate()).then(function($tmpl) {
|
||||
this._fileexistsshown = $.when(this._getFileExistsTemplate()).then(function($tmpl) {
|
||||
var title = t('core', 'One file conflict')
|
||||
var $dlg = $tmpl.octemplate({
|
||||
dialog_name: dialogName,
|
||||
|
|
|
|||
Loading…
Reference in a new issue