mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-29 08:29:03 +01:00
Add published_at
attribute to preview cards (#26153)
This commit is contained in:
parent
49d2e8979f
commit
7bd8ef355c
5 changed files with 225 additions and 221 deletions
|
@ -124,7 +124,7 @@ class LinkDetailsExtractor
|
||||||
author_url: author_url || '',
|
author_url: author_url || '',
|
||||||
embed_url: embed_url || '',
|
embed_url: embed_url || '',
|
||||||
language: language,
|
language: language,
|
||||||
created_at: published_at.presence || Time.now.utc,
|
published_at: published_at.presence,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
# max_score_at :datetime
|
# max_score_at :datetime
|
||||||
# trendable :boolean
|
# trendable :boolean
|
||||||
# link_type :integer
|
# link_type :integer
|
||||||
|
# published_at :datetime
|
||||||
#
|
#
|
||||||
|
|
||||||
class PreviewCard < ApplicationRecord
|
class PreviewCard < ApplicationRecord
|
||||||
|
|
|
@ -15,8 +15,4 @@ class REST::PreviewCardSerializer < ActiveModel::Serializer
|
||||||
def html
|
def html
|
||||||
Sanitize.fragment(object.html, Sanitize::Config::MASTODON_OEMBED)
|
Sanitize.fragment(object.html, Sanitize::Config::MASTODON_OEMBED)
|
||||||
end
|
end
|
||||||
|
|
||||||
def published_at
|
|
||||||
object.created_at
|
|
||||||
end
|
|
||||||
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
|
432
db/schema.rb
432
db/schema.rb
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue