зеркало из https://github.com/mozilla/snowl.git
only persist content/summary/author for new messages
This commit is contained in:
Родитель
a611cffd89
Коммит
1cd6cfd44b
|
@ -324,7 +324,9 @@ let SnowlMessageView = {
|
|||
a.appendChild(this._document.createTextNode(content));
|
||||
div.appendChild(a);
|
||||
}
|
||||
else {
|
||||
else if (content) {
|
||||
dump("foo\nfoo\nfoo\n");
|
||||
dump("content = " + content + "\n");
|
||||
SnowlUtils.linkifyText(content, div, message.source.principal);
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ SnowlMessage.prototype = {
|
|||
|
||||
get _getPartStatement() {
|
||||
let statement = SnowlDatastore.createStatement(
|
||||
"SELECT content, mediaType, baseURI, languageTag FROM parts " +
|
||||
"SELECT id, content, mediaType, baseURI, languageTag FROM parts " +
|
||||
"WHERE messageID = :messageID AND partType = :partType"
|
||||
);
|
||||
this.__defineGetter__("_getPartStatement", function() { return statement });
|
||||
|
@ -230,7 +230,8 @@ SnowlMessage.prototype = {
|
|||
this._getPartStatement.params.messageID = this.id;
|
||||
this._getPartStatement.params.partType = aPartType;
|
||||
if (this._getPartStatement.step()) {
|
||||
part = new SnowlMessagePart({ partType: aPartType,
|
||||
part = new SnowlMessagePart({ id: this._getPartStatement.row.id,
|
||||
partType: aPartType,
|
||||
content: this._getPartStatement.row.content,
|
||||
mediaType: this._getPartStatement.row.mediaType,
|
||||
baseURI: URI.get(this._getPartStatement.row.baseURI),
|
||||
|
@ -267,9 +268,6 @@ SnowlMessage.prototype = {
|
|||
|
||||
let added = false;
|
||||
|
||||
if (this.author)
|
||||
this.author.persist();
|
||||
|
||||
if (!this.id)
|
||||
this.id = this._getInternalID();
|
||||
|
||||
|
@ -279,6 +277,9 @@ SnowlMessage.prototype = {
|
|||
else {
|
||||
added = true;
|
||||
|
||||
if (this.author)
|
||||
this.author.persist();
|
||||
|
||||
this._stmtInsertMessage.params.sourceID = this.sourceID;
|
||||
this._stmtInsertMessage.params.externalID = this.externalID;
|
||||
this._stmtInsertMessage.params.subject = this.subject;
|
||||
|
@ -290,12 +291,12 @@ SnowlMessage.prototype = {
|
|||
this._stmtInsertMessage.execute();
|
||||
|
||||
this.id = SnowlDatastore.dbConnection.lastInsertRowID;
|
||||
}
|
||||
|
||||
if (this.content)
|
||||
this.content.persist(this);
|
||||
if (this.summary)
|
||||
this.summary.persist(this);
|
||||
if (this.content)
|
||||
this.content.persist(this);
|
||||
if (this.summary)
|
||||
this.summary.persist(this);
|
||||
}
|
||||
|
||||
if (added)
|
||||
Observers.notify("snowl:message:added", this);
|
||||
|
@ -395,7 +396,7 @@ SnowlMessagePart.prototype = {
|
|||
},
|
||||
|
||||
persist: function(message) {
|
||||
if (message.id) {
|
||||
if (this.id) {
|
||||
// FIXME: update the existing record as appropriate.
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче