Progress
accounts approved, video player testing, bookmark collections
This commit is contained in:
@@ -80,7 +80,7 @@ class Account < ApplicationRecord
|
||||
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? }
|
||||
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
|
||||
validates :note, note_length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? }
|
||||
validates :fields, length: { maximum: 4 }, if: -> { local? && will_save_change_to_fields? }
|
||||
validates :fields, length: { maximum: 6 }, if: -> { local? && will_save_change_to_fields? }
|
||||
|
||||
scope :remote, -> { where.not(domain: nil) }
|
||||
scope :local, -> { where(domain: nil) }
|
||||
@@ -260,7 +260,7 @@ class Account < ApplicationRecord
|
||||
self[:fields] = fields
|
||||
end
|
||||
|
||||
DEFAULT_FIELDS_SIZE = 4
|
||||
DEFAULT_FIELDS_SIZE = 6
|
||||
|
||||
def build_fields
|
||||
return if fields.size >= DEFAULT_FIELDS_SIZE
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
class ChatConversationAccount < ApplicationRecord
|
||||
include Paginable
|
||||
|
||||
PER_ACCOUNT_APPROVED_LIMIT = 100
|
||||
PER_ACCOUNT_APPROVED_LIMIT = 250
|
||||
|
||||
EXPIRATION_POLICY_MAP = {
|
||||
none: nil,
|
||||
|
||||
@@ -7,6 +7,10 @@ module AccountAssociations
|
||||
# Local users
|
||||
has_one :user, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Chat
|
||||
has_many :chat_messages, inverse_of: :account, dependent: :destroy
|
||||
has_many :chat_conversation_accounts, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Timelines
|
||||
has_many :statuses, inverse_of: :account, dependent: :destroy
|
||||
has_many :favourites, inverse_of: :account, dependent: :destroy
|
||||
@@ -14,9 +18,10 @@ module AccountAssociations
|
||||
has_many :notifications, inverse_of: :account, dependent: :destroy
|
||||
has_many :scheduled_statuses, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Pinned statuses
|
||||
# Bookmarked statuses
|
||||
has_many :status_bookmarks, inverse_of: :account, dependent: :destroy
|
||||
has_many :bookmarked_statuses, -> { reorder('status_bookmarks.created_at DESC') }, through: :status_bookmarks, class_name: 'Status', source: :status
|
||||
has_many :status_bookmark_collections, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Pinned statuses
|
||||
has_many :status_pins, inverse_of: :account, dependent: :destroy
|
||||
@@ -26,7 +31,7 @@ module AccountAssociations
|
||||
has_many :media_attachments, dependent: :destroy
|
||||
has_many :polls, dependent: :destroy
|
||||
|
||||
# PuSH subscriptions
|
||||
# Push subscriptions
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
|
||||
# Report relationships
|
||||
|
||||
@@ -77,12 +77,6 @@ module AccountInteractions
|
||||
has_many :chat_blocking, -> { order('chat_blocks.id desc') }, through: :chat_block_relationships, source: :target_account
|
||||
has_many :chat_blocked_by_relationships, class_name: 'ChatBlock', foreign_key: :target_account_id, dependent: :destroy
|
||||
has_many :chat_blocked_by, -> { order('chat_blocks.id desc') }, through: :chat_blocked_by_relationships, source: :account
|
||||
|
||||
# Chat mute relationships
|
||||
has_many :chat_mute_relationships, class_name: 'ChatMute', foreign_key: 'account_id', dependent: :destroy
|
||||
has_many :chat_muting, -> { order('chat_mutes.id desc') }, through: :chat_mute_relationships, source: :target_account
|
||||
has_many :chat_muted_by_relationships, class_name: 'ChatMute', foreign_key: :target_account_id, dependent: :destroy
|
||||
has_many :chat_muted_by, -> { order('chat_mutes.id desc') }, through: :chat_muted_by_relationships, source: :account
|
||||
end
|
||||
|
||||
def follow!(other_account, reblogs: nil, uri: nil)
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
# account_id :integer not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# visibility :string
|
||||
#
|
||||
|
||||
class StatusBookmarkCollection < ApplicationRecord
|
||||
|
||||
PER_ACCOUNT_LIMIT = 100
|
||||
PER_ACCOUNT_LIMIT = 150
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :account, inverse_of: :status_bookmark_collections
|
||||
|
||||
end
|
||||
|
||||
+7
-3
@@ -124,7 +124,7 @@ class User < ApplicationRecord
|
||||
|
||||
def confirm
|
||||
new_user = !confirmed?
|
||||
self.approved = true
|
||||
self.approved = true if open_registrations?
|
||||
|
||||
super
|
||||
|
||||
@@ -135,7 +135,7 @@ class User < ApplicationRecord
|
||||
|
||||
def confirm!
|
||||
new_user = !confirmed?
|
||||
self.approved = true
|
||||
self.approved = true if open_registrations?
|
||||
|
||||
skip_confirmation!
|
||||
save!
|
||||
@@ -258,7 +258,7 @@ class User < ApplicationRecord
|
||||
private
|
||||
|
||||
def set_approved
|
||||
self.approved = true
|
||||
self.approved = open_registrations?
|
||||
end
|
||||
|
||||
def external?
|
||||
@@ -305,4 +305,8 @@ class User < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def open_registrations?
|
||||
Setting.registrations_mode == 'open'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user