commit 1ce4de835b6ae57d594a51734662b394e868cea5
parent 8dd972dea141e28be07db6bbd0f024e110bc1208
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 5 Aug 2006 07:42:32 +0000
Fixes #167, Item note cache is not set on new note creation
Diffstat:
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -838,10 +838,7 @@ Scholar.Item.prototype.updateNote = function(text){
if (updated){
this.updateDateModified();
Scholar.DB.commitTransaction();
-
- // Update cached values
- this._noteData = text ? text : '';
- this.setField('title', this._noteToTitle(), true);
+ this.updateNoteCache(text);
Scholar.Notifier.trigger('modify', 'item', this.getID());
}
@@ -851,6 +848,13 @@ Scholar.Item.prototype.updateNote = function(text){
}
+Scholar.Item.prototype.updateNoteCache = function(text){
+ // Update cached values
+ this._noteData = text ? text : '';
+ this.setField('title', this._noteToTitle(), true);
+}
+
+
Scholar.Item.prototype.setSource = function(sourceItemID){
if (this.isNote()){
var type = 'note';
@@ -992,7 +996,6 @@ Scholar.Item.prototype.getSource = function(){
**/
Scholar.Item.prototype.getNotes = function(){
if (this.isNote()){
- Scholar.debug('here');
throw ("getNotes() cannot be called on items of type 'note'");
}
@@ -1867,6 +1870,10 @@ Scholar.Notes = new function(){
Scholar.DB.query(sql, bindParams);
Scholar.DB.commitTransaction();
+ // Switch to Scholar.Items version
+ var note = Scholar.Items.get(note.getID());
+ note.updateNoteCache(text);
+
if (sourceItemID){
sourceItem.incrementNoteCount();
Scholar.Notifier.trigger('modify', 'item', sourceItemID);