Merge commit '39b22ba91b
' into kb_migration
This commit is contained in:
commit
06f0656a7b
9 changed files with 58 additions and 38 deletions
|
@ -86,7 +86,7 @@ class Account < ApplicationRecord
|
|||
|
||||
enum protocol: { ostatus: 0, activitypub: 1 }
|
||||
enum suspension_origin: { local: 0, remote: 1 }, _prefix: true
|
||||
enum searchability: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4, public_unlisted: 10 }, _suffix: :searchability
|
||||
enum searchability: { public: 0, private: 1, direct: 2, limited: 3, unsupported: 4, public_unlisted: 10 }, _suffix: :searchability
|
||||
|
||||
validates :username, presence: true
|
||||
validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? }
|
||||
|
|
|
@ -53,7 +53,7 @@ class Status < ApplicationRecord
|
|||
update_index('statuses', :proper)
|
||||
|
||||
enum visibility: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4, public_unlisted: 10, login: 11 }, _suffix: :visibility
|
||||
enum searchability: { public: 0, private: 1, direct: 2, limited: 3, public_unlisted: 10 }, _suffix: :searchability
|
||||
enum searchability: { public: 0, private: 1, direct: 2, limited: 3, unsupported: 4, public_unlisted: 10 }, _suffix: :searchability
|
||||
|
||||
belongs_to :application, class_name: 'Doorkeeper::Application', optional: true
|
||||
|
||||
|
@ -387,8 +387,9 @@ class Status < ApplicationRecord
|
|||
# Fedibird code
|
||||
# searchability || Status.searchabilities.invert.fetch([Account.searchabilities[account.searchability], Status.visibilities[visibility] || 0].max, nil) || 'direct'
|
||||
# Reactions only (generic: direct)
|
||||
return 'direct' if searchability && unsupported_searchability?
|
||||
return searchability if searchability
|
||||
return account.searchability if account.local? && account.searchability
|
||||
return account.searchability if account.local? && account.searchability && !account.unsupported_searchability?
|
||||
|
||||
'direct'
|
||||
end
|
||||
|
@ -526,7 +527,15 @@ class Status < ApplicationRecord
|
|||
def set_searchability
|
||||
return if searchability.nil?
|
||||
|
||||
self.searchability = [Status.searchabilities[searchability], Status.visibilities[visibility == 'public_unlisted' || visibility == 'login' ? 'public' : visibility]].max
|
||||
if visibility == 'public' || visibility == 'public_unlisted' || visibility == 'login'
|
||||
self.searchability = [Status.searchabilities[searchability], Status.visibilities['public']].max
|
||||
elsif visibility == 'limited'
|
||||
self.searchability = Status.searchabilities['limited']
|
||||
else
|
||||
s = [Status.searchabilities[searchability], Status.visibilities[visibility]].max
|
||||
s = [s, 3].max
|
||||
self.searchability = s
|
||||
end
|
||||
end
|
||||
|
||||
def set_conversation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue