Mercurial > snowl
changeset 238:d1a66c6f41c4
make unsubscribe work again
author | Myk Melez <myk@mozilla.org> |
---|---|
date | Tue, 05 Aug 2008 12:44:46 -0700 |
parents | 824eb9b2c87f |
children | 2116e44e4c17 e3e361a4d9e5 |
files | content/collections.js modules/collection.js |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/content/collections.js Tue Aug 05 12:40:13 2008 -0700 +++ b/content/collections.js Tue Aug 05 12:44:46 2008 -0700 @@ -328,7 +328,12 @@ }, unsubscribe: function(aEvent) { - let sourceID = this._collections[this._tree.currentIndex].id; + let collection = this._rows[this._tree.currentIndex]; + + if (!collection.parent || collection.parent.groupIDColumn != "sources.id") + return; + + let sourceID = this._rows[this._tree.currentIndex].groupID; SnowlDatastore.dbConnection.beginTransaction(); try {
--- a/modules/collection.js Tue Aug 05 12:40:13 2008 -0700 +++ b/modules/collection.js Tue Aug 05 12:44:46 2008 -0700 @@ -137,6 +137,9 @@ let group = new SnowlCollection(null, name, iconURL, constraints, this); + if (this.groupIDColumn) + group.groupID = statement.row.groupID; + group.level = this.level + 1; groups.push(group); } @@ -153,8 +156,12 @@ _generateGetGroupsStatement: function() { let columns = []; - // FIXME: add groupIDColumn and make groupNameColumn optional. - columns.push("DISTINCT(" + this.groupNameColumn + ") AS name"); + if (this.groupIDColumn) { + columns.push("DISTINCT(" + this.groupIDColumn + ") AS groupID"); + columns.push(this.groupNameColumn + " AS name"); + } + else + columns.push("DISTINCT(" + this.groupNameColumn + ") AS name"); // For some reason, trying to access statement.row.foo dies without throwing // an exception if foo isn't defined as a column in the query, so we have to