Fix race conditions in Tasks UI that can cause drag-n-drop issues (Bifrost#T15766)
This commit is contained in:
parent
b5ceae7d2d
commit
159025d142
2 changed files with 11 additions and 3 deletions
|
@ -325,13 +325,14 @@ function rcube_tasklist_ui(settings)
|
||||||
|
|
||||||
// quick-add a task
|
// quick-add a task
|
||||||
$(rcmail.gui_objects.quickaddform).submit(function(e){
|
$(rcmail.gui_objects.quickaddform).submit(function(e){
|
||||||
|
if (saving_lock)
|
||||||
|
return false;
|
||||||
|
|
||||||
var tasktext = this.elements.text.value,
|
var tasktext = this.elements.text.value,
|
||||||
rec = { id:-(++idcount), title:tasktext, readonly:true, mask:0, complete:0 };
|
rec = { id:-(++idcount), title:tasktext, readonly:true, mask:0, complete:0 };
|
||||||
|
|
||||||
if (tasktext && tasktext.length) {
|
if (tasktext && tasktext.length) {
|
||||||
save_task({ tempid:rec.id, raw:tasktext, list:me.selected_list }, 'new');
|
save_task({ tempid:rec.id, raw:tasktext, list:me.selected_list }, 'new');
|
||||||
render_task(rec);
|
|
||||||
|
|
||||||
$('#listmessagebox').hide();
|
$('#listmessagebox').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,6 +1219,9 @@ function rcube_tasklist_ui(settings)
|
||||||
oldparent = oldrec ? (oldrec._old_parent_id || oldrec.parent_id) : null,
|
oldparent = oldrec ? (oldrec._old_parent_id || oldrec.parent_id) : null,
|
||||||
list = me.tasklists[rec.list];
|
list = me.tasklists[rec.list];
|
||||||
|
|
||||||
|
if (!id || !list)
|
||||||
|
return;
|
||||||
|
|
||||||
if (oldindex >= 0)
|
if (oldindex >= 0)
|
||||||
listindex[oldindex] = id;
|
listindex[oldindex] = id;
|
||||||
else
|
else
|
||||||
|
@ -1387,6 +1391,7 @@ function rcube_tasklist_ui(settings)
|
||||||
if (saving_lock) {
|
if (saving_lock) {
|
||||||
rcmail.set_busy(false, null, saving_lock);
|
rcmail.set_busy(false, null, saving_lock);
|
||||||
$('button.ui-button:ui-button').button('option', 'disabled', false);
|
$('button.ui-button:ui-button').button('option', 'disabled', false);
|
||||||
|
saving_lock = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,10 @@ class tasklist extends rcube_plugin
|
||||||
}
|
}
|
||||||
// update parent task to adjust list of children
|
// update parent task to adjust list of children
|
||||||
if (!empty($oldrec['parent_id'])) {
|
if (!empty($oldrec['parent_id'])) {
|
||||||
$refresh[] = $this->driver->get_task(array('id' => $oldrec['parent_id'], 'list' => $rec['list']));
|
$parent = array('id' => $oldrec['parent_id'], 'list' => $rec['list']);
|
||||||
|
if ($parent = $this->driver->get_task()) {
|
||||||
|
$refresh[] = $parent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue