Permalink
Browse files

mv status node posts loading to DataHandler, optimize

  • Loading branch information...
1 parent 5d12392 commit a778cf4a6320627bdec1a1c19e3b1f091ab0b598 @astro astro committed Feb 28, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −0 src/handlers/data.coffee
  2. +0 −1 src/views/sidebar/entry.coffee
View
@@ -221,6 +221,18 @@ class exports.DataHandler extends Backbone.EventHandler
cb()
, (cb) =>
@connector.replayNotifications mamStart, cb
+ , (cb) =>
+ # Check what status nodes are left to load
+ # (we display them in the sidebar):
+ statusnodes = app.users.current.channels.map((channel) =>
+ channel.nodes.get_or_create(id: 'status')
+ ).filter((statusnode) =>
+ # Not loaded most recent post yet?
+ not (statusnode.posts.at(0)?)
+ )
+ async.forEach statusnodes, (statusnode, cb2) =>
+ @get_node_posts statusnode.get('nodeid'), cb2
+ , cb
], =>
@set_loading false
@@ -24,7 +24,6 @@ class exports.ChannelEntry extends BaseView
statusnode = @model.nodes.get_or_create(id: 'status')
statusnode.bind 'post', =>
@trigger 'update:status', statusnode.posts.at(0)?.get('content')?.value
- app.handler.data.get_node_posts statusnode.get('nodeid')
events:
"click": "click_entry"

0 comments on commit a778cf4

Please sign in to comment.