diff --git a/app/controllers/api/v0/github_repos_controller.rb b/app/controllers/api/v0/github_repos_controller.rb index 1ffb24514..13ac4fd87 100644 --- a/app/controllers/api/v0/github_repos_controller.rb +++ b/app/controllers/api/v0/github_repos_controller.rb @@ -15,6 +15,7 @@ module Api def update_or_create @client = create_octokit_client @repo = GithubRepo.find_or_create(fetched_repo_params) + current_user.touch(:github_repos_updated_at) if @repo.valid? render json: { featured: @repo.featured } else diff --git a/app/controllers/github_repos_controller.rb b/app/controllers/github_repos_controller.rb index fc2668b02..de18fe98f 100644 --- a/app/controllers/github_repos_controller.rb +++ b/app/controllers/github_repos_controller.rb @@ -5,6 +5,7 @@ class GithubReposController < ApplicationController authorize GithubRepo @client = create_octokit_client @repo = GithubRepo.find_or_create(fetched_repo_params) + current_user.touch(:github_repos_updated_at) if @repo.valid? redirect_to "/settings/integrations", notice: "GitHub repo added" else @@ -15,6 +16,7 @@ class GithubReposController < ApplicationController def update @repo = GithubRepo.find(params[:id]) + current_user.touch(:github_repos_updated_at) authorize @repo if @repo.update(featured: false) redirect_to "/settings/integrations", notice: "GitHub repo added" diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 7474b9385..bbd938614 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -18,7 +18,6 @@ class OrganizationsController < ApplicationController end end - # GET /users/:id/edit def update @user = current_user @tab = "organization" @@ -27,6 +26,7 @@ class OrganizationsController < ApplicationController authorize @organization if @organization.update(organization_params) + @organization.touch(:profile_updated_at) redirect_to "/settings/organization", notice: "Your organization was successfully updated." else render template: "users/edit" diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index f89c1a18d..7f639b648 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -196,7 +196,7 @@ class StoriesController < ApplicationController def handle_article_show @article_show = true - @variant_number = params[:variant_version] || rand(2) + @variant_number = params[:variant_version] || (user_signed_in? ? 0 : rand(2)) assign_user_and_org @comments_to_show_count = @article.cached_tag_list_array.include?("discuss") ? 50 : 30 assign_second_and_third_user diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 70fa3a944..96d7e3ea8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -32,6 +32,7 @@ class UsersController < ApplicationController end follow_hiring_tag(@user) + @user.touch(:profile_updated_at) redirect_to "/settings/#{@tab}", notice: notice else render :edit diff --git a/app/decorators/organization_decorator.rb b/app/decorators/organization_decorator.rb index cdded3b0a..348f99730 100644 --- a/app/decorators/organization_decorator.rb +++ b/app/decorators/organization_decorator.rb @@ -25,10 +25,4 @@ class OrganizationDecorator < ApplicationDecorator text: "#ffffff" } end - - def key_profile_attributes - "#{bg_color_hex}-#{text_color_hex}-#{path}-#{tag_line}- - #{email}-#{company_size}-#{location}-#{summary}-#{cta_processed_html}- - #{cta_button_url}-#{cta_button_text}-#{profile_image_url}-#{name}" - end end diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index c7eecbee1..96b538c35 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -76,11 +76,4 @@ class UserDecorator < ApplicationDecorator ] colors[id % 10] end - - def key_profile_attributes - "#{bg_color_hex}-#{text_color_hex}-#{path}-#{tag_line}- - #{email}-#{email_public}-#{employer_name}-#{employment_title}- - #{employer_url}-#{location}-#{education}-#{summary}- - #{looking_for_work_publicly}-#{created_at}-#{profile_image_url}-#{name}" - end end diff --git a/app/models/github_repo.rb b/app/models/github_repo.rb index 4ee1732e9..5be2275b8 100644 --- a/app/models/github_repo.rb +++ b/app/models/github_repo.rb @@ -34,6 +34,7 @@ class GithubRepo < ApplicationRecord stargazers_count: fetched_repo.stargazers_count, info_hash: fetched_repo.to_hash, ) + repo.user&.touch(:github_repos_updated_at) rescue StandardError => e repo.destroy if e.message.include?("404 - Not Found") end diff --git a/app/views/articles/_sticky_nav.html.erb b/app/views/articles/_sticky_nav.html.erb index d5b23a98a..b39dd1ea5 100644 --- a/app/views/articles/_sticky_nav.html.erb +++ b/app/views/articles/_sticky_nav.html.erb @@ -61,7 +61,7 @@ <% end %> -<% if @variant_number.to_i == 1 && !user_signed_in? %> +<% if @variant_number.to_i == 1 %> <% cache("html-variant-sidebar#{rand(20)}", :expires_in => 8.hours) do %> <% @html_variant = HtmlVariant.find_for_test(@article.cached_tag_list_array) %> <% if @html_variant %> @@ -71,7 +71,7 @@ <% end %> <% end %> <% else %> - <% cache("article-sticky-nav-articles-#{@article.id}-#{@actor.last_article_at}", :expires_in => 36.hours) do %> + <% cache("article-sticky-nav-articles-#{@article.id}-#{@actor.last_article_at}", :expires_in => 48.hours) do %> <% @sticky_collection = StickyArticleCollection.new(@article, @organization || @user) %> <% @sticky_articles = @sticky_collection.suggested_stickies %> <% @user_stickies = @sticky_collection.user_stickies %> diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index f0cd3aca0..807db6a60 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -222,7 +222,7 @@ -<% cache("sticky-sidebar-#{@article.id}-#{(@organization || @user).decorate.key_profile_attributes}-#{(@organization || @user).last_article_at}-#{user_signed_in?}-#{@variant_number}", :expires_in => 24.hours) do %> +<% cache("sticky-sidebar-#{@article.id}-#{(@organization || @user).profile_updated_at}-#{(@organization || @user).last_article_at}-#{@variant_number}", :expires_in => 50.hours) do %> <%= render "articles/sticky_nav" %> <% end %> diff --git a/app/views/users/_sidebar.html.erb b/app/views/users/_sidebar.html.erb index ad7d28f5b..15314b186 100644 --- a/app/views/users/_sidebar.html.erb +++ b/app/views/users/_sidebar.html.erb @@ -2,57 +2,61 @@