fix loading message am message bus stuff

This commit is contained in:
Sam Saffron 2013-02-18 19:37:12 +11:00
parent 0e48e1c346
commit b9698e8d2f
8 changed files with 11 additions and 9 deletions

View File

@ -39,7 +39,6 @@ Discourse.ListController = Ember.Controller.extend Discourse.Presence,
Discourse.TopicList.list(current).then (items) => Discourse.TopicList.list(current).then (items) =>
@set('filterSummary', items.filter_summary) @set('filterSummary', items.filter_summary)
@set('filterMode', filterMode) @set('filterMode', filterMode)
@set('allLoaded', true) unless items.more_topics_url
@set('loading', false) @set('loading', false)
deferred.resolve(items) deferred.resolve(items)

View File

@ -9,6 +9,7 @@ window.Discourse.TopicList = Discourse.Model.extend
Em.String.i18n('topics.no_' + @get('filter')) Em.String.i18n('topics.no_' + @get('filter'))
).property('topics', 'topics@each', 'filter', 'loaded') ).property('topics', 'topics@each', 'filter', 'loaded')
loadMoreTopics: -> loadMoreTopics: ->
promise = new RSVP.Promise() promise = new RSVP.Promise()
if moreUrl = @get('more_topics_url') if moreUrl = @get('more_topics_url')

View File

@ -5,8 +5,6 @@ window.Discourse.FilteredListRoute = Discourse.Route.extend
listController = @controllerFor('list') listController = @controllerFor('list')
listController.set('canCreateTopic', false) listController.set('canCreateTopic', false)
listController.set('filterMode', '') listController.set('filterMode', '')
listController.set('allLoaded', false)
renderTemplate: -> renderTemplate: ->
@render 'listTopics', into: 'list', outlet: 'listView', controller: 'listTopics' @render 'listTopics', into: 'list', outlet: 'listView', controller: 'listTopics'

View File

@ -35,10 +35,6 @@
{{/if}} {{/if}}
{{outlet listView}} {{outlet listView}}
{{#if controller.allLoaded}}
<h3>{{{i18n topics.footer}}}</h3>
{{/if}}
</div> </div>
</div> </div>

View File

@ -55,5 +55,9 @@
{{/if}} {{/if}}
</footer> </footer>
{{#if view.allLoaded}}
<h3>{{{i18n topics.footer}}}</h3>
{{/if}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}

View File

@ -18,6 +18,10 @@ window.Discourse.ListTopicsView = Ember.View.extend Discourse.Scrolling, Discour
willDestroyElement: -> @unbindScrolling() willDestroyElement: -> @unbindScrolling()
allLoaded: (->
!@get('loading') && !@get('controller.content.more_topics_url')
).property('loading', 'controller.content.more_topics_url')
didInsertElement: -> didInsertElement: ->
@bindScrolling() @bindScrolling()
eyeline = new Discourse.Eyeline('.topic-list-item') eyeline = new Discourse.Eyeline('.topic-list-item')

View File

@ -32,6 +32,7 @@ class MessageBus::Diagnostics
end end
MessageBus.subscribe('/_diagnostics/discover') do |msg| MessageBus.subscribe('/_diagnostics/discover') do |msg|
MessageBus.on_connect.call msg.site_id if MessageBus.on_connect
MessageBus.publish '/_diagnostics/process-discovery', { MessageBus.publish '/_diagnostics/process-discovery', {
pid: Process.pid, pid: Process.pid,
process_name: $0, process_name: $0,
@ -39,6 +40,7 @@ class MessageBus::Diagnostics
uptime: (Time.now.to_f - start_time).to_i, uptime: (Time.now.to_f - start_time).to_i,
hostname: hostname hostname: hostname
}, user_ids: [msg.data["user_id"]] }, user_ids: [msg.data["user_id"]]
MessageBus.on_disconnect.call msg.site_id if MessageBus.on_disconnect
end end
end end
end end

View File

@ -9,8 +9,6 @@ class MessageBus::Rack::Middleware
def self.start_listener def self.start_listener
unless @started_listener unless @started_listener
MessageBus.subscribe do |msg| MessageBus.subscribe do |msg|
p msg.channel
p msg.message_id
EM.next_tick do EM.next_tick do
@@connection_manager.notify_clients(msg) if @@connection_manager @@connection_manager.notify_clients(msg) if @@connection_manager
end end