Fixes #1798, Apparent duplication of standalone attachment after drag

Trigger change notification for moved item before new parent item so that the tree view can detect that the moved item is in the wrong place, remove it, and then refresh the new parent item's children
This commit is contained in:
Dan Stillman 2011-05-27 20:19:25 +00:00
parent 16845352b3
commit fdbc11f2b3

View file

@ -1448,6 +1448,7 @@ Zotero.Item.prototype.save = function() {
Zotero.DB.query(sql, bindParams);
}
Zotero.Notifier.trigger('add', 'item', itemID);
// Parent item
if (this._sourceItem) {
@ -1831,6 +1832,7 @@ Zotero.Item.prototype.save = function() {
Zotero.DB.query(sql, bindParams);
}
Zotero.Notifier.trigger('modify', 'item', this.id, { old: this._previousData });
// Parent
if (this._changedSource) {
@ -2048,13 +2050,6 @@ Zotero.Item.prototype.save = function() {
Zotero.Items.reload(this.id);
if (isNew) {
Zotero.Notifier.trigger('add', 'item', this.id);
}
else {
Zotero.Notifier.trigger('modify', 'item', this.id, { old: this._previousData });
}
this._previousData = null;
if (isNew) {