lib/ayadn/action.rb in ayadn-1.1.3 vs lib/ayadn/action.rb in ayadn-1.2.0

- old
+ new

@@ -40,18 +40,21 @@ ensure Databases.close_all end end - def global(options) + def global(settings) begin + options = settings.dup + options[:filter] = true doing(options) stream = @api.get_global(options) + niceranks = @api.get_niceranks stream (no_new_posts unless Databases.has_new?(stream, 'global')) if options[:new] Databases.save_max_id(stream) - render_view(stream, options) - Scroll.new(@api, @view).global(options) if options[:scroll] + render_view(stream, options, niceranks) + Scroll.new(@api, @view).global(options, niceranks) if options[:scroll] rescue => e Errors.global_error("action/global", options, e) ensure Databases.close_all end @@ -1073,14 +1076,13 @@ post_id = resp[:id] end post_id end - def render_view(data, options = {}) + def render_view(data, options = {}, niceranks = {}) unless options[:raw] - #@view.clear_screen - get_view(data['data'], options) + get_view(data['data'], options, niceranks) else @view.show_raw(data) end end @@ -1093,15 +1095,15 @@ def get_data_from_response(response) response['data'] end - def get_view(stream, options = {}) + def get_view(stream, options = {}, niceranks = {}) @view.clear_screen if options[:index] - @view.show_posts_with_index(stream, options) + @view.show_posts_with_index(stream, options, niceranks) else - @view.show_posts(stream, options) + @view.show_posts(stream, options, niceranks) end end def get_simple_view(stream) @view.clear_screen