diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-15 16:56:29 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-15 16:56:29 +0100 |
commit | fdc17bea58f210f62ac0d9e836b68e84c6dbd15c (patch) | |
tree | 491613c94695ba867e81d50124e7e3eb73a0eff5 /app/helpers | |
parent | a91c3ef6cef0fe5a1645c043e7d4a5ef96e82c4f (diff) |
Fix rubocop issues, introduce usage of frozen literal to improve performance
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/about_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/accounts_helper.rb | 8 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/atom_builder_helper.rb | 10 | ||||
-rw-r--r-- | app/helpers/home_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/routing_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/stream_entries_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/tags_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/xrd_helper.rb | 2 |
9 files changed, 28 insertions, 6 deletions
diff --git a/app/helpers/about_helper.rb b/app/helpers/about_helper.rb index 68e69aee1..0f57a7b5e 100644 --- a/app/helpers/about_helper.rb +++ b/app/helpers/about_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module AboutHelper end diff --git a/app/helpers/accounts_helper.rb b/app/helpers/accounts_helper.rb index 23eec6c67..17c7b4b82 100644 --- a/app/helpers/accounts_helper.rb +++ b/app/helpers/accounts_helper.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module AccountsHelper def pagination_options { - previous_label: "#{fa_icon('chevron-left')} Prev".html_safe, - next_label: "Next #{fa_icon('chevron-right')}".html_safe, + previous_label: safe_join([fa_icon('chevron-left'), 'Prev'], ' '), + next_label: safe_join(['Next', fa_icon('chevron-right')], ' '), inner_window: 1, - outer_window: 0 + outer_window: 0, } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5ed8499aa..be82ff2fe 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationHelper def active_nav_class(path) current_page?(path) ? 'active' : '' diff --git a/app/helpers/atom_builder_helper.rb b/app/helpers/atom_builder_helper.rb index 2eed2da65..52190adae 100644 --- a/app/helpers/atom_builder_helper.rb +++ b/app/helpers/atom_builder_helper.rb @@ -1,6 +1,12 @@ +# frozen_string_literal: true + module AtomBuilderHelper def stream_updated_at - @account.stream_entries.last ? (@account.updated_at > @account.stream_entries.last.created_at ? @account.updated_at : @account.stream_entries.last.created_at) : @account.updated_at + if @account.stream_entries.last + (@account.updated_at > @account.stream_entries.last.created_at ? @account.updated_at : @account.stream_entries.last.created_at) + else + @account.updated_at + end end def entry(xml, is_root = false, &block) @@ -98,7 +104,7 @@ module AtomBuilderHelper end def in_reply_to(xml, uri, url) - xml['thr'].send('in-reply-to', { ref: uri, href: url, type: 'text/html' }) + xml['thr'].send('in-reply-to', ref: uri, href: url, type: 'text/html') end def link_mention(xml, account) diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index 86cce4c01..66d7ea9af 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module HomeHelper def default_props { token: @token, - account: render(file: 'api/v1/accounts/show', locals: { account: current_user.account }, formats: :json) + account: render(file: 'api/v1/accounts/show', locals: { account: current_user.account }, formats: :json), } end end diff --git a/app/helpers/routing_helper.rb b/app/helpers/routing_helper.rb index 0512a4e0a..9ae29ec91 100644 --- a/app/helpers/routing_helper.rb +++ b/app/helpers/routing_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RoutingHelper extend ActiveSupport::Concern include Rails.application.routes.url_helpers diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index e994155b6..2ba50edc3 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module StreamEntriesHelper def display_name(account) account.display_name.blank? ? account.username : account.display_name diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 23450bc5c..5b2b3ca59 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module TagsHelper end diff --git a/app/helpers/xrd_helper.rb b/app/helpers/xrd_helper.rb index 6b273e122..2281a0278 100644 --- a/app/helpers/xrd_helper.rb +++ b/app/helpers/xrd_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module XrdHelper end |