Merge remote-tracking branch 'parent/main' into upstream-20241231
This commit is contained in:
commit
3c77d4e8e4
268 changed files with 4213 additions and 3029 deletions
|
@ -5,13 +5,13 @@
|
|||
# Table name: account_conversations
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# conversation_id :bigint(8)
|
||||
# lock_version :integer default(0), not null
|
||||
# participant_account_ids :bigint(8) default([]), not null, is an Array
|
||||
# status_ids :bigint(8) default([]), not null, is an Array
|
||||
# last_status_id :bigint(8)
|
||||
# lock_version :integer default(0), not null
|
||||
# unread :boolean default(FALSE), not null
|
||||
# account_id :bigint(8) not null
|
||||
# conversation_id :bigint(8) not null
|
||||
# last_status_id :bigint(8)
|
||||
#
|
||||
|
||||
class AccountConversation < ApplicationRecord
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
# Table name: account_notes
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# target_account_id :bigint(8)
|
||||
# comment :text not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint(8) not null
|
||||
# target_account_id :bigint(8) not null
|
||||
#
|
||||
class AccountNote < ApplicationRecord
|
||||
include RelationshipCacheable
|
||||
|
|
|
@ -47,7 +47,7 @@ class FeaturedTag < ApplicationRecord
|
|||
def decrement(deleted_status)
|
||||
if statuses_count <= 1
|
||||
update(statuses_count: 0, last_status_at: nil)
|
||||
elsif last_status_at > deleted_status.created_at
|
||||
elsif last_status_at.present? && last_status_at > deleted_status.created_at
|
||||
update(statuses_count: statuses_count - 1)
|
||||
else
|
||||
# Fetching the latest status creation time can be expensive, so only perform it
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
# Table name: markers
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# user_id :bigint(8)
|
||||
# timeline :string default(""), not null
|
||||
# last_read_id :bigint(8) default(0), not null
|
||||
# lock_version :integer default(0), not null
|
||||
# timeline :string default(""), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# last_read_id :bigint(8) default(0), not null
|
||||
# user_id :bigint(8) not null
|
||||
#
|
||||
|
||||
class Marker < ApplicationRecord
|
||||
|
|
|
@ -59,7 +59,6 @@ class MediaAttachment < ApplicationRecord
|
|||
).freeze
|
||||
|
||||
IMAGE_MIME_TYPES = %w(image/jpeg image/png image/gif image/heic image/heif image/webp image/avif).freeze
|
||||
IMAGE_ANIMATED_MIME_TYPES = %w(image/png image/gif).freeze
|
||||
IMAGE_CONVERTIBLE_MIME_TYPES = %w(image/heic image/heif image/avif).freeze
|
||||
VIDEO_MIME_TYPES = %w(video/webm video/mp4 video/quicktime video/ogg).freeze
|
||||
VIDEO_CONVERTIBLE_MIME_TYPES = %w(video/webm video/quicktime).freeze
|
||||
|
@ -104,7 +103,7 @@ class MediaAttachment < ApplicationRecord
|
|||
'preset' => 'veryfast',
|
||||
'movflags' => 'faststart', # Move metadata to start of file so playback can begin before download finishes
|
||||
'pix_fmt' => 'yuv420p', # Ensure color space for cross-browser compatibility
|
||||
'filter_complex' => 'drawbox=t=fill:c=white[bg];[bg][0]overlay,crop=trunc(iw/2)*2:trunc(ih/2)*2', # Remove transparency. h264 requires width and height to be even; crop instead of scale to avoid blurring
|
||||
'vf' => 'crop=floor(iw/2)*2:floor(ih/2)*2', # h264 requires width and height to be even. Crop instead of scale to avoid blurring
|
||||
'c:v' => 'h264',
|
||||
'c:a' => 'aac',
|
||||
'b:a' => '192k',
|
||||
|
@ -302,7 +301,7 @@ class MediaAttachment < ApplicationRecord
|
|||
private
|
||||
|
||||
def file_styles(attachment)
|
||||
if attachment.instance.animated_image? || VIDEO_CONVERTIBLE_MIME_TYPES.include?(attachment.instance.file_content_type)
|
||||
if attachment.instance.file_content_type == 'image/gif' || VIDEO_CONVERTIBLE_MIME_TYPES.include?(attachment.instance.file_content_type)
|
||||
VIDEO_CONVERTED_STYLES
|
||||
elsif IMAGE_CONVERTIBLE_MIME_TYPES.include?(attachment.instance.file_content_type)
|
||||
IMAGE_CONVERTED_STYLES
|
||||
|
@ -316,8 +315,8 @@ class MediaAttachment < ApplicationRecord
|
|||
end
|
||||
|
||||
def file_processors(instance)
|
||||
if instance.animated_image?
|
||||
[:gifv_transcoder, :blurhash_transcoder]
|
||||
if instance.file_content_type == 'image/gif'
|
||||
[:gif_transcoder, :blurhash_transcoder]
|
||||
elsif VIDEO_MIME_TYPES.include?(instance.file_content_type)
|
||||
[:transcoder, :blurhash_transcoder, :type_corrector]
|
||||
elsif AUDIO_MIME_TYPES.include?(instance.file_content_type)
|
||||
|
@ -328,17 +327,6 @@ class MediaAttachment < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def animated_image?
|
||||
if processing_complete?
|
||||
gifv?
|
||||
elsif IMAGE_ANIMATED_MIME_TYPES.include?(file_content_type)
|
||||
@animated_image = FastImage.animated?(file.queued_for_write[:original].path) unless defined?(@animated_image)
|
||||
@animated_image
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_unknown_type
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
# Table name: polls
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# status_id :bigint(8)
|
||||
# expires_at :datetime
|
||||
# options :string default([]), not null, is an Array
|
||||
# cached_tallies :bigint(8) default([]), not null, is an Array
|
||||
# multiple :boolean default(FALSE), not null
|
||||
# expires_at :datetime
|
||||
# hide_totals :boolean default(FALSE), not null
|
||||
# votes_count :bigint(8) default(0), not null
|
||||
# last_fetched_at :datetime
|
||||
# lock_version :integer default(0), not null
|
||||
# multiple :boolean default(FALSE), not null
|
||||
# options :string default([]), not null, is an Array
|
||||
# voters_count :bigint(8)
|
||||
# votes_count :bigint(8) default(0), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# lock_version :integer default(0), not null
|
||||
# voters_count :bigint(8)
|
||||
# account_id :bigint(8) not null
|
||||
# status_id :bigint(8) not null
|
||||
#
|
||||
|
||||
class Poll < ApplicationRecord
|
||||
|
@ -39,9 +39,6 @@ class Poll < ApplicationRecord
|
|||
validates :expires_at, presence: true, if: :local?
|
||||
validates_with PollValidator, on: :create, if: :local?
|
||||
|
||||
scope :attached, -> { where.not(status_id: nil) }
|
||||
scope :unattached, -> { where(status_id: nil) }
|
||||
|
||||
before_validation :prepare_options, if: :local?
|
||||
before_validation :prepare_votes_count
|
||||
before_validation :prepare_cached_tallies
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
# Table name: poll_votes
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# poll_id :bigint(8)
|
||||
# choice :integer default(0), not null
|
||||
# uri :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# uri :string
|
||||
# account_id :bigint(8) not null
|
||||
# poll_id :bigint(8) not null
|
||||
#
|
||||
|
||||
class PollVote < ApplicationRecord
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
# Table name: tombstones
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# by_moderator :boolean
|
||||
# uri :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# by_moderator :boolean
|
||||
# account_id :bigint(8) not null
|
||||
#
|
||||
|
||||
class Tombstone < ApplicationRecord
|
||||
|
|
|
@ -43,6 +43,8 @@ class UserRole < ApplicationRecord
|
|||
EVERYONE_ROLE_ID = -99
|
||||
NOBODY_POSITION = -1
|
||||
|
||||
POSITION_LIMIT = (2**31) - 1
|
||||
|
||||
module Flags
|
||||
NONE = 0
|
||||
ALL = FLAGS.values.reduce(&:|)
|
||||
|
@ -94,6 +96,7 @@ class UserRole < ApplicationRecord
|
|||
|
||||
validates :name, presence: true, unless: :everyone?
|
||||
validates :color, format: { with: /\A#?(?:[A-F0-9]{3}){1,2}\z/i }, unless: -> { color.blank? }
|
||||
validates :position, numericality: { in: (-POSITION_LIMIT..POSITION_LIMIT) }
|
||||
|
||||
validate :validate_permissions_elevation
|
||||
validate :validate_position_elevation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue