diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-06-03 10:26:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-03 10:26:09 +0200 |
commit | d2f5760ceb12ade0134be5a5fe96e677c5e6c925 (patch) | |
tree | 64164086531e2fc9a4a4abb355add786ba79f3af /app/models | |
parent | c1d0a6a7981b5fe74bdd03c958a558096ea3cde8 (diff) | |
parent | 7bf37551c8ee55d05a5dbca23db2cae7bb572789 (diff) |
Merge pull request #1793 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/account_avatar.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/account_header.rb | 2 | ||||
-rw-r--r-- | app/models/custom_emoji.rb | 2 | ||||
-rw-r--r-- | app/models/domain_block.rb | 1 | ||||
-rw-r--r-- | app/models/media_attachment.rb | 4 | ||||
-rw-r--r-- | app/models/preview_card.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 2 |
8 files changed, 9 insertions, 8 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 7c81e07d9..688e6fabd 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -92,7 +92,7 @@ class Account < ApplicationRecord # Local user validations validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' } - validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? } + validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' } validates :display_name, length: { maximum: MAX_DISPLAY_NAME_LENGTH }, if: -> { local? && will_save_change_to_display_name? } validates :note, note_length: { maximum: MAX_NOTE_LENGTH }, if: -> { local? && will_save_change_to_note? } validates :fields, length: { maximum: DEFAULT_FIELDS_SIZE }, if: -> { local? && will_save_change_to_fields? } diff --git a/app/models/concerns/account_avatar.rb b/app/models/concerns/account_avatar.rb index 1af53ed23..0cfd9167c 100644 --- a/app/models/concerns/account_avatar.rb +++ b/app/models/concerns/account_avatar.rb @@ -3,7 +3,7 @@ module AccountAvatar extend ActiveSupport::Concern - IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze + IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze LIMIT = 2.megabytes class_methods do diff --git a/app/models/concerns/account_header.rb b/app/models/concerns/account_header.rb index 72a3d0566..a8c0a28ef 100644 --- a/app/models/concerns/account_header.rb +++ b/app/models/concerns/account_header.rb @@ -3,7 +3,7 @@ module AccountHeader extend ActiveSupport::Concern - IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze + IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze LIMIT = 2.megabytes MAX_PIXELS = 750_000 # 1500x500px diff --git a/app/models/custom_emoji.rb b/app/models/custom_emoji.rb index d7349dc6a..196ae0297 100644 --- a/app/models/custom_emoji.rb +++ b/app/models/custom_emoji.rb @@ -32,7 +32,7 @@ class CustomEmoji < ApplicationRecord :(#{SHORTCODE_RE_FRAGMENT}): (?=[^[:alnum:]:]|$)/x - IMAGE_MIME_TYPES = %w(image/png image/gif).freeze + IMAGE_MIME_TYPES = %w(image/png image/gif image/webp).freeze belongs_to :category, class_name: 'CustomEmojiCategory', optional: true has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 2b797ef91..a15206b5e 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -16,6 +16,7 @@ # class DomainBlock < ApplicationRecord + include Paginable include DomainNormalizable include DomainMaterializable diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index a5ce1e837..ef269c659 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -44,7 +44,7 @@ class MediaAttachment < ApplicationRecord MAX_VIDEO_MATRIX_LIMIT = 2_304_000 # 1920x1200px MAX_VIDEO_FRAME_RATE = 60 - IMAGE_FILE_EXTENSIONS = %w(.jpg .jpeg .png .gif).freeze + IMAGE_FILE_EXTENSIONS = %w(.jpg .jpeg .png .gif .webp).freeze VIDEO_FILE_EXTENSIONS = %w(.webm .mp4 .m4v .mov).freeze AUDIO_FILE_EXTENSIONS = %w(.ogg .oga .mp3 .wav .flac .opus .aac .m4a .3gp .wma).freeze @@ -55,7 +55,7 @@ class MediaAttachment < ApplicationRecord small ).freeze - IMAGE_MIME_TYPES = %w(image/jpeg image/png image/gif).freeze + IMAGE_MIME_TYPES = %w(image/jpeg image/png image/gif image/webp).freeze VIDEO_MIME_TYPES = %w(video/webm video/mp4 video/quicktime video/ogg).freeze VIDEO_CONVERTIBLE_MIME_TYPES = %w(video/webm video/quicktime).freeze AUDIO_MIME_TYPES = %w(audio/wave audio/wav audio/x-wav audio/x-pn-wave audio/ogg audio/vorbis audio/mpeg audio/mp3 audio/webm audio/flac audio/aac audio/m4a audio/x-m4a audio/mp4 audio/3gpp video/x-ms-asf).freeze diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb index 0d2c32c35..c49c51a1b 100644 --- a/app/models/preview_card.rb +++ b/app/models/preview_card.rb @@ -34,7 +34,7 @@ class PreviewCard < ApplicationRecord include Attachmentable - IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze + IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze LIMIT = 1.megabytes BLURHASH_OPTIONS = { diff --git a/app/models/user.rb b/app/models/user.rb index f7a35eeb5..a68442963 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -26,7 +26,6 @@ # otp_required_for_login :boolean default(FALSE), not null # last_emailed_at :datetime # otp_backup_codes :string is an Array -# filtered_languages :string default([]), not null, is an Array # account_id :bigint(8) not null # disabled :boolean default(FALSE), not null # moderator :boolean default(FALSE), not null @@ -48,6 +47,7 @@ class User < ApplicationRecord current_sign_in_ip last_sign_in_ip skip_sign_in_token + filtered_languages ) include Settings::Extend |