diff --git a/Gemfile b/Gemfile index 21929a806..ce51295bc 100644 --- a/Gemfile +++ b/Gemfile @@ -41,6 +41,7 @@ gem 'initialjs-rails', '0.2.0' gem 'unicorn' gem 'paranoia' gem 'savon' +gem 'dalli' gem 'ahoy_matey', '~> 1.2.1' gem 'groupdate' # group temporary data diff --git a/Gemfile.lock b/Gemfile.lock index 60af34f06..922a30d37 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,6 +111,7 @@ GEM simplecov (~> 0.10.0) term-ansicolor (~> 1.3) thor (~> 0.19.1) + dalli (2.7.4) database_cleaner (1.4.1) debug_inspector (0.0.2) devise (3.5.2) @@ -402,6 +403,7 @@ DEPENDENCIES ckeditor coffee-rails (~> 4.1.0) coveralls + dalli database_cleaner devise email_spec diff --git a/app/helpers/cache_keys_helper.rb b/app/helpers/cache_keys_helper.rb new file mode 100644 index 000000000..088b45632 --- /dev/null +++ b/app/helpers/cache_keys_helper.rb @@ -0,0 +1,16 @@ +module CacheKeysHelper + def locale_and_user_status + @cache_key_user ||= calculate_user_status + "#{I18n.locale}/user:#{@cache_key_user}" + end + + def calculate_user_status + user_status = if user_signed_in? && current_user.verified_at.present? + "verified" + elsif user_signed_in? + "signed" + else + "visitor" + end + end +end \ No newline at end of file diff --git a/app/views/debates/_debate.html.erb b/app/views/debates/_debate.html.erb index 2d1e2deb4..2d8ad2900 100644 --- a/app/views/debates/_debate.html.erb +++ b/app/views/debates/_debate.html.erb @@ -1,28 +1,30 @@ -
- - <%= link_to t("debates.debate.comments", count: debate.comments_count), debate_path(debate, anchor: "comments") %> -
-+ + <%= link_to t("debates.debate.comments", count: debate.comments_count), debate_path(debate, anchor: "comments") %> +
+- - <%= link_to t("debates.show.comments", count: featured_debate.comments_count), debate_path(featured_debate, anchor: "comments") %> -
-+ + <%= link_to t("debates.show.comments", count: featured_debate.comments_count), debate_path(featured_debate, anchor: "comments") %> +
+