From d611946e34a75b2def9ad6faa9c819298317416a Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sat, 18 Nov 2023 14:41:07 +1100 Subject: [PATCH] Fix bookmark caching --- lib/adamantium/jobs/archive_dead_bookmarks.rb | 2 +- slices/admin/commands/bookmarks/cache.rb | 2 +- slices/admin/repos/bookmark_repo.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/adamantium/jobs/archive_dead_bookmarks.rb b/lib/adamantium/jobs/archive_dead_bookmarks.rb index 41e3b76..4286e4d 100644 --- a/lib/adamantium/jobs/archive_dead_bookmarks.rb +++ b/lib/adamantium/jobs/archive_dead_bookmarks.rb @@ -12,7 +12,7 @@ module Adamantium bookmarks.each do |bookmark| code = HTTParty.get(bookmark.url, follow_redirects: false).code if code >= 400 - bookmark_repo.update(bookmark.id, {url: "https://web.archive.org/web/*/#{bookmark.url}"}) + bookmark_repo.update(bookmark.id, params: {url: "https://web.archive.org/web/*/#{bookmark.url}"}) end end end diff --git a/slices/admin/commands/bookmarks/cache.rb b/slices/admin/commands/bookmarks/cache.rb index e612142..5c2a449 100644 --- a/slices/admin/commands/bookmarks/cache.rb +++ b/slices/admin/commands/bookmarks/cache.rb @@ -9,7 +9,7 @@ module Admin bookmark = bookmark_repo.fetch(id: bookmark_id) page_cacher.call(url: bookmark.url) do |content| - bookmark_repo.update(id: bookmark_id, cached_content: content) + bookmark_repo.update(id: bookmark_id, params: { cached_content: content }) end Success() diff --git a/slices/admin/repos/bookmark_repo.rb b/slices/admin/repos/bookmark_repo.rb index a31158b..49476e7 100644 --- a/slices/admin/repos/bookmark_repo.rb +++ b/slices/admin/repos/bookmark_repo.rb @@ -31,8 +31,8 @@ module Admin posts.where(id: id).update(published_at: Time.now) end - def update(id:, cached_content:) - posts.where(id: id).update(cached_content: cached_content) + def update(id:, params:) + posts.where(id: id).update(params) end end end