posts: show length of videos and animations in thumbnails.
Show the length of videos and animated posts in the thumbnail. The length is shown the top left corner in MM:SS format. This replaces the play button icon. Show a speaker icon instead of a music note icon for posts with sound. Doing this requires doing `.includes(:media_asset)` in a bunch of places to avoid N+1 queries when we access the post's duration.
This commit is contained in:
@@ -37,7 +37,7 @@ class Post < ApplicationRecord
|
||||
belongs_to :approver, class_name: "User", optional: true
|
||||
belongs_to :uploader, :class_name => "User", :counter_cache => "post_upload_count"
|
||||
belongs_to :parent, class_name: "Post", optional: true
|
||||
has_one :media_asset, foreign_key: :md5, primary_key: :md5
|
||||
has_one :media_asset, -> { active }, foreign_key: :md5, primary_key: :md5
|
||||
has_one :upload, :dependent => :destroy
|
||||
has_one :artist_commentary, :dependent => :destroy
|
||||
has_one :pixiv_ugoira_frame_data, class_name: "PixivUgoiraFrameData", foreign_key: :md5, primary_key: :md5
|
||||
|
||||
Reference in New Issue
Block a user