mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-04 00:43:41 +00:00
Rename unknown
quote policy value to unsupported_policy
(#35955)
This commit is contained in:
parent
8b7685d956
commit
4fa203e69e
|
@ -1,7 +1,11 @@
|
|||
import type { ApiStatusJSON } from './statuses';
|
||||
|
||||
export type ApiQuoteState = 'accepted' | 'pending' | 'revoked' | 'unauthorized';
|
||||
export type ApiQuotePolicy = 'public' | 'followers' | 'nobody' | 'unknown';
|
||||
export type ApiQuotePolicy =
|
||||
| 'public'
|
||||
| 'followers'
|
||||
| 'nobody'
|
||||
| 'unsupported_policy';
|
||||
export type ApiUserQuotePolicy = 'automatic' | 'manual' | 'denied' | 'unknown';
|
||||
|
||||
interface ApiQuoteEmptyJSON {
|
||||
|
|
|
@ -152,8 +152,8 @@ class ActivityPub::Parser::StatusParser
|
|||
# Remove the special-meaning actor URI
|
||||
allowed_actors.delete(@options[:actor_uri])
|
||||
|
||||
# Any unrecognized actor is marked as unknown
|
||||
flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:unknown] unless allowed_actors.empty?
|
||||
# Any unrecognized actor is marked as unsupported
|
||||
flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:unsupported_policy] unless allowed_actors.empty?
|
||||
|
||||
flags
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module Status::InteractionPolicyConcern
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
QUOTE_APPROVAL_POLICY_FLAGS = {
|
||||
unknown: (1 << 0),
|
||||
unsupported_policy: (1 << 0),
|
||||
public: (1 << 1),
|
||||
followers: (1 << 2),
|
||||
followed: (1 << 3),
|
||||
|
@ -52,7 +52,7 @@ module Status::InteractionPolicyConcern
|
|||
return :manual if following_author
|
||||
end
|
||||
|
||||
return :unknown if (automatic_policy | manual_policy).anybits?(QUOTE_APPROVAL_POLICY_FLAGS[:unknown])
|
||||
return :unknown if (automatic_policy | manual_policy).anybits?(QUOTE_APPROVAL_POLICY_FLAGS[:unsupported_policy])
|
||||
|
||||
:denied
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe Status::InteractionPolicyConcern do
|
|||
|
||||
describe '#quote_policy_as_keys' do
|
||||
it 'returns the expected values' do
|
||||
expect(status.quote_policy_as_keys(:automatic)).to eq ['unknown', 'followers']
|
||||
expect(status.quote_policy_as_keys(:automatic)).to eq ['unsupported_policy', 'followers']
|
||||
expect(status.quote_policy_as_keys(:manual)).to eq ['public']
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user