This reverts commit 1f17451c8e.
This commit is contained in:
parent
95619a9c92
commit
4dbfc21407
6 changed files with 3 additions and 16 deletions
|
|
@ -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}__
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue