diff --git a/content/browser.js b/content/browser.js index a3ce718..88c0a9b 100644 --- a/content/browser.js +++ b/content/browser.js @@ -97,11 +97,11 @@ let Snowl = { // Init tab listeners this._initTabListeners(); - //let feedButton = document.getElementById("feed-button"); - //let feedMenuPopup = feedButton.firstChild; - //let t = this; - //feedButton.addEventListener("click", function(evt) { t._onClickFeedButton(evt) }, true); - //feedMenuPopup.addEventListener("popupshowing", function(evt) { t._onPopupShowingFeedMenu(evt) }, true); + let feedButton = document.getElementById("feed-button"); + let feedMenuPopup = feedButton.firstChild; + let t = this; + feedButton.addEventListener("click", function(evt) { t._onClickFeedButton(evt) }, true); + feedMenuPopup.addEventListener("popupshowing", function(evt) { t._onPopupShowingFeedMenu(evt) }, true); }, diff --git a/content/river.js b/content/river.js index 24417b3..b45e09c 100644 --- a/content/river.js +++ b/content/river.js @@ -374,6 +374,17 @@ let SnowlMessageView = { if (CollectionsView.itemIds != -1) { CollectionsView._tree.restoreSelection(); } + + if ("feed" in this._params) { + let title = "title" in this._params ? this._params.title : null; + let feed = new SnowlFeed(null, null, new URI(this._params.feed), undefined, null); + feed.refresh(null, this.onFeedRefresh, this); + } + }, + + onFeedRefresh: function(feed) { + this._collection = feed; + this._rebuildView.async(this, function() {}); }, onFilter: function() { diff --git a/modules/feed.js b/modules/feed.js index 73a2345..3524809 100644 --- a/modules/feed.js +++ b/modules/feed.js @@ -378,8 +378,9 @@ SnowlFeed.prototype = { // Figure out the ID for the entry, then check if the entry has already // been retrieved. If the entry doesn't provide its own ID, we generate // one for it based on its content. + let externalID; try { - let externalID = entry.id || this._generateID(entry); + externalID = entry.id || this._generateID(entry); let message = this._processEntry(feed, entry, externalID, received); messages.push(message); } @@ -402,6 +403,9 @@ SnowlFeed.prototype = { _processEntry: function(aFeed, aEntry, aExternalID, aReceived) { let message = new SnowlMessage(); + // FIXME: we don't need to set sourceID if we always set source, + // so figure out if that's the case and update this code accordingly. + message.source = this; message.sourceID = this.id; message.externalID = aExternalID; message.subject = aEntry.title.text; diff --git a/modules/message.js b/modules/message.js index 8b1748f..1fb4826 100644 --- a/modules/message.js +++ b/modules/message.js @@ -110,6 +110,12 @@ SnowlMessage.prototype = { timestamp: null, received: null, read: false, + // FIXME: we don't need to set sourceID if we always set source, + // so figure out if that's the case and update this code accordingly. + sourceID: null, + // FIXME: make sure there aren't any consumers that expect us to provide this + // automatically from the persistent datastore, which we used to do. + source: null, /** * The content of the message. If undefined, we haven't retrieved it from @@ -182,10 +188,6 @@ SnowlMessage.prototype = { return part; }, - get source() { - return SnowlService.sourcesByID[this.sourceID]; - }, - get _stmtInsertMessage() { let statement = SnowlDatastore.createStatement( "INSERT INTO messages(sourceID, externalID, subject, authorID, timestamp, received, link, read) \