Fixes #96, When notify() is called for a new note, getNote() on the item returns false
Item.save() changed to not call notify() if a transaction is in progress, which is totally going to trip someone up at some point, and probably me, but it's better than a new parameter
This commit is contained in:
parent
965f4c3c0a
commit
b75376c1c1
1 changed files with 10 additions and 2 deletions
|
@ -364,6 +364,10 @@ Scholar.Item.prototype.setField = function(field, value, loadIn){
|
|||
|
||||
/*
|
||||
* Save changes back to database
|
||||
*
|
||||
* Note: Does not call notify() if transaction is in progress
|
||||
*
|
||||
* Returns true on item update or itemID of new item
|
||||
*/
|
||||
Scholar.Item.prototype.save = function(){
|
||||
if (!this.hasChanged()){
|
||||
|
@ -739,11 +743,15 @@ Scholar.Item.prototype.save = function(){
|
|||
Scholar.Items.reload(this.getID());
|
||||
|
||||
if (isNew){
|
||||
Scholar.Notifier.trigger('add', 'item', this.getID());
|
||||
if (!Scholar.DB.transactionInProgress()){
|
||||
Scholar.Notifier.trigger('add', 'item', this.getID());
|
||||
}
|
||||
return this.getID();
|
||||
}
|
||||
else {
|
||||
Scholar.Notifier.trigger('modify', 'item', this.getID());
|
||||
if (!Scholar.DB.transactionInProgress()){
|
||||
Scholar.Notifier.trigger('modify', 'item', this.getID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue