Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
# protocol :integer default("ostatus"), not null
|
||||
# memorial :boolean default(FALSE), not null
|
||||
# moved_to_account_id :integer
|
||||
# featured_collection_url :string
|
||||
#
|
||||
|
||||
class Account < ApplicationRecord
|
||||
|
||||
@@ -7,8 +7,8 @@ module AccountAvatar
|
||||
|
||||
class_methods do
|
||||
def avatar_styles(file)
|
||||
styles = { original: { geometry: '120x120#', file_geometry_parser: FastGeometryParser } }
|
||||
styles[:static] = { geometry: '120x120#', format: 'png', convert_options: '-coalesce', file_geometry_parser: FastGeometryParser } if file.content_type == 'image/gif'
|
||||
styles = { original: { geometry: '400x400#', file_geometry_parser: FastGeometryParser } }
|
||||
styles[:static] = { geometry: '400x400#', format: 'png', convert_options: '-coalesce', file_geometry_parser: FastGeometryParser } if file.content_type == 'image/gif'
|
||||
styles
|
||||
end
|
||||
|
||||
|
||||
@@ -58,13 +58,14 @@ module Omniauthable
|
||||
email_is_verified = auth.info.verified || auth.info.verified_email || assume_verified
|
||||
email = auth.info.verified_email || auth.info.email
|
||||
email = email_is_verified && !User.exists?(email: auth.info.email) && email
|
||||
display_name = auth.info.full_name || [auth.info.first_name, auth.info.last_name].join(' ')
|
||||
|
||||
{
|
||||
email: email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com",
|
||||
password: Devise.friendly_token[0, 20],
|
||||
account_attributes: {
|
||||
username: ensure_unique_username(auth.uid),
|
||||
display_name: [auth.info.first_name, auth.info.last_name].join(' '),
|
||||
display_name: display_name,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -28,7 +28,11 @@ module Remotable
|
||||
matches = response.headers['content-disposition']&.match(/filename="([^"]*)"/)
|
||||
filename = matches.nil? ? parsed_url.path.split('/').last : matches[1]
|
||||
basename = SecureRandom.hex(8)
|
||||
extname = File.extname(filename)
|
||||
extname = if filename.nil?
|
||||
''
|
||||
else
|
||||
File.extname(filename)
|
||||
end
|
||||
|
||||
send("#{attachment_name}=", StringIO.new(response.to_s))
|
||||
send("#{attachment_name}_file_name=", basename + extname)
|
||||
|
||||
@@ -58,7 +58,7 @@ class Status < ApplicationRecord
|
||||
has_one :stream_entry, as: :activity, inverse_of: :status
|
||||
|
||||
validates :uri, uniqueness: true, presence: true, unless: :local?
|
||||
validates :text, presence: true, unless: :reblog?
|
||||
validates :text, presence: true, unless: -> { with_media? || reblog? }
|
||||
validates_with StatusLengthValidator
|
||||
validates :reblog, uniqueness: { scope: :account }, if: :reblog?
|
||||
|
||||
@@ -153,8 +153,12 @@ class Status < ApplicationRecord
|
||||
private_visibility? || direct_visibility?
|
||||
end
|
||||
|
||||
def with_media?
|
||||
media_attachments.any?
|
||||
end
|
||||
|
||||
def non_sensitive_with_media?
|
||||
!sensitive? && media_attachments.any?
|
||||
!sensitive? && with_media?
|
||||
end
|
||||
|
||||
def emojis
|
||||
|
||||
@@ -44,7 +44,7 @@ class User < ApplicationRecord
|
||||
ACTIVE_DURATION = 14.days
|
||||
|
||||
devise :two_factor_authenticatable,
|
||||
otp_secret_encryption_key: ENV.fetch('OTP_SECRET')
|
||||
otp_secret_encryption_key: Rails.configuration.x.otp_secret
|
||||
|
||||
devise :two_factor_backupable,
|
||||
otp_number_of_backup_codes: 10
|
||||
|
||||
Reference in New Issue
Block a user