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