diff --git a/app/controllers/async_info_controller.rb b/app/controllers/async_info_controller.rb index d01dbe2e8..2d74eb90f 100644 --- a/app/controllers/async_info_controller.rb +++ b/app/controllers/async_info_controller.rb @@ -77,7 +77,6 @@ class AsyncInfoController < ApplicationController #{current_user&.last_sign_in_at}__ #{current_user&.following_tags_count}__ #{current_user&.last_followed_at}__ - #{current_user&.last_reacted_at}__ #{current_user&.updated_at}__ #{current_user&.reactions_count}__ #{current_user&.articles_count}__ diff --git a/app/controllers/reading_list_items_controller.rb b/app/controllers/reading_list_items_controller.rb index 4669da04f..f17c1e813 100644 --- a/app/controllers/reading_list_items_controller.rb +++ b/app/controllers/reading_list_items_controller.rb @@ -10,8 +10,6 @@ class ReadingListItemsController < ApplicationController @reaction.status = params[:current_status] == "archived" ? "valid" : "archived" @reaction.save - @reaction.user.touch(:last_reacted_at) - head :ok end diff --git a/app/models/user.rb b/app/models/user.rb index 6f0bfee35..caf0d1f3b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -286,7 +286,7 @@ class User < ApplicationRecord end def cached_reading_list_article_ids - Rails.cache.fetch("reading_list_ids_of_articles_#{id}_#{public_reactions_count}_#{last_reacted_at}") do + Rails.cache.fetch("reading_list_ids_of_articles_#{id}_#{public_reactions_count}") do Reaction.readinglist.where( user_id: id, reactable_type: "Article", ).where.not(status: "archived").order(created_at: :desc).pluck(:reactable_id) diff --git a/db/migrate/20201017160628_add_last_reacted_at_to_user.rb b/db/migrate/20201017160628_add_last_reacted_at_to_user.rb deleted file mode 100644 index 7e6470012..000000000 --- a/db/migrate/20201017160628_add_last_reacted_at_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLastReactedAtToUser < ActiveRecord::Migration[6.0] - def change - add_column :users, :last_reacted_at, :datetime, default: "2017-01-01 05:00:00" - end -end diff --git a/db/schema.rb b/db/schema.rb index dd2cff2a7..5e78404e5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1266,7 +1266,6 @@ ActiveRecord::Schema.define(version: 2020_10_19_012200) do t.datetime "last_moderation_notification", default: "2017-01-01 05:00:00" t.datetime "last_notification_activity" t.string "last_onboarding_page" - t.datetime "last_reacted_at", default: "2017-01-01 05:00:00" t.datetime "last_sign_in_at" t.inet "last_sign_in_ip" t.string "linkedin_url" diff --git a/spec/requests/reading_list_items_spec.rb b/spec/requests/reading_list_items_spec.rb index eddb76e72..f5ab5c364 100644 --- a/spec/requests/reading_list_items_spec.rb +++ b/spec/requests/reading_list_items_spec.rb @@ -20,16 +20,12 @@ RSpec.describe "ReadingListItems", type: :request do describe "PUT reading_list_items/:id" do it "returns archives item if no param" do - expect do - put "/reading_list_items/#{reaction.id}" - end.to change { user.reload.last_reacted_at } + put "/reading_list_items/#{reaction.id}" expect(reaction.reload.status).to eq("archived") end it "unarchives an item if current_status is passed as archived" do - expect do - put "/reading_list_items/#{reaction.id}", params: { current_status: "archived" } - end.to change { user.reload.last_reacted_at } + put "/reading_list_items/#{reaction.id}", params: { current_status: "archived" } expect(reaction.reload.status).to eq("valid") end