Merge remote-tracking branch 'parent/main' into upstream-20240716
This commit is contained in:
commit
adee1645a3
203 changed files with 1707 additions and 1067 deletions
|
@ -175,10 +175,6 @@ module User::HasSettings
|
|||
settings['web.display_media']
|
||||
end
|
||||
|
||||
def setting_display_media_expand
|
||||
settings['web.display_media_expand']
|
||||
end
|
||||
|
||||
def setting_expand_spoilers
|
||||
settings['web.expand_content_warnings']
|
||||
end
|
||||
|
@ -215,6 +211,10 @@ module User::HasSettings
|
|||
settings['web.disable_swiping']
|
||||
end
|
||||
|
||||
def setting_disable_hover_cards
|
||||
settings['web.disable_hover_cards']
|
||||
end
|
||||
|
||||
def setting_always_send_emails
|
||||
settings['always_send_emails']
|
||||
end
|
||||
|
|
|
@ -31,6 +31,6 @@ class NotificationPolicy < ApplicationRecord
|
|||
private
|
||||
|
||||
def pending_notification_requests
|
||||
@pending_notification_requests ||= notification_requests.where(dismissed: false).limit(MAX_MEANINGFUL_COUNT).pick(Arel.sql('count(*), coalesce(sum(notifications_count), 0)::bigint'))
|
||||
@pending_notification_requests ||= notification_requests.limit(MAX_MEANINGFUL_COUNT).pick(Arel.sql('count(*), coalesce(sum(notifications_count), 0)::bigint'))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,12 +9,13 @@
|
|||
# from_account_id :bigint(8) not null
|
||||
# last_status_id :bigint(8)
|
||||
# notifications_count :bigint(8) default(0), not null
|
||||
# dismissed :boolean default(FALSE), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class NotificationRequest < ApplicationRecord
|
||||
self.ignored_columns += %w(dismissed)
|
||||
|
||||
include Paginable
|
||||
|
||||
MAX_MEANINGFUL_COUNT = 100
|
||||
|
@ -34,8 +35,6 @@ class NotificationRequest < ApplicationRecord
|
|||
end
|
||||
|
||||
def reconsider_existence!
|
||||
return if dismissed?
|
||||
|
||||
prepare_notifications_count
|
||||
|
||||
if notifications_count.positive?
|
||||
|
|
|
@ -46,6 +46,11 @@ class PreviewCard < ApplicationRecord
|
|||
y_comp: 4,
|
||||
}.freeze
|
||||
|
||||
# URL size limit to safely store in PosgreSQL's unique indexes
|
||||
# Technically this is a byte-size limit but we use it as a
|
||||
# character limit to work with length validation
|
||||
URL_CHARACTER_LIMIT = 2692
|
||||
|
||||
self.inheritance_column = false
|
||||
|
||||
enum :type, { link: 0, photo: 1, video: 2, rich: 3 }
|
||||
|
@ -63,7 +68,7 @@ class PreviewCard < ApplicationRecord
|
|||
convert_options: { all: '-quality 90 +profile "!icc,*" +set date:modify +set date:create +set date:timestamp' },
|
||||
validate_media_type: false
|
||||
|
||||
validates :url, presence: true, uniqueness: true, url: true
|
||||
validates :url, presence: true, uniqueness: true, url: true, length: { maximum: URL_CHARACTER_LIMIT }
|
||||
validates_attachment_content_type :image, content_type: IMAGE_MIME_TYPES
|
||||
validates_attachment_size :image, less_than: LIMIT
|
||||
remotable_attachment :image, LIMIT
|
||||
|
|
|
@ -364,7 +364,7 @@ class Status < ApplicationRecord
|
|||
else
|
||||
map = media_attachments.index_by(&:id)
|
||||
ordered_media_attachment_ids.filter_map { |media_attachment_id| map[media_attachment_id] }
|
||||
end
|
||||
end.take(media_attachments_max)
|
||||
end
|
||||
|
||||
def replies_count
|
||||
|
@ -610,6 +610,10 @@ class Status < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def media_attachments_max
|
||||
local? ? MEDIA_ATTACHMENTS_LIMIT : MEDIA_ATTACHMENTS_LIMIT_FROM_REMOTE
|
||||
end
|
||||
|
||||
def update_status_stat!(attrs)
|
||||
return if marked_for_destruction? || destroyed?
|
||||
|
||||
|
|
|
@ -54,12 +54,14 @@ class StatusEdit < ApplicationRecord
|
|||
def ordered_media_attachments
|
||||
return @ordered_media_attachments if defined?(@ordered_media_attachments)
|
||||
|
||||
@ordered_media_attachments = if ordered_media_attachment_ids.nil?
|
||||
[]
|
||||
else
|
||||
map = status.media_attachments.index_by(&:id)
|
||||
ordered_media_attachment_ids.map.with_index { |media_attachment_id, index| PreservedMediaAttachment.new(media_attachment: map[media_attachment_id], description: media_descriptions[index]) }
|
||||
end
|
||||
@ordered_media_attachments = begin
|
||||
if ordered_media_attachment_ids.nil?
|
||||
[]
|
||||
else
|
||||
map = status.media_attachments.index_by(&:id)
|
||||
ordered_media_attachment_ids.map.with_index { |media_attachment_id, index| PreservedMediaAttachment.new(media_attachment: map[media_attachment_id], description: media_descriptions[index]) }
|
||||
end
|
||||
end.take(Status::MEDIA_ATTACHMENTS_LIMIT)
|
||||
end
|
||||
|
||||
def proper
|
||||
|
|
|
@ -58,6 +58,7 @@ class UserSettings
|
|||
setting :use_system_font, default: false
|
||||
setting :bookmark_category_needed, default: false
|
||||
setting :disable_swiping, default: false
|
||||
setting :disable_hover_cards, default: false
|
||||
setting :delete_modal, default: true
|
||||
setting :enable_dtl_menu, default: false
|
||||
setting :hide_recent_emojis, default: false
|
||||
|
@ -67,7 +68,6 @@ class UserSettings
|
|||
setting :reduce_motion, default: false
|
||||
setting :expand_content_warnings, default: false
|
||||
setting :display_media, default: 'default', in: %w(default show_all hide_all)
|
||||
setting :display_media_expand, default: true
|
||||
setting :auto_play, default: true
|
||||
setting :simple_timeline_menu, default: false
|
||||
setting :boost_menu, default: false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue