@ -1937,6 +1937,7 @@ class PlApiClient {
|
||||
createStatus: async (params: CreateStatusParams) => {
|
||||
type ExtendedCreateStatusParams = CreateStatusParams & {
|
||||
markdown?: boolean;
|
||||
circle_id?: string | null;
|
||||
};
|
||||
|
||||
const fixedParams: ExtendedCreateStatusParams = params;
|
||||
@ -1944,6 +1945,10 @@ class PlApiClient {
|
||||
if (params.content_type === 'text/markdown' && this.#instance.api_versions['kmyblue_markdown.fedibird.pl-api'] >= 1) {
|
||||
fixedParams.markdown = true;
|
||||
}
|
||||
if (params.visibility?.startsWith('circle:')) {
|
||||
fixedParams.circle_id = params.visibility.slice(7);
|
||||
fixedParams.visibility = 'circle';
|
||||
}
|
||||
|
||||
const response = await this.request('/api/v1/statuses', {
|
||||
method: 'POST',
|
||||
@ -2160,6 +2165,16 @@ class PlApiClient {
|
||||
* @see {@link https://docs.joinmastodon.org/methods/statuses/#unpin}
|
||||
*/
|
||||
editStatus: async (statusId: string, params: EditStatusParams) => {
|
||||
type ExtendedEditStatusParams = EditStatusParams & {
|
||||
markdown?: boolean;
|
||||
};
|
||||
|
||||
const fixedParams: ExtendedEditStatusParams = params;
|
||||
|
||||
if (params.content_type === 'text/markdown' && this.#instance.api_versions['kmyblue_markdown.fedibird.pl-api'] >= 1) {
|
||||
fixedParams.markdown = true;
|
||||
}
|
||||
|
||||
const response = await this.request(`/api/v1/statuses/${statusId}`, { method: 'PUT', body: params });
|
||||
|
||||
return v.parse(statusSchema, response.json);
|
||||
|
||||
@ -399,6 +399,7 @@ const getFeatures = (instance: Instance) => {
|
||||
createStatusReplyToConversation: v.software === PLEROMA,
|
||||
|
||||
/**
|
||||
* Ability to address a status to a list of users.
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
createStatusListScope: v.software === PLEROMA,
|
||||
@ -411,6 +412,18 @@ const getFeatures = (instance: Instance) => {
|
||||
v.software === PLEROMA,
|
||||
]),
|
||||
|
||||
/**
|
||||
* Ability to post statuses only to accounts with mutual relationship.
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
createStatusMutualsOnlyScope: v.software === GOTOSOCIAL,
|
||||
|
||||
/**
|
||||
* Ability to post statuses only to your subscribers.
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
createStatusSubscribersScope: v.software === MITRA,
|
||||
|
||||
/**
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
@ -1303,24 +1316,6 @@ const getFeatures = (instance: Instance) => {
|
||||
* @see POST /api/v1/lists/:id/accounts
|
||||
*/
|
||||
unrestrictedLists: v.software === PLEROMA,
|
||||
|
||||
/**
|
||||
* Ability to post statuses that don't federate.
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
visibilityLocalOnly: federation && v.software === PLEROMA,
|
||||
|
||||
/**
|
||||
* Ability to post statuses only to accounts with mutual relationship.
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
visibilityMutualsOnly: v.software === GOTOSOCIAL,
|
||||
|
||||
/**
|
||||
* Ability to post statuses only to your subscribers.
|
||||
* @see POST /api/v1/statuses
|
||||
*/
|
||||
visibilitySubscribers: v.software === MITRA,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -47,7 +47,10 @@ interface CreateStatusOptionalParams {
|
||||
/**
|
||||
* String. Sets the visibility of the posted status to `public`, `unlisted`, `private`, `direct`.
|
||||
* `local` — Requires features{@link Features['createStatusLocalScope']}.
|
||||
* `mutuals_only` — Requires features{@link Features['createStatusMutualsOnlyScope']}.
|
||||
* `subscribers` — Requires features{@link Features['createStatusSubscribersScope']}.
|
||||
* `list:LIST_ID` — Requires features{@link Features['createStatusListScope']}.
|
||||
* `circle:LIST_ID` — Requires features{@link Features['circles']}.
|
||||
*/
|
||||
visibility?: string;
|
||||
/** String. ISO 639 language code for this status. */
|
||||
@ -140,11 +143,7 @@ type GetFavouritedByParams = Omit<PaginationParams, 'min_id'>
|
||||
/**
|
||||
* @category Request params
|
||||
*/
|
||||
interface EditStatusOptionalParams {
|
||||
sensitive?: boolean;
|
||||
spoiler_text?: string;
|
||||
language?: string;
|
||||
}
|
||||
type EditStatusOptionalParams = Pick<CreateStatusOptionalParams, 'content_type' | 'sensitive' | 'spoiler_text' | 'language'>;
|
||||
|
||||
/**
|
||||
* @category Request params
|
||||
|
||||
@ -62,13 +62,13 @@ const getItems = (features: Features, lists: ReturnType<typeof getOrderedLists>,
|
||||
text: intl.formatMessage(messages.private_short),
|
||||
meta: intl.formatMessage(messages.private_long),
|
||||
},
|
||||
features.visibilityMutualsOnly ? {
|
||||
features.createStatusMutualsOnlyScope ? {
|
||||
icon: require('@tabler/icons/outline/users-group.svg'),
|
||||
value: 'mutuals_only',
|
||||
text: intl.formatMessage(messages.mutuals_only_short),
|
||||
meta: intl.formatMessage(messages.mutuals_only_long),
|
||||
} : undefined,
|
||||
features.visibilitySubscribers ? {
|
||||
features.createStatusSubscribersScope ? {
|
||||
icon: require('@tabler/icons/outline/coin.svg'),
|
||||
value: 'subscribers',
|
||||
text: intl.formatMessage(messages.subscribers_short),
|
||||
@ -80,13 +80,13 @@ const getItems = (features: Features, lists: ReturnType<typeof getOrderedLists>,
|
||||
text: intl.formatMessage(messages.direct_short),
|
||||
meta: intl.formatMessage(messages.direct_long),
|
||||
},
|
||||
features.visibilityLocalOnly ? {
|
||||
features.createStatusLocalScope ? {
|
||||
icon: require('@tabler/icons/outline/affiliate.svg'),
|
||||
value: 'local',
|
||||
text: intl.formatMessage(messages.local_short),
|
||||
meta: intl.formatMessage(messages.local_long),
|
||||
} : undefined,
|
||||
features.addressableLists && Object.keys(lists).length ? {
|
||||
features.createStatusListScope && Object.keys(lists).length ? {
|
||||
icon: require('@tabler/icons/outline/list.svg'),
|
||||
value: '',
|
||||
items: Object.values(lists).map((list) => ({
|
||||
|
||||
Reference in New Issue
Block a user