diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account_filter.rb | 8 | ||||
-rw-r--r-- | app/models/media_attachment.rb | 1 | ||||
-rw-r--r-- | app/models/poll.rb | 1 | ||||
-rw-r--r-- | app/models/status.rb | 15 |
4 files changed, 14 insertions, 11 deletions
diff --git a/app/models/account_filter.rb b/app/models/account_filter.rb index e09ce4ec2..3a4ac0492 100644 --- a/app/models/account_filter.rb +++ b/app/models/account_filter.rb @@ -43,13 +43,13 @@ class AccountFilter when 'status' status_scope(value) when 'by_domain' - Account.where(domain: value.to_s) + Account.where(domain: value.to_s.strip) when 'username' - Account.matches_username(value.to_s) + Account.matches_username(value.to_s.strip) when 'display_name' - Account.matches_display_name(value.to_s) + Account.matches_display_name(value.to_s.strip) when 'email' - accounts_with_users.merge(User.matches_email(value.to_s)) + accounts_with_users.merge(User.matches_email(value.to_s.strip)) when 'ip' valid_ip?(value) ? accounts_with_users.merge(User.matches_ip(value).group('users.id, accounts.id')) : Account.none when 'invited_by' diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 6f079dd18..f2b34e4cd 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -104,6 +104,7 @@ class MediaAttachment < ApplicationRecord 'c:v' => 'h264', 'maxrate' => '1300K', 'bufsize' => '1300K', + 'b:v' => '1300K', 'frames:v' => 60 * 60 * 3, 'crf' => 18, 'map_metadata' => '-1', diff --git a/app/models/poll.rb b/app/models/poll.rb index 1a326e452..af3b09315 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -85,6 +85,7 @@ class Poll < ApplicationRecord def reset_votes! self.cached_tallies = options.map { 0 } self.votes_count = 0 + self.voters_count = 0 votes.delete_all unless new_record? end diff --git a/app/models/status.rb b/app/models/status.rb index 044816be7..6cfe19d23 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -68,6 +68,7 @@ class Status < ApplicationRecord has_many :reblogged_by_accounts, through: :reblogs, class_name: 'Account', source: :account has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :thread has_many :mentions, dependent: :destroy, inverse_of: :status + has_many :mentioned_accounts, through: :mentions, source: :account, class_name: 'Account' has_many :active_mentions, -> { active }, class_name: 'Mention', inverse_of: :status has_many :media_attachments, dependent: :nullify @@ -146,11 +147,11 @@ class Status < ApplicationRecord ids << account_id if local? if preloaded.nil? - ids += mentions.where(account: Account.local, silent: false).pluck(:account_id) - ids += favourites.where(account: Account.local).pluck(:account_id) - ids += reblogs.where(account: Account.local).pluck(:account_id) - ids += bookmarks.where(account: Account.local).pluck(:account_id) - ids += poll.votes.where(account: Account.local).pluck(:account_id) if poll.present? + ids += mentions.joins(:account).merge(Account.local).active.pluck(:account_id) + ids += favourites.joins(:account).merge(Account.local).pluck(:account_id) + ids += reblogs.joins(:account).merge(Account.local).pluck(:account_id) + ids += bookmarks.joins(:account).merge(Account.local).pluck(:account_id) + ids += poll.votes.joins(:account).merge(Account.local).pluck(:account_id) if poll.present? else ids += preloaded.mentions[id] || [] ids += preloaded.favourites[id] || [] @@ -590,8 +591,8 @@ class Status < ApplicationRecord def unlink_from_conversations return unless direct_visibility? - mentioned_accounts = (association(:mentions).loaded? ? mentions : mentions.includes(:account)).map(&:account) - inbox_owners = mentioned_accounts.select(&:local?) + (account.local? ? [account] : []) + inbox_owners = mentioned_accounts.local + inbox_owners += [account] if account.local? inbox_owners.each do |inbox_owner| AccountConversation.remove_status(inbox_owner, self) |