Add `published_at` attribute to preview cards (#26153)

local
Eugen Rochko 10 months ago committed by GitHub
parent 49d2e8979f
commit 7bd8ef355c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/lib/link_details_extractor.rb
  2. 1
      app/models/preview_card.rb
  3. 4
      app/serializers/rest/preview_card_serializer.rb
  4. 7
      db/migrate/20230724160715_add_published_at_to_preview_cards.rb
  5. 432
      db/schema.rb

@ -124,7 +124,7 @@ class LinkDetailsExtractor
author_url: author_url || '',
embed_url: embed_url || '',
language: language,
created_at: published_at.presence || Time.now.utc,
published_at: published_at.presence,
}
end

@ -30,6 +30,7 @@
# max_score_at :datetime
# trendable :boolean
# link_type :integer
# published_at :datetime
#
class PreviewCard < ApplicationRecord

@ -15,8 +15,4 @@ class REST::PreviewCardSerializer < ActiveModel::Serializer
def html
Sanitize.fragment(object.html, Sanitize::Config::MASTODON_OEMBED)
end
def published_at
object.created_at
end
end

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddPublishedAtToPreviewCards < ActiveRecord::Migration[7.0]
def change
add_column :preview_cards, :published_at, :datetime
end
end

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save