Merge pull request #3565 from glitch-soc/glitch-soc/merge-upstream
Merge upstream changes up to f4fdbe3029
This commit is contained in:
55 files changed
+1200
-215
No files matched your search
@@ -122,10 +122,10 @@ module JsonLdHelper
|
||||
graph.dump(:normalize)
|
||||
end
|
||||
|
||||
def compact(json)
|
||||
compacted = JSON::LD::API.compact(json.without('signature'), full_context, documentLoader: method(:load_jsonld_context))
|
||||
compacted['signature'] = json['signature']
|
||||
compacted
|
||||
def compact(json, context = full_context)
|
||||
JSON::LD::API.compact(json.without('signature'), context, documentLoader: method(:load_jsonld_context)).tap do |compacted|
|
||||
compacted['signature'] = json['signature']
|
||||
end
|
||||
end
|
||||
|
||||
def unsupported_jsonld_features?(json)
|
||||
|
||||
@@ -7,6 +7,8 @@ import type { AxiosResponse } from 'axios';
|
||||
|
||||
import type { Alert } from 'flavours/glitch/models/alert';
|
||||
|
||||
import { createAppThunk } from '../store/typed_functions';
|
||||
|
||||
interface ApiErrorResponse {
|
||||
error?: string;
|
||||
}
|
||||
@@ -74,3 +76,12 @@ export const showAlertForError = (error: unknown, skipNotFound = false) => {
|
||||
message: messages.unexpectedMessage,
|
||||
});
|
||||
};
|
||||
|
||||
export const showGenericAlert = createAppThunk((_arg, { dispatch }) => {
|
||||
dispatch(
|
||||
showAlert({
|
||||
title: messages.unexpectedTitle,
|
||||
message: messages.unexpectedMessage,
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -1,13 +1,266 @@
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import {
|
||||
apiReblog,
|
||||
apiUnreblog,
|
||||
apiRevokeQuote,
|
||||
apiGetQuotes,
|
||||
} from 'flavours/glitch/api/interactions';
|
||||
import type { StatusVisibility } from 'flavours/glitch/models/status';
|
||||
import { createDataLoadingThunk } from 'flavours/glitch/store/typed_functions';
|
||||
} from '@/flavours/glitch/api/interactions';
|
||||
import type { StatusContextType } from '@/flavours/glitch/components/status/types';
|
||||
import type { VisibilityModalCallback } from '@/flavours/glitch/features/ui/components/visibility_modal';
|
||||
import type {
|
||||
StatusShape,
|
||||
StatusVisibility,
|
||||
} from '@/flavours/glitch/models/status';
|
||||
import {
|
||||
createAppThunk,
|
||||
createDataLoadingThunk,
|
||||
} from '@/flavours/glitch/store/typed_functions';
|
||||
|
||||
import { deleteModal } from '../initial_state';
|
||||
import { selectStatusInteractions } from '../selectors/statuses';
|
||||
|
||||
import { showAlert, showGenericAlert } from './alerts';
|
||||
import { replyCompose } from './compose';
|
||||
import { quoteComposeById } from './compose_typed';
|
||||
import { importFetchedStatus, importFetchedStatuses } from './importer';
|
||||
import {
|
||||
bookmark,
|
||||
favourite,
|
||||
pin,
|
||||
unbookmark,
|
||||
unfavourite,
|
||||
unpin,
|
||||
} from './interactions';
|
||||
import { openModal } from './modal';
|
||||
import {
|
||||
deleteStatus,
|
||||
editStatus,
|
||||
muteStatus,
|
||||
setStatusQuotePolicy,
|
||||
unmuteStatus,
|
||||
} from './statuses';
|
||||
|
||||
export type StatusInteractionIntent =
|
||||
| 'bookmark'
|
||||
| 'delete'
|
||||
| 'editQuotePolicy'
|
||||
| 'edit'
|
||||
| 'embed'
|
||||
| 'favourite'
|
||||
| 'filter'
|
||||
| 'mute'
|
||||
| 'pin'
|
||||
| 'quote'
|
||||
| 'reblog'
|
||||
| 'redraft'
|
||||
| 'reply'
|
||||
| 'report'
|
||||
| 'revokeQuote';
|
||||
|
||||
const messages = defineMessages({
|
||||
noEdits: {
|
||||
id: 'status.cannot_edit',
|
||||
defaultMessage: 'You are not allowed to edit this post',
|
||||
},
|
||||
privateStatus: {
|
||||
id: 'status.public_only',
|
||||
defaultMessage: 'This post is private',
|
||||
},
|
||||
notQuoted: {
|
||||
id: 'status.not_quoted',
|
||||
defaultMessage: 'You are not quoted in this post',
|
||||
},
|
||||
});
|
||||
|
||||
export const statusInteraction = createAppThunk(
|
||||
(
|
||||
{
|
||||
statusId,
|
||||
contextType,
|
||||
intent,
|
||||
}: {
|
||||
statusId: string;
|
||||
contextType?: StatusContextType;
|
||||
intent: StatusInteractionIntent;
|
||||
},
|
||||
{ getState, dispatch },
|
||||
) => {
|
||||
const state = getState();
|
||||
const statusImmutable = state.statuses.get(statusId);
|
||||
if (!statusImmutable) {
|
||||
dispatch(showGenericAlert());
|
||||
return;
|
||||
}
|
||||
const status = statusImmutable.toJS() as unknown as StatusShape;
|
||||
|
||||
// Check the permissions and respond if it's not allowed.
|
||||
const interactions = selectStatusInteractions(state, statusId);
|
||||
const permissions = interactions[intent];
|
||||
if (!permissions.allowed) {
|
||||
// Must strictly check for false, as values can be undefined.
|
||||
if (permissions.isLoggedIn === false) {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
intent,
|
||||
accountId: status.account,
|
||||
url: status.uri,
|
||||
},
|
||||
}),
|
||||
);
|
||||
} else if (permissions.isMine === false) {
|
||||
dispatch(showAlert({ message: messages.noEdits }));
|
||||
} else if (
|
||||
permissions.isNotDirect === false ||
|
||||
permissions.isPublic === false
|
||||
) {
|
||||
dispatch(showAlert({ message: messages.privateStatus }));
|
||||
} else if (permissions.isQuoted === false) {
|
||||
dispatch(showAlert({ message: messages.notQuoted }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle intents for all statuses.
|
||||
switch (intent) {
|
||||
case 'bookmark':
|
||||
if (status.bookmarked) {
|
||||
dispatch(unbookmark(statusImmutable));
|
||||
} else {
|
||||
dispatch(bookmark(statusImmutable));
|
||||
}
|
||||
return;
|
||||
case 'delete':
|
||||
if (!deleteModal) {
|
||||
void dispatch(deleteStatus(statusId));
|
||||
} else {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_DELETE_STATUS',
|
||||
modalProps: { statusId },
|
||||
}),
|
||||
);
|
||||
}
|
||||
return;
|
||||
case 'edit': {
|
||||
const composerText = state.compose.get('text');
|
||||
if (typeof composerText === 'string' && composerText.trim()) {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_EDIT_STATUS',
|
||||
modalProps: { statusId },
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
dispatch(editStatus(statusId));
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'editQuotePolicy':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'COMPOSE_PRIVACY',
|
||||
modalProps: {
|
||||
statusId,
|
||||
onChange: ((_, policy) => {
|
||||
void dispatch(setStatusQuotePolicy({ statusId, policy }));
|
||||
}) satisfies VisibilityModalCallback,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'embed':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'EMBED',
|
||||
modalProps: { id: statusId },
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'filter':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'FILTER',
|
||||
modalProps: { statusId, contextType },
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'favourite':
|
||||
if (status.favourited) {
|
||||
dispatch(unfavourite(statusImmutable));
|
||||
} else {
|
||||
dispatch(favourite(statusImmutable));
|
||||
}
|
||||
return;
|
||||
case 'mute':
|
||||
if (status.muted) {
|
||||
dispatch(unmuteStatus(statusId));
|
||||
} else {
|
||||
dispatch(muteStatus(statusId));
|
||||
}
|
||||
return;
|
||||
case 'pin':
|
||||
if (status.pinned) {
|
||||
dispatch(unpin(statusImmutable));
|
||||
} else {
|
||||
dispatch(pin(statusImmutable));
|
||||
}
|
||||
return;
|
||||
case 'quote':
|
||||
dispatch(quoteComposeById(statusId));
|
||||
return;
|
||||
case 'reblog':
|
||||
if (status.reblogged) {
|
||||
void dispatch(unreblog({ statusId }));
|
||||
} else {
|
||||
void dispatch(reblog({ statusId, visibility: status.visibility }));
|
||||
}
|
||||
return;
|
||||
case 'redraft':
|
||||
if (!deleteModal) {
|
||||
void dispatch(deleteStatus(statusId, true));
|
||||
} else {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_DELETE_STATUS',
|
||||
modalProps: {
|
||||
statusId,
|
||||
withRedraft: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return;
|
||||
case 'reply':
|
||||
dispatch(replyCompose(statusImmutable));
|
||||
return;
|
||||
case 'report':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'REPORT',
|
||||
modalProps: {
|
||||
accountId: status.account,
|
||||
statusId: statusId,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'revokeQuote':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_REVOKE_QUOTE',
|
||||
modalProps: {
|
||||
statusId: statusId,
|
||||
quotedStatusId: status.quote?.quoted_status,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export const reblog = createDataLoadingThunk(
|
||||
'status/reblog',
|
||||
|
||||
@@ -16,19 +16,9 @@ import {
|
||||
|
||||
import type { AttachmentArgs } from './testing';
|
||||
import { attachmentArgTypes, attachmentFactory } from './testing';
|
||||
import type { StatusContextType } from './types';
|
||||
import { TypedStatus } from './types';
|
||||
|
||||
type ContextTypes =
|
||||
| 'account'
|
||||
| 'bookmarks'
|
||||
| 'detailed'
|
||||
| 'favourites'
|
||||
| 'home'
|
||||
| 'notifications'
|
||||
| 'public'
|
||||
| 'search'
|
||||
| 'thread';
|
||||
|
||||
interface StatusStoryProps extends AttachmentArgs {
|
||||
// Contents
|
||||
text: string;
|
||||
@@ -51,7 +41,7 @@ interface StatusStoryProps extends AttachmentArgs {
|
||||
|
||||
// Display
|
||||
showThread?: boolean;
|
||||
contextType?: ContextTypes;
|
||||
contextType?: StatusContextType;
|
||||
showCounters?: boolean;
|
||||
favouriteCount?: number;
|
||||
reblogCount?: number;
|
||||
@@ -319,6 +309,7 @@ const meta = {
|
||||
options: [
|
||||
'account',
|
||||
'bookmarks',
|
||||
'composer',
|
||||
'detailed',
|
||||
'favourites',
|
||||
'home',
|
||||
@@ -326,7 +317,7 @@ const meta = {
|
||||
'public',
|
||||
'search',
|
||||
'thread',
|
||||
] satisfies ContextTypes[],
|
||||
] satisfies StatusContextType[],
|
||||
},
|
||||
hidden: categoryDisplay,
|
||||
muted: categoryDisplay,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ComponentType, MouseEventHandler, ReactNode } from 'react';
|
||||
|
||||
import StatusContainer from '@/flavours/glitch/containers/status_container';
|
||||
import type { Account as TAccount } from '@/flavours/glitch/models/account';
|
||||
import type { Status as TStatus } from '@/flavours/glitch/models/status';
|
||||
|
||||
@@ -7,15 +8,55 @@ import Status from '../status';
|
||||
|
||||
import type { StatusHeaderRenderFn } from './header';
|
||||
|
||||
// Taken from the Status component.
|
||||
export interface StatusProps {
|
||||
status: TStatus;
|
||||
export type StatusContextType =
|
||||
| 'account'
|
||||
| 'bookmarks'
|
||||
| 'composer'
|
||||
| 'detailed'
|
||||
| 'favourites'
|
||||
| 'home'
|
||||
| `list:${string}`
|
||||
| 'notifications'
|
||||
| 'public'
|
||||
| 'search'
|
||||
| 'thread';
|
||||
|
||||
export interface StatusContainerProps {
|
||||
id?: string | null;
|
||||
account?: TAccount;
|
||||
children?: ReactNode;
|
||||
previousId?: string;
|
||||
nextInReplyToId?: string;
|
||||
rootId?: string;
|
||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||
muted?: boolean;
|
||||
hidden?: boolean;
|
||||
unread?: boolean;
|
||||
featured?: boolean;
|
||||
showThread?: boolean;
|
||||
showActions?: boolean;
|
||||
isQuotedPost?: boolean;
|
||||
shouldHighlightOnMount?: boolean;
|
||||
contextType?: StatusContextType;
|
||||
withCounters?: boolean;
|
||||
unfocusable?: boolean;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
getScrollPosition?: () => null | { height: number; top: number };
|
||||
updateScrollBottom?: (snapshot: number) => void;
|
||||
cacheMediaWidth?: (width: number) => void;
|
||||
cachedMediaWidth?: number;
|
||||
scrollKey?: string;
|
||||
skipPrepend?: boolean;
|
||||
avatarSize?: number;
|
||||
withDismiss?: boolean;
|
||||
}
|
||||
|
||||
export const TypedStatusContainer =
|
||||
StatusContainer as ComponentType<StatusContainerProps>;
|
||||
|
||||
// Taken from the Status component.
|
||||
export interface StatusProps extends StatusContainerProps {
|
||||
status: TStatus;
|
||||
nextInReplyToId?: string;
|
||||
onReply: (status: TStatus) => void;
|
||||
onFavourite: (status: TStatus) => void;
|
||||
onReblog: (status: TStatus, event?: unknown) => void;
|
||||
@@ -44,31 +85,12 @@ export interface StatusProps {
|
||||
onToggleCollapsed: (status: TStatus, isCollapsed: boolean) => void;
|
||||
onTranslate: (status: TStatus) => void;
|
||||
onInteractionModal?: (type: string, status: TStatus) => void;
|
||||
muted?: boolean;
|
||||
hidden?: boolean;
|
||||
unread?: boolean;
|
||||
featured?: boolean;
|
||||
showThread?: boolean;
|
||||
showActions?: boolean;
|
||||
isQuotedPost?: boolean;
|
||||
shouldHighlightOnMount?: boolean;
|
||||
getScrollPosition?: () => null | { height: number; top: number };
|
||||
updateScrollBottom?: (snapshot: number) => void;
|
||||
cacheMediaWidth?: (width: number) => void;
|
||||
cachedMediaWidth?: number;
|
||||
scrollKey?: string;
|
||||
skipPrepend?: boolean;
|
||||
avatarSize?: number;
|
||||
deployPictureInPicture: (
|
||||
status: TStatus,
|
||||
type: string,
|
||||
mediaProps: unknown,
|
||||
) => void;
|
||||
unfocusable?: boolean;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
pictureInPicture: Immutable.Map<'inUse' | 'available', boolean>;
|
||||
contextType?: string;
|
||||
withCounters?: boolean;
|
||||
}
|
||||
|
||||
export const TypedStatus = Status as ComponentType<StatusProps>;
|
||||
@@ -1,13 +1,13 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import type { ComponentType, ReactNode } from 'react';
|
||||
|
||||
import { defineMessage, FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
import type { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
import type { Merge } from 'type-fest';
|
||||
|
||||
import CancelFillIcon from '@/material-icons/400-24px/cancel-fill.svg?react';
|
||||
import { LearnMoreLink } from 'flavours/glitch/components/learn_more_link';
|
||||
import StatusContainer from 'flavours/glitch/containers/status_container';
|
||||
import { domain } from 'flavours/glitch/initial_state';
|
||||
import type { Account } from 'flavours/glitch/models/account';
|
||||
import type { Status } from 'flavours/glitch/models/status';
|
||||
@@ -24,6 +24,8 @@ import { Button } from './button';
|
||||
import { IconButton } from './icon_button';
|
||||
import type { StatusHeaderRenderFn } from './status/header';
|
||||
import { StatusHeader } from './status/header';
|
||||
import { TypedStatusContainer } from './status/types';
|
||||
import type { StatusContainerProps, StatusContextType } from './status/types';
|
||||
|
||||
const MAX_QUOTE_POSTS_NESTING_LEVEL = 1;
|
||||
|
||||
@@ -144,24 +146,9 @@ const FilteredQuote: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
// Adds a wrapper around StatusContainer as the types aren't inheriting correctly with Redux + React 19.
|
||||
// TODO: Remove this after the Status component is in TS.
|
||||
interface StatusContainerForQuotesProps {
|
||||
id?: string | null;
|
||||
contextType?: string;
|
||||
isQuotedPost?: boolean;
|
||||
avatarSize?: number;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
children?: ReactNode;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
const StatusContainerWithChildren =
|
||||
StatusContainer as unknown as ComponentType<StatusContainerForQuotesProps>;
|
||||
|
||||
interface QuotedStatusProps {
|
||||
quote: QuoteMap;
|
||||
contextType?: string;
|
||||
contextType?: StatusContextType;
|
||||
parentQuotePostId?: string | null;
|
||||
variant?: 'full' | 'link';
|
||||
nestingLevel?: number;
|
||||
@@ -355,7 +342,7 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
|
||||
return (
|
||||
<div className='status__quote'>
|
||||
<StatusContainerWithChildren
|
||||
<TypedStatusContainer
|
||||
isQuotedPost
|
||||
id={quotedStatusId}
|
||||
contextType={contextType}
|
||||
@@ -373,16 +360,17 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
nestingLevel={nestingLevel + 1}
|
||||
/>
|
||||
)}
|
||||
</StatusContainerWithChildren>
|
||||
</TypedStatusContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
interface StatusQuoteManagerProps {
|
||||
id: string;
|
||||
contextType?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export type StatusQuoteManagerProps = Merge<
|
||||
StatusContainerProps,
|
||||
{
|
||||
id: string;
|
||||
}
|
||||
>;
|
||||
|
||||
/**
|
||||
* This wrapper component takes a status ID and, if the associated status
|
||||
@@ -400,15 +388,15 @@ export const StatusQuoteManager = (props: StatusQuoteManagerProps) => {
|
||||
|
||||
if (quote) {
|
||||
return (
|
||||
<StatusContainerWithChildren {...props}>
|
||||
<TypedStatusContainer {...props}>
|
||||
<QuotedStatus
|
||||
quote={quote}
|
||||
parentQuotePostId={status?.get('id') as string}
|
||||
contextType={props.contextType}
|
||||
/>
|
||||
</StatusContainerWithChildren>
|
||||
</TypedStatusContainer>
|
||||
);
|
||||
}
|
||||
|
||||
return <StatusContainerWithChildren {...props} />;
|
||||
return <TypedStatusContainer {...props} />;
|
||||
};
|
||||
@@ -26,8 +26,6 @@ const messages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
type InteractionIntent = 'follow' | 'reblog' | 'favourite' | 'reply' | 'vote';
|
||||
|
||||
interface LoginFormMessage {
|
||||
type:
|
||||
| 'fetchInteractionURL'
|
||||
@@ -36,7 +34,7 @@ interface LoginFormMessage {
|
||||
uri_or_domain: string;
|
||||
template?: string;
|
||||
param?: string;
|
||||
intent?: InteractionIntent;
|
||||
intent?: string;
|
||||
}
|
||||
|
||||
const PERSISTENCE_KEY = 'mastodon_home';
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { Map as ImmutableMap } from 'immutable';
|
||||
import { Record as ImmutableRecord, List as ImmutableList } from 'immutable';
|
||||
|
||||
import { me } from 'flavours/glitch/initial_state';
|
||||
import { accountDefaultValues } from 'flavours/glitch/models/account';
|
||||
import { me } from '@/flavours/glitch/initial_state';
|
||||
import { accountDefaultValues } from '@/flavours/glitch/models/account';
|
||||
import type {
|
||||
Account,
|
||||
AccountShape,
|
||||
AccountShapeFull,
|
||||
} from 'flavours/glitch/models/account';
|
||||
import type { Relationship } from 'flavours/glitch/models/relationship';
|
||||
import { createAppSelector } from 'flavours/glitch/store';
|
||||
import type { RootState } from 'flavours/glitch/store';
|
||||
} from '@/flavours/glitch/models/account';
|
||||
import type { Relationship } from '@/flavours/glitch/models/relationship';
|
||||
import type { RootState } from '@/flavours/glitch/store';
|
||||
import { createAppSelector } from '@/flavours/glitch/store/typed_functions';
|
||||
|
||||
import type { ApiHashtagJSON } from '../api_types/tags';
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import type { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||
|
||||
import { createAppSelector } from 'flavours/glitch/store';
|
||||
|
||||
import type { ExpandedStatusShape, StatusShape } from '../models/status';
|
||||
import type { StatusInteractionIntent } from '@/flavours/glitch/actions/interactions_typed';
|
||||
import type {
|
||||
ExpandedStatusShape,
|
||||
StatusShape,
|
||||
} from '@/flavours/glitch/models/status';
|
||||
import { createAppSelector } from '@/flavours/glitch/store/typed_functions';
|
||||
|
||||
import { selectPlainAccount } from './accounts';
|
||||
import type { FilterShape } from './filters';
|
||||
@@ -71,6 +74,75 @@ export const selectExpandedStatus = createAppSelector(
|
||||
},
|
||||
);
|
||||
|
||||
export const selectStatusConditions = createAppSelector(
|
||||
[
|
||||
selectPlainStatus,
|
||||
(state) => state.meta.get('me', null) as string | null,
|
||||
(state, statusId: string) =>
|
||||
state.statuses.getIn([
|
||||
state.statuses.getIn([statusId, 'quote', 'quoted_status']),
|
||||
'account',
|
||||
]) as string | undefined | null,
|
||||
],
|
||||
(status, currentAccountId, quotedAccountId) => ({
|
||||
isPublic: status && ['public', 'unlisted'].includes(status.visibility),
|
||||
isLoggedIn: !!currentAccountId,
|
||||
isMine: status && !!currentAccountId && status.account === currentAccountId,
|
||||
isQuoted:
|
||||
status && !!currentAccountId && quotedAccountId === currentAccountId,
|
||||
isNotDirect: status && status.visibility !== 'direct',
|
||||
}),
|
||||
);
|
||||
|
||||
export const selectStatusInteractions = createAppSelector(
|
||||
[(_, statusId: string) => statusId, selectStatusConditions],
|
||||
(statusId, conditionals) => {
|
||||
function addAllowed(conditions: Partial<typeof conditionals>) {
|
||||
return {
|
||||
...conditions,
|
||||
allowed: Object.values(conditions).every(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
const { isLoggedIn, isMine, isPublic, isQuoted, isNotDirect } =
|
||||
conditionals;
|
||||
|
||||
const interactions: Record<
|
||||
StatusInteractionIntent,
|
||||
Partial<typeof conditionals> & { allowed: boolean }
|
||||
> = {
|
||||
bookmark: addAllowed({ isLoggedIn }),
|
||||
delete: addAllowed({ isMine }),
|
||||
edit: addAllowed({ isMine }),
|
||||
editQuotePolicy: addAllowed({ isMine, isPublic }),
|
||||
embed: addAllowed({ isPublic }),
|
||||
favourite: addAllowed({ isLoggedIn }),
|
||||
filter: addAllowed({ isLoggedIn }),
|
||||
mute: addAllowed({ isMine }),
|
||||
pin: addAllowed({ isMine, isNotDirect }),
|
||||
quote: addAllowed({ isLoggedIn }),
|
||||
reblog: addAllowed({ isLoggedIn }),
|
||||
redraft: addAllowed({ isMine }),
|
||||
reply: addAllowed({ isLoggedIn }),
|
||||
report: addAllowed({ isLoggedIn }),
|
||||
revokeQuote: addAllowed({ isQuoted }),
|
||||
};
|
||||
|
||||
return {
|
||||
statusId,
|
||||
...interactions,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const selectStatusIntentAllowed = createAppSelector(
|
||||
[
|
||||
selectStatusInteractions,
|
||||
(_state, _statusId: string, intent: StatusInteractionIntent) => intent,
|
||||
],
|
||||
(allowedInteractions, intent) => allowedInteractions[intent].allowed,
|
||||
);
|
||||
|
||||
export const selectPictureInPicture = createAppSelector(
|
||||
[
|
||||
(state, statusId: string) =>
|
||||
|
||||
@@ -7,6 +7,8 @@ import type { AxiosResponse } from 'axios';
|
||||
|
||||
import type { Alert } from 'mastodon/models/alert';
|
||||
|
||||
import { createAppThunk } from '../store/typed_functions';
|
||||
|
||||
interface ApiErrorResponse {
|
||||
error?: string;
|
||||
}
|
||||
@@ -74,3 +76,12 @@ export const showAlertForError = (error: unknown, skipNotFound = false) => {
|
||||
message: messages.unexpectedMessage,
|
||||
});
|
||||
};
|
||||
|
||||
export const showGenericAlert = createAppThunk((_arg, { dispatch }) => {
|
||||
dispatch(
|
||||
showAlert({
|
||||
title: messages.unexpectedTitle,
|
||||
message: messages.unexpectedMessage,
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -1,13 +1,263 @@
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import {
|
||||
apiReblog,
|
||||
apiUnreblog,
|
||||
apiRevokeQuote,
|
||||
apiGetQuotes,
|
||||
} from 'mastodon/api/interactions';
|
||||
import type { StatusVisibility } from 'mastodon/models/status';
|
||||
import { createDataLoadingThunk } from 'mastodon/store/typed_functions';
|
||||
} from '@/mastodon/api/interactions';
|
||||
import type { StatusContextType } from '@/mastodon/components/status/types';
|
||||
import type { VisibilityModalCallback } from '@/mastodon/features/ui/components/visibility_modal';
|
||||
import type { StatusShape, StatusVisibility } from '@/mastodon/models/status';
|
||||
import {
|
||||
createAppThunk,
|
||||
createDataLoadingThunk,
|
||||
} from '@/mastodon/store/typed_functions';
|
||||
|
||||
import { deleteModal } from '../initial_state';
|
||||
import { selectStatusInteractions } from '../selectors/statuses';
|
||||
|
||||
import { showAlert, showGenericAlert } from './alerts';
|
||||
import { replyCompose } from './compose';
|
||||
import { quoteComposeById } from './compose_typed';
|
||||
import { importFetchedStatus, importFetchedStatuses } from './importer';
|
||||
import {
|
||||
bookmark,
|
||||
favourite,
|
||||
pin,
|
||||
unbookmark,
|
||||
unfavourite,
|
||||
unpin,
|
||||
} from './interactions';
|
||||
import { openModal } from './modal';
|
||||
import {
|
||||
deleteStatus,
|
||||
editStatus,
|
||||
muteStatus,
|
||||
setStatusQuotePolicy,
|
||||
unmuteStatus,
|
||||
} from './statuses';
|
||||
|
||||
export type StatusInteractionIntent =
|
||||
| 'bookmark'
|
||||
| 'delete'
|
||||
| 'editQuotePolicy'
|
||||
| 'edit'
|
||||
| 'embed'
|
||||
| 'favourite'
|
||||
| 'filter'
|
||||
| 'mute'
|
||||
| 'pin'
|
||||
| 'quote'
|
||||
| 'reblog'
|
||||
| 'redraft'
|
||||
| 'reply'
|
||||
| 'report'
|
||||
| 'revokeQuote';
|
||||
|
||||
const messages = defineMessages({
|
||||
noEdits: {
|
||||
id: 'status.cannot_edit',
|
||||
defaultMessage: 'You are not allowed to edit this post',
|
||||
},
|
||||
privateStatus: {
|
||||
id: 'status.public_only',
|
||||
defaultMessage: 'This post is private',
|
||||
},
|
||||
notQuoted: {
|
||||
id: 'status.not_quoted',
|
||||
defaultMessage: 'You are not quoted in this post',
|
||||
},
|
||||
});
|
||||
|
||||
export const statusInteraction = createAppThunk(
|
||||
(
|
||||
{
|
||||
statusId,
|
||||
contextType,
|
||||
intent,
|
||||
}: {
|
||||
statusId: string;
|
||||
contextType?: StatusContextType;
|
||||
intent: StatusInteractionIntent;
|
||||
},
|
||||
{ getState, dispatch },
|
||||
) => {
|
||||
const state = getState();
|
||||
const statusImmutable = state.statuses.get(statusId);
|
||||
if (!statusImmutable) {
|
||||
dispatch(showGenericAlert());
|
||||
return;
|
||||
}
|
||||
const status = statusImmutable.toJS() as unknown as StatusShape;
|
||||
|
||||
// Check the permissions and respond if it's not allowed.
|
||||
const interactions = selectStatusInteractions(state, statusId);
|
||||
const permissions = interactions[intent];
|
||||
if (!permissions.allowed) {
|
||||
// Must strictly check for false, as values can be undefined.
|
||||
if (permissions.isLoggedIn === false) {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'INTERACTION',
|
||||
modalProps: {
|
||||
intent,
|
||||
accountId: status.account,
|
||||
url: status.uri,
|
||||
},
|
||||
}),
|
||||
);
|
||||
} else if (permissions.isMine === false) {
|
||||
dispatch(showAlert({ message: messages.noEdits }));
|
||||
} else if (
|
||||
permissions.isNotDirect === false ||
|
||||
permissions.isPublic === false
|
||||
) {
|
||||
dispatch(showAlert({ message: messages.privateStatus }));
|
||||
} else if (permissions.isQuoted === false) {
|
||||
dispatch(showAlert({ message: messages.notQuoted }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle intents for all statuses.
|
||||
switch (intent) {
|
||||
case 'bookmark':
|
||||
if (status.bookmarked) {
|
||||
dispatch(unbookmark(statusImmutable));
|
||||
} else {
|
||||
dispatch(bookmark(statusImmutable));
|
||||
}
|
||||
return;
|
||||
case 'delete':
|
||||
if (!deleteModal) {
|
||||
void dispatch(deleteStatus(statusId));
|
||||
} else {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_DELETE_STATUS',
|
||||
modalProps: { statusId },
|
||||
}),
|
||||
);
|
||||
}
|
||||
return;
|
||||
case 'edit': {
|
||||
const composerText = state.compose.get('text');
|
||||
if (typeof composerText === 'string' && composerText.trim()) {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_EDIT_STATUS',
|
||||
modalProps: { statusId },
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
dispatch(editStatus(statusId));
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'editQuotePolicy':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'COMPOSE_PRIVACY',
|
||||
modalProps: {
|
||||
statusId,
|
||||
onChange: ((_, policy) => {
|
||||
void dispatch(setStatusQuotePolicy({ statusId, policy }));
|
||||
}) satisfies VisibilityModalCallback,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'embed':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'EMBED',
|
||||
modalProps: { id: statusId },
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'filter':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'FILTER',
|
||||
modalProps: { statusId, contextType },
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'favourite':
|
||||
if (status.favourited) {
|
||||
dispatch(unfavourite(statusImmutable));
|
||||
} else {
|
||||
dispatch(favourite(statusImmutable));
|
||||
}
|
||||
return;
|
||||
case 'mute':
|
||||
if (status.muted) {
|
||||
dispatch(unmuteStatus(statusId));
|
||||
} else {
|
||||
dispatch(muteStatus(statusId));
|
||||
}
|
||||
return;
|
||||
case 'pin':
|
||||
if (status.pinned) {
|
||||
dispatch(unpin(statusImmutable));
|
||||
} else {
|
||||
dispatch(pin(statusImmutable));
|
||||
}
|
||||
return;
|
||||
case 'quote':
|
||||
dispatch(quoteComposeById(statusId));
|
||||
return;
|
||||
case 'reblog':
|
||||
if (status.reblogged) {
|
||||
void dispatch(unreblog({ statusId }));
|
||||
} else {
|
||||
void dispatch(reblog({ statusId, visibility: status.visibility }));
|
||||
}
|
||||
return;
|
||||
case 'redraft':
|
||||
if (!deleteModal) {
|
||||
void dispatch(deleteStatus(statusId, true));
|
||||
} else {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_DELETE_STATUS',
|
||||
modalProps: {
|
||||
statusId,
|
||||
withRedraft: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return;
|
||||
case 'reply':
|
||||
dispatch(replyCompose(statusImmutable));
|
||||
return;
|
||||
case 'report':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'REPORT',
|
||||
modalProps: {
|
||||
accountId: status.account,
|
||||
statusId: statusId,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
case 'revokeQuote':
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM_REVOKE_QUOTE',
|
||||
modalProps: {
|
||||
statusId: statusId,
|
||||
quotedStatusId: status.quote?.quoted_status,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export const reblog = createDataLoadingThunk(
|
||||
'status/reblog',
|
||||
|
||||
@@ -16,19 +16,9 @@ import {
|
||||
|
||||
import type { AttachmentArgs } from './testing';
|
||||
import { attachmentArgTypes, attachmentFactory } from './testing';
|
||||
import type { StatusContextType } from './types';
|
||||
import { TypedStatus } from './types';
|
||||
|
||||
type ContextTypes =
|
||||
| 'account'
|
||||
| 'bookmarks'
|
||||
| 'detailed'
|
||||
| 'favourites'
|
||||
| 'home'
|
||||
| 'notifications'
|
||||
| 'public'
|
||||
| 'search'
|
||||
| 'thread';
|
||||
|
||||
interface StatusStoryProps extends AttachmentArgs {
|
||||
// Contents
|
||||
text: string;
|
||||
@@ -51,7 +41,7 @@ interface StatusStoryProps extends AttachmentArgs {
|
||||
|
||||
// Display
|
||||
showThread?: boolean;
|
||||
contextType?: ContextTypes;
|
||||
contextType?: StatusContextType;
|
||||
showCounters?: boolean;
|
||||
favouriteCount?: number;
|
||||
reblogCount?: number;
|
||||
@@ -319,6 +309,7 @@ const meta = {
|
||||
options: [
|
||||
'account',
|
||||
'bookmarks',
|
||||
'composer',
|
||||
'detailed',
|
||||
'favourites',
|
||||
'home',
|
||||
@@ -326,7 +317,7 @@ const meta = {
|
||||
'public',
|
||||
'search',
|
||||
'thread',
|
||||
] satisfies ContextTypes[],
|
||||
] satisfies StatusContextType[],
|
||||
},
|
||||
hidden: categoryDisplay,
|
||||
muted: categoryDisplay,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ComponentType, MouseEventHandler, ReactNode } from 'react';
|
||||
|
||||
import StatusContainer from '@/mastodon/containers/status_container';
|
||||
import type { Account as TAccount } from '@/mastodon/models/account';
|
||||
import type { Status as TStatus } from '@/mastodon/models/status';
|
||||
|
||||
@@ -7,15 +8,55 @@ import Status from '../status';
|
||||
|
||||
import type { StatusHeaderRenderFn } from './header';
|
||||
|
||||
// Taken from the Status component.
|
||||
export interface StatusProps {
|
||||
status: TStatus;
|
||||
export type StatusContextType =
|
||||
| 'account'
|
||||
| 'bookmarks'
|
||||
| 'composer'
|
||||
| 'detailed'
|
||||
| 'favourites'
|
||||
| 'home'
|
||||
| `list:${string}`
|
||||
| 'notifications'
|
||||
| 'public'
|
||||
| 'search'
|
||||
| 'thread';
|
||||
|
||||
export interface StatusContainerProps {
|
||||
id?: string | null;
|
||||
account?: TAccount;
|
||||
children?: ReactNode;
|
||||
previousId?: string;
|
||||
nextInReplyToId?: string;
|
||||
rootId?: string;
|
||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||
muted?: boolean;
|
||||
hidden?: boolean;
|
||||
unread?: boolean;
|
||||
featured?: boolean;
|
||||
showThread?: boolean;
|
||||
showActions?: boolean;
|
||||
isQuotedPost?: boolean;
|
||||
shouldHighlightOnMount?: boolean;
|
||||
contextType?: StatusContextType;
|
||||
withCounters?: boolean;
|
||||
unfocusable?: boolean;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
getScrollPosition?: () => null | { height: number; top: number };
|
||||
updateScrollBottom?: (snapshot: number) => void;
|
||||
cacheMediaWidth?: (width: number) => void;
|
||||
cachedMediaWidth?: number;
|
||||
scrollKey?: string;
|
||||
skipPrepend?: boolean;
|
||||
avatarSize?: number;
|
||||
withDismiss?: boolean;
|
||||
}
|
||||
|
||||
export const TypedStatusContainer =
|
||||
StatusContainer as ComponentType<StatusContainerProps>;
|
||||
|
||||
// Taken from the Status component.
|
||||
export interface StatusProps extends StatusContainerProps {
|
||||
status: TStatus;
|
||||
nextInReplyToId?: string;
|
||||
onReply: (status: TStatus) => void;
|
||||
onFavourite: (status: TStatus) => void;
|
||||
onReblog: (status: TStatus, event?: unknown) => void;
|
||||
@@ -44,31 +85,12 @@ export interface StatusProps {
|
||||
onToggleCollapsed: (status: TStatus, isCollapsed: boolean) => void;
|
||||
onTranslate: (status: TStatus) => void;
|
||||
onInteractionModal?: (type: string, status: TStatus) => void;
|
||||
muted?: boolean;
|
||||
hidden?: boolean;
|
||||
unread?: boolean;
|
||||
featured?: boolean;
|
||||
showThread?: boolean;
|
||||
showActions?: boolean;
|
||||
isQuotedPost?: boolean;
|
||||
shouldHighlightOnMount?: boolean;
|
||||
getScrollPosition?: () => null | { height: number; top: number };
|
||||
updateScrollBottom?: (snapshot: number) => void;
|
||||
cacheMediaWidth?: (width: number) => void;
|
||||
cachedMediaWidth?: number;
|
||||
scrollKey?: string;
|
||||
skipPrepend?: boolean;
|
||||
avatarSize?: number;
|
||||
deployPictureInPicture: (
|
||||
status: TStatus,
|
||||
type: string,
|
||||
mediaProps: unknown,
|
||||
) => void;
|
||||
unfocusable?: boolean;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
pictureInPicture: Immutable.Map<'inUse' | 'available', boolean>;
|
||||
contextType?: string;
|
||||
withCounters?: boolean;
|
||||
}
|
||||
|
||||
export const TypedStatus = Status as ComponentType<StatusProps>;
|
||||
@@ -1,16 +1,16 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import type { ComponentType, ReactNode } from 'react';
|
||||
|
||||
import { defineMessage, FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
import type { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
import type { Merge } from 'type-fest';
|
||||
|
||||
import CancelFillIcon from '@/material-icons/400-24px/cancel-fill.svg?react';
|
||||
import { fetchRelationships } from 'mastodon/actions/accounts';
|
||||
import { revealAccount } from 'mastodon/actions/accounts_typed';
|
||||
import { fetchStatus } from 'mastodon/actions/statuses';
|
||||
import { LearnMoreLink } from 'mastodon/components/learn_more_link';
|
||||
import StatusContainer from 'mastodon/containers/status_container';
|
||||
import { domain } from 'mastodon/initial_state';
|
||||
import type { Account } from 'mastodon/models/account';
|
||||
import type { Status } from 'mastodon/models/status';
|
||||
@@ -23,6 +23,8 @@ import { Button } from './button';
|
||||
import { IconButton } from './icon_button';
|
||||
import type { StatusHeaderRenderFn } from './status/header';
|
||||
import { StatusHeader } from './status/header';
|
||||
import { TypedStatusContainer } from './status/types';
|
||||
import type { StatusContainerProps, StatusContextType } from './status/types';
|
||||
|
||||
const MAX_QUOTE_POSTS_NESTING_LEVEL = 1;
|
||||
|
||||
@@ -143,24 +145,9 @@ const FilteredQuote: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
// Adds a wrapper around StatusContainer as the types aren't inheriting correctly with Redux + React 19.
|
||||
// TODO: Remove this after the Status component is in TS.
|
||||
interface StatusContainerForQuotesProps {
|
||||
id?: string | null;
|
||||
contextType?: string;
|
||||
isQuotedPost?: boolean;
|
||||
avatarSize?: number;
|
||||
headerRenderFn?: StatusHeaderRenderFn;
|
||||
children?: ReactNode;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
const StatusContainerWithChildren =
|
||||
StatusContainer as unknown as ComponentType<StatusContainerForQuotesProps>;
|
||||
|
||||
interface QuotedStatusProps {
|
||||
quote: QuoteMap;
|
||||
contextType?: string;
|
||||
contextType?: StatusContextType;
|
||||
parentQuotePostId?: string | null;
|
||||
variant?: 'full' | 'link';
|
||||
nestingLevel?: number;
|
||||
@@ -354,7 +341,7 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
|
||||
return (
|
||||
<div className='status__quote'>
|
||||
<StatusContainerWithChildren
|
||||
<TypedStatusContainer
|
||||
isQuotedPost
|
||||
id={quotedStatusId}
|
||||
contextType={contextType}
|
||||
@@ -372,16 +359,17 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
nestingLevel={nestingLevel + 1}
|
||||
/>
|
||||
)}
|
||||
</StatusContainerWithChildren>
|
||||
</TypedStatusContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export interface StatusQuoteManagerProps {
|
||||
id: string;
|
||||
contextType?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export type StatusQuoteManagerProps = Merge<
|
||||
StatusContainerProps,
|
||||
{
|
||||
id: string;
|
||||
}
|
||||
>;
|
||||
|
||||
/**
|
||||
* This wrapper component takes a status ID and, if the associated status
|
||||
@@ -399,15 +387,15 @@ export const StatusQuoteManager = (props: StatusQuoteManagerProps) => {
|
||||
|
||||
if (quote) {
|
||||
return (
|
||||
<StatusContainerWithChildren {...props}>
|
||||
<TypedStatusContainer {...props}>
|
||||
<QuotedStatus
|
||||
quote={quote}
|
||||
parentQuotePostId={status?.get('id') as string}
|
||||
contextType={props.contextType}
|
||||
/>
|
||||
</StatusContainerWithChildren>
|
||||
</TypedStatusContainer>
|
||||
);
|
||||
}
|
||||
|
||||
return <StatusContainerWithChildren {...props} />;
|
||||
return <TypedStatusContainer {...props} />;
|
||||
};
|
||||
@@ -26,8 +26,6 @@ const messages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
type InteractionIntent = 'follow' | 'reblog' | 'favourite' | 'reply' | 'vote';
|
||||
|
||||
interface LoginFormMessage {
|
||||
type:
|
||||
| 'fetchInteractionURL'
|
||||
@@ -36,7 +34,7 @@ interface LoginFormMessage {
|
||||
uri_or_domain: string;
|
||||
template?: string;
|
||||
param?: string;
|
||||
intent?: InteractionIntent;
|
||||
intent?: string;
|
||||
}
|
||||
|
||||
const PERSISTENCE_KEY = 'mastodon_home';
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Заблакіраваць @{name}",
|
||||
"status.bookmark": "Дадаць закладку",
|
||||
"status.cancel_reblog_private": "Прыбраць",
|
||||
"status.cannot_edit": "Вы не маеце дазвол рэдагаваць гэты допіс",
|
||||
"status.cannot_quote": "Вы не маеце дазвол цытаваць гэты допіс",
|
||||
"status.cannot_reblog": "Гэты допіс нельга пашырыць",
|
||||
"status.contains_quote": "Утрымлівае цытату",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Больш",
|
||||
"status.mute": "Ігнараваць @{name}",
|
||||
"status.mute_conversation": "Ігнараваць размову",
|
||||
"status.not_quoted": "Вас не цытавалі ў гэтым допісе",
|
||||
"status.open": "Разгарнуць гэты допіс",
|
||||
"status.pin": "Замацаваць у профілі",
|
||||
"status.public_only": "Гэты допіс прыватны",
|
||||
"status.quote": "Цытаваць",
|
||||
"status.quote.cancel": "Адмяніць цытаванне",
|
||||
"status.quote_error.blocked_account_hint.title": "Гэты допіс схаваны, бо Вы заблакіравалі @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Blokér @{name}",
|
||||
"status.bookmark": "Bogmærk",
|
||||
"status.cancel_reblog_private": "Fjern fremhævelse",
|
||||
"status.cannot_edit": "Du har ikke tilladelse til at redigere dette indlæg",
|
||||
"status.cannot_quote": "Du har ikke tilladelse til at citere dette indlæg",
|
||||
"status.cannot_reblog": "Dette indlæg kan ikke fremhæves",
|
||||
"status.contains_quote": "Indeholder citat",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Mere",
|
||||
"status.mute": "Skjul @{name}",
|
||||
"status.mute_conversation": "Skjul samtale",
|
||||
"status.not_quoted": "Du er ikke citeret i denne status",
|
||||
"status.open": "Udvid dette indlæg",
|
||||
"status.pin": "Fastgør til profil",
|
||||
"status.public_only": "Denne status er privat",
|
||||
"status.quote": "Citér",
|
||||
"status.quote.cancel": "Annullér citat",
|
||||
"status.quote_error.blocked_account_hint.title": "Dette indlæg er skjult, fordi du har blokeret @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Block @{name}",
|
||||
"status.bookmark": "Bookmark",
|
||||
"status.cancel_reblog_private": "Unboost",
|
||||
"status.cannot_edit": "You are not allowed to edit this post",
|
||||
"status.cannot_quote": "You are not allowed to quote this post",
|
||||
"status.cannot_reblog": "This post cannot be boosted",
|
||||
"status.contains_quote": "Contains quote",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "More",
|
||||
"status.mute": "Mute @{name}",
|
||||
"status.mute_conversation": "Mute conversation",
|
||||
"status.not_quoted": "You are not quoted in this post",
|
||||
"status.open": "Expand this post",
|
||||
"status.pin": "Pin on profile",
|
||||
"status.public_only": "This post is private",
|
||||
"status.quote": "Quote",
|
||||
"status.quote.cancel": "Cancel quote",
|
||||
"status.quote_error.blocked_account_hint.title": "This post is hidden because you've blocked @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Bloquear a @{name}",
|
||||
"status.bookmark": "Marcar",
|
||||
"status.cancel_reblog_private": "Quitar adhesión",
|
||||
"status.cannot_edit": "No te es permitido editar este mensaje",
|
||||
"status.cannot_quote": "No te es permitido citar este mensaje",
|
||||
"status.cannot_reblog": "No se puede adherir a este mensaje",
|
||||
"status.contains_quote": "Contiene cita",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Más",
|
||||
"status.mute": "Silenciar a @{name}",
|
||||
"status.mute_conversation": "Silenciar conversación",
|
||||
"status.not_quoted": "No te citaron en este mensaje",
|
||||
"status.open": "Expandir este mensaje",
|
||||
"status.pin": "Fijar en el perfil",
|
||||
"status.public_only": "Este mensaje es privado",
|
||||
"status.quote": "Citar",
|
||||
"status.quote.cancel": "Cancelar cita",
|
||||
"status.quote_error.blocked_account_hint.title": "Este mensaje está oculto porque bloqueaste a @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Bloquear a @{name}",
|
||||
"status.bookmark": "Añadir marcador",
|
||||
"status.cancel_reblog_private": "Deshacer impulso",
|
||||
"status.cannot_edit": "No puedes editar esta publicación",
|
||||
"status.cannot_quote": "No está permitido citar esta publicación",
|
||||
"status.cannot_reblog": "Esta publicación no puede ser impulsada",
|
||||
"status.contains_quote": "Contiene cita",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Más",
|
||||
"status.mute": "Silenciar @{name}",
|
||||
"status.mute_conversation": "Silenciar conversación",
|
||||
"status.not_quoted": "No se te ha citado en este estado",
|
||||
"status.open": "Expandir estado",
|
||||
"status.pin": "Fijar",
|
||||
"status.public_only": "Este estado es privado",
|
||||
"status.quote": "Citar",
|
||||
"status.quote.cancel": "Cancelar cita",
|
||||
"status.quote_error.blocked_account_hint.title": "Esta publicación se ocultó porque bloqueaste a @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Bloquear a @{name}",
|
||||
"status.bookmark": "Añadir marcador",
|
||||
"status.cancel_reblog_private": "Deshacer impulso",
|
||||
"status.cannot_edit": "No puedes editar esta publicación",
|
||||
"status.cannot_quote": "No tienes permiso para citar esta publicación",
|
||||
"status.cannot_reblog": "Esta publicación no se puede impulsar",
|
||||
"status.contains_quote": "Contiene cita",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Más",
|
||||
"status.mute": "Silenciar @{name}",
|
||||
"status.mute_conversation": "Silenciar conversación",
|
||||
"status.not_quoted": "No se te ha citado en este estado",
|
||||
"status.open": "Expandir publicación",
|
||||
"status.pin": "Fijar",
|
||||
"status.public_only": "Este estado es privado",
|
||||
"status.quote": "Citar",
|
||||
"status.quote.cancel": "Cancelar cita",
|
||||
"status.quote_error.blocked_account_hint.title": "Esta publicación está oculta porque has bloqueado a @{name}.",
|
||||
|
||||
@@ -63,8 +63,23 @@
|
||||
"account.mute_short": "Mututu",
|
||||
"account.muted": "Mutututa",
|
||||
"account.mutual": "Elkar jarraitzen duzue",
|
||||
"account.name.help.domain_self": "{domain} zure zerbitzaria da, zure profila eta bidalketak ostatatzen dituena.",
|
||||
"account.name.help.footer": "Poste elektronikoak hornitzaile ezberdinak darabiltzaten lagunei bidali ahal dizkiezun bezalaxe, beste Mastodon zerbitzari abtzuetako erabiltzaileekin ere komunikatu zaitezke, baita Fedobertsoko beste aplikazioen erabiltzaileekin ere.",
|
||||
"account.name.help.header": "Erabiltzaile-izena posta elektroniko helbide bat bezalakoa da",
|
||||
"account.name.help.username": "{username} kontu honek zerbitzarian darabilen izena da. Baliteke beste zerbitzari bateko norbaitek erabiltzaile-izen bera izatea han.",
|
||||
"account.name.help.username_self": "{username} zure kontuak zerbitzari honetan duen izena da. Baliteke beste norbaitek izen berbera izatea beste zerbitzari batean.",
|
||||
"account.name_info": "Zer esan nahi du horrek?",
|
||||
"account.no_bio": "Ez da deskribapenik eman.",
|
||||
"account.node_modal.callout": "Ohar pertsonalak zuk bakarrik ikus ditzakezu.",
|
||||
"account.node_modal.edit_title": "Editatu ohar pertsonala",
|
||||
"account.node_modal.error_unknown": "Ezin oharra gorde",
|
||||
"account.node_modal.field_label": "Ohar pertsonala",
|
||||
"account.node_modal.save": "Gorde",
|
||||
"account.node_modal.title": "Gehitu ohar pertsonala",
|
||||
"account.note.edit_button": "Editatu",
|
||||
"account.note.title": "Ohar pertsonala (zuretzat soilik)",
|
||||
"account.open_original_page": "Ireki jatorrizko orria",
|
||||
"account.pending": "Zain",
|
||||
"account.posts": "Bidalketa",
|
||||
"account.remove_from_followers": "Kendu {name} zure jarraitzaileengandik",
|
||||
"account.report": "Salatu @{name}",
|
||||
@@ -72,6 +87,8 @@
|
||||
"account.share": "Partekatu @{name} erabiltzailearen profila",
|
||||
"account.show_reblogs": "Erakutsi @{name} erabiltzailearen bultzadak",
|
||||
"account.statuses_counter": "{count, plural, one {{counter} bidalketa} other {{counter} bidalketa}}",
|
||||
"account.timeline.pinned": "Finkatua",
|
||||
"account.timeline.pinned.view_all": "Ikusi finkatutako bidalketa guztiak",
|
||||
"account.unblock": "Desblokeatu @{name}",
|
||||
"account.unblock_domain": "Berriz erakutsi {domain}",
|
||||
"account.unblock_domain_short": "Desblokeatu",
|
||||
@@ -81,6 +98,77 @@
|
||||
"account.unmute": "Desmututu @{name}",
|
||||
"account.unmute_notifications_short": "Desmututu jakinarazpenak",
|
||||
"account.unmute_short": "Desmututu",
|
||||
"account_edit.advanced_settings.bot_hint": "Ohartarazi besteei kontu honek ekintza automatizatuak egiten dituela nagusiki, eta beharbada ez duela inork gainbegiratzen",
|
||||
"account_edit.advanced_settings.bot_label": "Kontu automatizatua",
|
||||
"account_edit.advanced_settings.title": "Ezarpen aurreratuak",
|
||||
"account_edit.bio.add_label": "Gehitu biografia",
|
||||
"account_edit.bio.edit_label": "Editatu biografia",
|
||||
"account_edit.bio.placeholder": "Gehitu aurkezpen labur bat besteei nor zaren argitzeko.",
|
||||
"account_edit.bio.title": "Biografia",
|
||||
"account_edit.bio_modal.add_title": "Gehitu biografia",
|
||||
"account_edit.bio_modal.edit_title": "Editatu biografia",
|
||||
"account_edit.column_button": "Egina",
|
||||
"account_edit.column_title": "Editatu profila",
|
||||
"account_edit.custom_fields.add_label": "Gehitu eremua",
|
||||
"account_edit.custom_fields.edit_label": "Editatu eremua",
|
||||
"account_edit.custom_fields.placeholder": "Gehitu zure izenordeak, kanpoko estekak, edo partekatu nahi duzun beste edozer.",
|
||||
"account_edit.custom_fields.reorder_button": "Berrantolatu eremuak",
|
||||
"account_edit.custom_fields.tip_content": "Sinisgarritasuna eman diezaiokezu zure Mastodon kontuari, jabe zaren edozein webgunerako estekak egiaztatuz.",
|
||||
"account_edit.custom_fields.tip_title": "Aholkua: nola gehitu egiaztatutako estekak",
|
||||
"account_edit.custom_fields.title": "Pertsonalizatutako eremuak",
|
||||
"account_edit.custom_fields.verified_hint": "Nola gehitu egiaztatutako esteka?",
|
||||
"account_edit.display_name.add_label": "Gehitu pantaila-izena",
|
||||
"account_edit.display_name.edit_label": "Editati pantaila-izena",
|
||||
"account_edit.display_name.placeholder": "Zure pantaila-izena da zure profilean eta denbora-lerroetan erakusten duzun izena.",
|
||||
"account_edit.display_name.title": "Pantaila-izena",
|
||||
"account_edit.featured_hashtags.edit_label": "Gehitu traolak",
|
||||
"account_edit.featured_hashtags.placeholder": "Lagundu besteei zure gogo gaiak antzematen eta begiratzen.",
|
||||
"account_edit.featured_hashtags.title": "Nabarmendutako traolak",
|
||||
"account_edit.field_actions.delete": "Ezabatu eremua",
|
||||
"account_edit.field_actions.edit": "Editatu eremua",
|
||||
"account_edit.field_delete_modal.confirm": "Ziur pertsonalizatutako eremu hau ezabatu nahi duzula? Ezingo duzu atzera egin.",
|
||||
"account_edit.field_delete_modal.delete_button": "Ezabatu",
|
||||
"account_edit.field_delete_modal.title": "Ezabatu eremu pertsonalizatua?",
|
||||
"account_edit.field_edit_modal.add_title": "Gehitu eremu pertsonalizatua",
|
||||
"account_edit.field_edit_modal.discard_confirm": "Baztertu",
|
||||
"account_edit.field_edit_modal.discard_message": "Gorde gabeko aldaketak dituzu. Ziur baztertu nahi dituzula?",
|
||||
"account_edit.field_edit_modal.edit_title": "Editatu eremu pertsonalizatua",
|
||||
"account_edit.field_edit_modal.length_warning": "Gomendatutako karaktere kopurua gainditua. Baliteke mugikorreko erabiltzaileek zure eremua osorik ez ikustea.",
|
||||
"account_edit.field_edit_modal.link_emoji_warning": "Gomendatzen dugu ez erabiltzea emoji pertzonalizatuak eta URLak batera. Biak dituzten eremu pertosnalizatuak tesu soil gisa erakutsiko dira, erabiltzaileak ez nahasteko.",
|
||||
"account_edit.field_edit_modal.name_hint": "Adibidez: \"Webgune pertsonala\"",
|
||||
"account_edit.field_edit_modal.name_label": "Etiketa",
|
||||
"account_edit.field_edit_modal.url_warning": "Esteka gehitzeko, mesedez gehitu {protocol} hasieran.",
|
||||
"account_edit.field_edit_modal.value_hint": "Adibidez: “https://example.me”",
|
||||
"account_edit.field_edit_modal.value_label": "Edukia",
|
||||
"account_edit.field_reorder_modal.drag_cancel": "Arrastatzea bertan behera utzi da. {item} eremua baztertu da.",
|
||||
"account_edit.field_reorder_modal.drag_end": "\"{item}\" eremua baztertu da.",
|
||||
"account_edit.upload_modal.done": "Egina",
|
||||
"account_edit.upload_modal.next": "Hurrengoa",
|
||||
"account_edit.upload_modal.step_crop.zoom": "Zooma",
|
||||
"account_edit.upload_modal.step_upload.button": "Arakatu fitxategiak",
|
||||
"account_edit.upload_modal.step_upload.dragging": "Arrastatu kargatzeko",
|
||||
"account_edit.upload_modal.step_upload.header": "Aukeratu irudi bat",
|
||||
"account_edit.upload_modal.step_upload.hint": "WEBP, PNG, GIF edo JPG formatua, gehienez {limit}MB.{br}Irudia {width}x{height}pixelera eskalatuko da.",
|
||||
"account_edit.upload_modal.title_add.avatar": "Gehitu profileko argazkia",
|
||||
"account_edit.upload_modal.title_add.header": "Gehitu goiburuko argazkia",
|
||||
"account_edit.upload_modal.title_replace.avatar": "Ordezkatu profileko argazkia",
|
||||
"account_edit.upload_modal.title_replace.header": "Ordezkatu goiburuko argazkia",
|
||||
"account_edit.verified_modal.details": "Gehitu sinesgarritasuna zure Mastodon profilari, webgune pertsonaletarako estekak egiaztatuz. Hona hemen nola funtzionatzen duen:",
|
||||
"account_edit.verified_modal.invisible_link.details": "Gehitu lotura zure webguneko header eremuan. Zatirik garrantzitsuena rel=\"me\" da, erabiltzailek sortutako edukia duten webguneetan suplantazioa galarazten baitu. Headerrean esteka etiketa bat ere erabil dezakezu {tag} ordez, baina HTMLak eskuragarri egon behar du Javascript exekutatu gabe.",
|
||||
"account_edit.verified_modal.invisible_link.summary": "Nola egin esteka ikustezin?",
|
||||
"account_edit.verified_modal.step1.header": "Kopiatu azpiko HTML kodea eta itsatsi zure webguneko header atalean",
|
||||
"account_edit.verified_modal.step2.details": "Zure webgunea lehendik ere gehitu baduzu eremu pertsonalizatu gisa, ezabatu eta berriro gehitu beharko duzu egiaztapena abiarazteko.",
|
||||
"account_edit.verified_modal.step2.header": "Gehitu zure webgunea eremu pertsonalizatu gisa",
|
||||
"account_edit.verified_modal.title": "Nola gehitu egiaztatutako esteka",
|
||||
"account_edit_tags.add_tag": "Gehitu #{tagName}",
|
||||
"account_edit_tags.column_title": "Editatu etiketak",
|
||||
"account_edit_tags.help_text": "Nabarmendutako traolak lagungarriak dira beste erabiltzaileek zure profila aurkitu eta harekin interakzioa izateko. Iragazki gisa agertzen dira zure profil orrialdeko Jarduera ikuspegian.",
|
||||
"account_edit_tags.max_tags_reached": "Gehienezko nabarmendutako traola kopurura iritsi zara.",
|
||||
"account_edit_tags.search_placeholder": "Sartu traola bat…",
|
||||
"account_edit_tags.suggestions": "Iradokizunak:",
|
||||
"account_edit_tags.tag_status_count": "{count, plural, one {bidalketa #} other {# bidalketa}}",
|
||||
"account_list.hidden_notice": "Hau zuk baino ezin duzu ikusi. Zerrenda hau beste batzuei erakusteko, hona jo: <link>{page} > {modal} > {field}</link>.",
|
||||
"account_list.total": "{total, plural, one {kontu #} other {# kontu}}",
|
||||
"admin.dashboard.daily_retention": "Erabiltzaile atxikitze-tasa izena eman ondorengo eguneko",
|
||||
"admin.dashboard.monthly_retention": "Erabiltzaile atxikitze-tasa izena eman ondorengo hilabeteko",
|
||||
"admin.dashboard.retention.average": "Batezbestekoa",
|
||||
@@ -90,6 +178,7 @@
|
||||
"admin.impact_report.instance_followers": "Gure erabiltzaileek galduko lituzketeen jarraitzaileak",
|
||||
"admin.impact_report.instance_follows": "Jarraitzaileek galduko lituzketeen beraien erabiltzaileak",
|
||||
"admin.impact_report.title": "Inpaktuaren laburpena",
|
||||
"alert.need_reload.message": "Mastodon eguneratu da. Litekeena da gauza batzuk behar bezala ez ibiltzea orrialdea birkargatzen duzun arte.",
|
||||
"alert.rate_limited.message": "Saiatu {retry_time, time, medium} barru.",
|
||||
"alert.rate_limited.title": "Abiadura mugatua",
|
||||
"alert.unexpected.message": "Ustekabeko errore bat gertatu da.",
|
||||
@@ -151,6 +240,7 @@
|
||||
"annual_report.summary.share_on_mastodon": "Partekatu Mastodonen",
|
||||
"attachments_list.unprocessed": "(prozesatu gabe)",
|
||||
"audio.hide": "Ezkutatu audioa",
|
||||
"block_modal.no_collections": "Zuotako batek ere ezin du bestea bildumetan gehitu. Automatikoki kenduko zaituztegu elkarren bildumetatik, hala badagokio.",
|
||||
"block_modal.remote_users_caveat": "{domain} zerbitzariari zure erabakia errespeta dezan eskatuko diogu. Halere, araua beteko den ezin da bermatu, zerbitzari batzuk modu desberdinean kudeatzen baitituzte blokeoak. Baliteke argitalpen publikoak saioa hasi ez duten erabiltzaileentzat ikusgai egotea.",
|
||||
"block_modal.show_less": "Erakutsi gutxiago",
|
||||
"block_modal.show_more": "Erakutsi gehiago",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Bloquer @{name}",
|
||||
"status.bookmark": "Ajouter aux signets",
|
||||
"status.cancel_reblog_private": "Débooster",
|
||||
"status.cannot_edit": "Vous n'êtes pas autorisé à modifier ce message",
|
||||
"status.cannot_quote": "Vous n'êtes pas autorisé à citer ce message",
|
||||
"status.cannot_reblog": "Cette publication ne peut pas être boostée",
|
||||
"status.contains_quote": "Contient une citation",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Plus",
|
||||
"status.mute": "Masquer @{name}",
|
||||
"status.mute_conversation": "Masquer la conversation",
|
||||
"status.not_quoted": "Vous n'êtes pas cité dans ce message",
|
||||
"status.open": "Afficher la publication entière",
|
||||
"status.pin": "Épingler sur profil",
|
||||
"status.public_only": "Ce message est privé",
|
||||
"status.quote": "Citer",
|
||||
"status.quote.cancel": "Annuler la citation",
|
||||
"status.quote_error.blocked_account_hint.title": "Ce message est masqué car vous avez bloqué @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Bloquer @{name}",
|
||||
"status.bookmark": "Ajouter aux marque-pages",
|
||||
"status.cancel_reblog_private": "Annuler le partage",
|
||||
"status.cannot_edit": "Vous n'êtes pas autorisé à modifier ce message",
|
||||
"status.cannot_quote": "Vous n'êtes pas autorisé à citer ce message",
|
||||
"status.cannot_reblog": "Ce message ne peut pas être partagé",
|
||||
"status.contains_quote": "Contient une citation",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Plus",
|
||||
"status.mute": "Masquer @{name}",
|
||||
"status.mute_conversation": "Masquer la conversation",
|
||||
"status.not_quoted": "Vous n'êtes pas cité dans ce message",
|
||||
"status.open": "Développer ce message",
|
||||
"status.pin": "Épingler sur le profil",
|
||||
"status.public_only": "Ce message est privé",
|
||||
"status.quote": "Citer",
|
||||
"status.quote.cancel": "Annuler la citation",
|
||||
"status.quote_error.blocked_account_hint.title": "Ce message est masqué car vous avez bloqué @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "@{name} letiltása",
|
||||
"status.bookmark": "Könyvjelzőzés",
|
||||
"status.cancel_reblog_private": "Megtolás visszavonása",
|
||||
"status.cannot_edit": "Nem szerkesztheted ezt a bejegyzést",
|
||||
"status.cannot_quote": "Nem idézheted ezt a bejegyzést",
|
||||
"status.cannot_reblog": "Ezt a bejegyzést nem lehet megtolni",
|
||||
"status.contains_quote": "Idézést tartalmaz",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Útiloka @{name}",
|
||||
"status.bookmark": "Bókamerki",
|
||||
"status.cancel_reblog_private": "Taka úr endurbirtingu",
|
||||
"status.cannot_edit": "Þú hefur ekki heimild til að breyta þessari færslu",
|
||||
"status.cannot_quote": "Þú hefur ekki heimild til að vitna í þessa færslu",
|
||||
"status.cannot_reblog": "Þessa færslu er ekki hægt að endurbirta",
|
||||
"status.contains_quote": "Inniheldur tilvitnun",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Meira",
|
||||
"status.mute": "Þagga niður í @{name}",
|
||||
"status.mute_conversation": "Þagga niður í samtali",
|
||||
"status.not_quoted": "Ekki er vitnað í þig í þessari stöðufærslu",
|
||||
"status.open": "Opna þessa færslu",
|
||||
"status.pin": "Festa á notandasnið",
|
||||
"status.public_only": "Þessi stöðufærsla er einka",
|
||||
"status.quote": "Tilvitnun",
|
||||
"status.quote.cancel": "Hætta við tilvitnun",
|
||||
"status.quote_error.blocked_account_hint.title": "Þessi færsla er falin vegna þess að ú hefur lokað á @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Blocca @{name}",
|
||||
"status.bookmark": "Aggiungi segnalibro",
|
||||
"status.cancel_reblog_private": "Annulla reblog",
|
||||
"status.cannot_edit": "Non sei autorizzato/a a modificare questo post",
|
||||
"status.cannot_quote": "Non ti è consentito citare questo post",
|
||||
"status.cannot_reblog": "Questo post non può essere condiviso",
|
||||
"status.contains_quote": "Contiene una citazione",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Altro",
|
||||
"status.mute": "Silenzia @{name}",
|
||||
"status.mute_conversation": "Silenzia conversazione",
|
||||
"status.not_quoted": "Non sei citato/a in questo stato",
|
||||
"status.open": "Espandi questo post",
|
||||
"status.pin": "Fissa in cima sul profilo",
|
||||
"status.public_only": "Questo stato è privato",
|
||||
"status.quote": "Cita",
|
||||
"status.quote.cancel": "Annulla la citazione",
|
||||
"status.quote_error.blocked_account_hint.title": "Questo post è nascosto perché hai bloccato @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Bloquear @{name}",
|
||||
"status.bookmark": "Salvar",
|
||||
"status.cancel_reblog_private": "Desfazer impulso",
|
||||
"status.cannot_edit": "Você não tem permissão para editar esta publicação",
|
||||
"status.cannot_quote": "Você não tem permissão para citar esta publicação",
|
||||
"status.cannot_reblog": "Esta publicação não pode ser impulsionada",
|
||||
"status.contains_quote": "Contém citação",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Mais",
|
||||
"status.mute": "Silenciar @{name}",
|
||||
"status.mute_conversation": "Silenciar conversa",
|
||||
"status.not_quoted": "Você não está citado neste status",
|
||||
"status.open": "Expandir esta publicação",
|
||||
"status.pin": "Fixar",
|
||||
"status.public_only": "Este status é privado",
|
||||
"status.quote": "Citar",
|
||||
"status.quote.cancel": "Cancelar citação",
|
||||
"status.quote_error.blocked_account_hint.title": "Esta publicação está oculta porque você bloqueou @{name}.",
|
||||
|
||||
@@ -1225,6 +1225,7 @@
|
||||
"status.block": "Blloko @{name}",
|
||||
"status.bookmark": "Faqeruaje",
|
||||
"status.cancel_reblog_private": "Shpërforcojeni",
|
||||
"status.cannot_edit": "S’keni leje të përpunoni këtë postim",
|
||||
"status.cannot_quote": "S’keni leje të citoni këtë postim",
|
||||
"status.cannot_reblog": "Ky postim s’mund të përforcohet",
|
||||
"status.contains_quote": "Përmban citim",
|
||||
@@ -1258,8 +1259,10 @@
|
||||
"status.more": "Më tepër",
|
||||
"status.mute": "Heshtoni @{name}",
|
||||
"status.mute_conversation": "Heshtoje bisedën",
|
||||
"status.not_quoted": "S’citoheni në këtë gjendje",
|
||||
"status.open": "Zgjeroje këtë mesazh",
|
||||
"status.pin": "Fiksoje në profil",
|
||||
"status.public_only": "Kjo gjendje është private",
|
||||
"status.quote": "Citojeni",
|
||||
"status.quote.cancel": "Anuloje citimin",
|
||||
"status.quote_error.blocked_account_hint.title": "Ky postim është i fshehur, ngaqë keni bllokuar @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Blockera @{name}",
|
||||
"status.bookmark": "Bokmärk",
|
||||
"status.cancel_reblog_private": "Sluta boosta",
|
||||
"status.cannot_edit": "Du får inte redigera det här inlägget",
|
||||
"status.cannot_quote": "Du har inte tillåtelse att citera detta inlägg",
|
||||
"status.cannot_reblog": "Detta inlägg kan inte boostas",
|
||||
"status.contains_quote": "Innehåller citat",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Mer",
|
||||
"status.mute": "Tysta @{name}",
|
||||
"status.mute_conversation": "Tysta konversation",
|
||||
"status.not_quoted": "Du är inte citerad i denna status",
|
||||
"status.open": "Utvidga detta inlägg",
|
||||
"status.pin": "Fäst i profil",
|
||||
"status.public_only": "Denna status är privat",
|
||||
"status.quote": "Citera ",
|
||||
"status.quote.cancel": "Återkalla citering",
|
||||
"status.quote_error.blocked_account_hint.title": "Detta inlägg är dolt eftersom du har blockerat @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "Chặn @{name}",
|
||||
"status.bookmark": "Lưu",
|
||||
"status.cancel_reblog_private": "Bỏ đăng lại",
|
||||
"status.cannot_edit": "Bạn không thể sửa tút này",
|
||||
"status.cannot_quote": "Bạn không thể trích dẫn tút này",
|
||||
"status.cannot_reblog": "Không thể đăng lại tút này",
|
||||
"status.contains_quote": "Chứa trích dẫn",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "Xem thêm",
|
||||
"status.mute": "Phớt lờ @{name}",
|
||||
"status.mute_conversation": "Phớt lờ thông báo",
|
||||
"status.not_quoted": "Bạn không được trích dẫn trong tút này",
|
||||
"status.open": "Mở tút",
|
||||
"status.pin": "Ghim lên hồ sơ",
|
||||
"status.public_only": "Tút này là riêng tư",
|
||||
"status.quote": "Trích dẫn",
|
||||
"status.quote.cancel": "Bỏ trích dẫn",
|
||||
"status.quote_error.blocked_account_hint.title": "Tút này bị ẩn vì bạn đã chặn @{name}.",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "屏蔽 @{name}",
|
||||
"status.bookmark": "添加到书签",
|
||||
"status.cancel_reblog_private": "取消转嘟",
|
||||
"status.cannot_edit": "你没有编辑该嘟文的权限",
|
||||
"status.cannot_quote": "你无权引用这条嘟文",
|
||||
"status.cannot_reblog": "不能转嘟这条嘟文",
|
||||
"status.contains_quote": "包含引用",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "更多",
|
||||
"status.mute": "隐藏 @{name}",
|
||||
"status.mute_conversation": "关闭此对话的通知",
|
||||
"status.not_quoted": "你未被此嘟文引用",
|
||||
"status.open": "展开嘟文",
|
||||
"status.pin": "在个人资料页面置顶",
|
||||
"status.public_only": "这是私密嘟文",
|
||||
"status.quote": "引用",
|
||||
"status.quote.cancel": "取消引用",
|
||||
"status.quote_error.blocked_account_hint.title": "由于你已屏蔽@{name},此嘟文已隐藏。",
|
||||
|
||||
@@ -1231,6 +1231,7 @@
|
||||
"status.block": "封鎖 @{name}",
|
||||
"status.bookmark": "書籤",
|
||||
"status.cancel_reblog_private": "取消轉嘟",
|
||||
"status.cannot_edit": "您不被允許編輯此嘟文",
|
||||
"status.cannot_quote": "您不被允許引用此嘟文",
|
||||
"status.cannot_reblog": "這則嘟文無法被轉嘟",
|
||||
"status.contains_quote": "包含引用嘟文",
|
||||
@@ -1264,8 +1265,10 @@
|
||||
"status.more": "更多",
|
||||
"status.mute": "靜音 @{name}",
|
||||
"status.mute_conversation": "靜音對話",
|
||||
"status.not_quoted": "您不被此嘟文引用",
|
||||
"status.open": "展開此嘟文",
|
||||
"status.pin": "釘選至個人檔案頁面",
|
||||
"status.public_only": "此為私人嘟文",
|
||||
"status.quote": "引用",
|
||||
"status.quote.cancel": "取消引用嘟文",
|
||||
"status.quote_error.blocked_account_hint.title": "由於您已封鎖 @{name},此嘟文已被隱藏。",
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { Map as ImmutableMap } from 'immutable';
|
||||
import { Record as ImmutableRecord, List as ImmutableList } from 'immutable';
|
||||
|
||||
import { me } from 'mastodon/initial_state';
|
||||
import { accountDefaultValues } from 'mastodon/models/account';
|
||||
import { me } from '@/mastodon/initial_state';
|
||||
import { accountDefaultValues } from '@/mastodon/models/account';
|
||||
import type {
|
||||
Account,
|
||||
AccountShape,
|
||||
AccountShapeFull,
|
||||
} from 'mastodon/models/account';
|
||||
import type { Relationship } from 'mastodon/models/relationship';
|
||||
import { createAppSelector } from 'mastodon/store';
|
||||
import type { RootState } from 'mastodon/store';
|
||||
} from '@/mastodon/models/account';
|
||||
import type { Relationship } from '@/mastodon/models/relationship';
|
||||
import type { RootState } from '@/mastodon/store';
|
||||
import { createAppSelector } from '@/mastodon/store/typed_functions';
|
||||
|
||||
import type { ApiHashtagJSON } from '../api_types/tags';
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import type { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||
|
||||
import { createAppSelector } from 'mastodon/store';
|
||||
|
||||
import type { ExpandedStatusShape, StatusShape } from '../models/status';
|
||||
import type { StatusInteractionIntent } from '@/mastodon/actions/interactions_typed';
|
||||
import type {
|
||||
ExpandedStatusShape,
|
||||
StatusShape,
|
||||
} from '@/mastodon/models/status';
|
||||
import { createAppSelector } from '@/mastodon/store/typed_functions';
|
||||
|
||||
import { selectPlainAccount } from './accounts';
|
||||
import type { FilterShape } from './filters';
|
||||
@@ -71,6 +74,75 @@ export const selectExpandedStatus = createAppSelector(
|
||||
},
|
||||
);
|
||||
|
||||
export const selectStatusConditions = createAppSelector(
|
||||
[
|
||||
selectPlainStatus,
|
||||
(state) => state.meta.get('me', null) as string | null,
|
||||
(state, statusId: string) =>
|
||||
state.statuses.getIn([
|
||||
state.statuses.getIn([statusId, 'quote', 'quoted_status']),
|
||||
'account',
|
||||
]) as string | undefined | null,
|
||||
],
|
||||
(status, currentAccountId, quotedAccountId) => ({
|
||||
isPublic: status && ['public', 'unlisted'].includes(status.visibility),
|
||||
isLoggedIn: !!currentAccountId,
|
||||
isMine: status && !!currentAccountId && status.account === currentAccountId,
|
||||
isQuoted:
|
||||
status && !!currentAccountId && quotedAccountId === currentAccountId,
|
||||
isNotDirect: status && status.visibility !== 'direct',
|
||||
}),
|
||||
);
|
||||
|
||||
export const selectStatusInteractions = createAppSelector(
|
||||
[(_, statusId: string) => statusId, selectStatusConditions],
|
||||
(statusId, conditionals) => {
|
||||
function addAllowed(conditions: Partial<typeof conditionals>) {
|
||||
return {
|
||||
...conditions,
|
||||
allowed: Object.values(conditions).every(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
const { isLoggedIn, isMine, isPublic, isQuoted, isNotDirect } =
|
||||
conditionals;
|
||||
|
||||
const interactions: Record<
|
||||
StatusInteractionIntent,
|
||||
Partial<typeof conditionals> & { allowed: boolean }
|
||||
> = {
|
||||
bookmark: addAllowed({ isLoggedIn }),
|
||||
delete: addAllowed({ isMine }),
|
||||
edit: addAllowed({ isMine }),
|
||||
editQuotePolicy: addAllowed({ isMine, isPublic }),
|
||||
embed: addAllowed({ isPublic }),
|
||||
favourite: addAllowed({ isLoggedIn }),
|
||||
filter: addAllowed({ isLoggedIn }),
|
||||
mute: addAllowed({ isMine }),
|
||||
pin: addAllowed({ isMine, isNotDirect }),
|
||||
quote: addAllowed({ isLoggedIn }),
|
||||
reblog: addAllowed({ isLoggedIn }),
|
||||
redraft: addAllowed({ isMine }),
|
||||
reply: addAllowed({ isLoggedIn }),
|
||||
report: addAllowed({ isLoggedIn }),
|
||||
revokeQuote: addAllowed({ isQuoted }),
|
||||
};
|
||||
|
||||
return {
|
||||
statusId,
|
||||
...interactions,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
export const selectStatusIntentAllowed = createAppSelector(
|
||||
[
|
||||
selectStatusInteractions,
|
||||
(_state, _statusId: string, intent: StatusInteractionIntent) => intent,
|
||||
],
|
||||
(allowedInteractions, intent) => allowedInteractions[intent].allowed,
|
||||
);
|
||||
|
||||
export const selectPictureInPicture = createAppSelector(
|
||||
[
|
||||
(state, statusId: string) =>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h200v80H160v480h640v-480H600v-80h200q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm320-184L280-544l56-56 104 104v-304h80v304l104-104 56 56-200 200Z"/></svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h200v80H160v480h640v-480H600v-80h200q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm320-184L280-544l56-56 104 104v-304h80v304l104-104 56 56-200 200Z"/></svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -14,9 +14,13 @@ class ActivityPub::LinkedDataSignature
|
||||
return unless @json['signature'].is_a?(Hash)
|
||||
return if unsupported_jsonld_features?(@json)
|
||||
|
||||
type = @json['signature']['type']
|
||||
creator_uri = @json['signature']['creator']
|
||||
signature = @json['signature']['signatureValue']
|
||||
signature_options = compact(@json['signature'].merge({ '@context' => CONTEXT }), CONTEXT)
|
||||
|
||||
type = signature_options['type']
|
||||
creator_uri = signature_options['creator']
|
||||
signature = signature_options['signatureValue']
|
||||
|
||||
return if signature_options['expires']&.to_datetime&.past?
|
||||
|
||||
return unless type == 'RsaSignature2017'
|
||||
|
||||
@@ -24,7 +28,7 @@ class ActivityPub::LinkedDataSignature
|
||||
keypair = ActivityPub::FetchRemoteKeyService.new.call(creator_uri) if keypair&.public_key.blank?
|
||||
return if keypair.nil? || !keypair.usable? || keypair.type != 'rsa'
|
||||
|
||||
options_hash = hash(@json['signature'].without('type', 'id', 'signatureValue').merge('@context' => CONTEXT))
|
||||
options_hash = hash(signature_options.without('type', 'id', 'signatureValue'))
|
||||
document_hash = hash(@json.without('signature'))
|
||||
to_be_verified = options_hash + document_hash
|
||||
|
||||
@@ -33,13 +37,14 @@ class ActivityPub::LinkedDataSignature
|
||||
false
|
||||
end
|
||||
|
||||
def sign!(creator, sign_with: nil)
|
||||
def sign!(creator, sign_with: nil, expires_in: 2.days)
|
||||
keypair = sign_with.presence || creator.keypair(type: :rsa)
|
||||
|
||||
options = {
|
||||
'type' => 'RsaSignature2017',
|
||||
'creator' => keypair.full_uri,
|
||||
'created' => Time.now.utc.iso8601,
|
||||
'expires' => expires_in.from_now.utc.iso8601,
|
||||
}
|
||||
|
||||
options_hash = hash(options.without('type', 'id', 'signatureValue').merge('@context' => CONTEXT))
|
||||
|
||||
@@ -17,9 +17,8 @@ class ActivityPub::ObjectIntegrityProof
|
||||
proof = @json['proof']
|
||||
return unless proof['type'].present? && proof['verificationMethod'].present? && proof['proofPurpose'].present?
|
||||
|
||||
return if proof_purpose != proof['proofPurpose']
|
||||
|
||||
return if proof['type'] != 'DataIntegrityProof'
|
||||
return if proof_purpose != proof['proofPurpose'] || proof['type'] != 'DataIntegrityProof'
|
||||
return if proof['expires']&.to_datetime&.past?
|
||||
|
||||
cryptosuite = proof['cryptosuite']
|
||||
key_uri = proof['verificationMethod']
|
||||
|
||||
@@ -486,7 +486,7 @@ class Account < ApplicationRecord
|
||||
before_destroy :clean_feed_manager
|
||||
|
||||
def ensure_keys!
|
||||
return unless local? && private_key.blank? && public_key.blank?
|
||||
return unless local? && private_key.blank? && public_key.blank? && keypairs.empty?
|
||||
|
||||
generate_keys
|
||||
save!
|
||||
@@ -506,11 +506,10 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def generate_keys
|
||||
return unless local? && private_key.blank? && public_key.blank?
|
||||
return unless local? && private_key.blank? && public_key.blank? && keypairs.empty?
|
||||
|
||||
keypair = OpenSSL::PKey::RSA.new(2048)
|
||||
self.private_key = keypair.to_pem
|
||||
self.public_key = keypair.public_key.to_pem
|
||||
keypairs << keypairs.build(local_fragment: "#rsa-#{SecureRandom.hex(8)}", type: :rsa, public_key: keypair.public_key.to_pem, private_key: keypair.to_pem)
|
||||
end
|
||||
|
||||
def normalize_domain
|
||||
|
||||
@@ -47,6 +47,10 @@ class SoftwareUpdate < ApplicationRecord
|
||||
all.to_a.filter(&:pending?)
|
||||
end
|
||||
|
||||
def pending?
|
||||
pending_to_a.present?
|
||||
end
|
||||
|
||||
def urgent_pending?
|
||||
pending_to_a.any?(&:urgent?)
|
||||
end
|
||||
|
||||
@@ -1235,6 +1235,7 @@ en:
|
||||
other: Used by %{count} people over the last week
|
||||
title: Recommendations & Trends
|
||||
trending: Trending
|
||||
update_available: Update available
|
||||
username_blocks:
|
||||
add_new: Add new
|
||||
block_registrations: Block registrations
|
||||
|
||||
@@ -7,10 +7,12 @@ SimpleNavigation::Configuration.run do |navigation|
|
||||
n.item :web, safe_join([material_symbol('chevron_left'), t('settings.back')]), root_path
|
||||
|
||||
n.item :software_updates,
|
||||
safe_join([material_symbol('report'), t('admin.critical_update_pending')]),
|
||||
safe_join(
|
||||
SoftwareUpdate.urgent_pending? ? [material_symbol('report'), t('admin.critical_update_pending')] : [material_symbol('system_update_alt'), t('admin.update_available')]
|
||||
),
|
||||
admin_software_updates_path,
|
||||
if: -> { Rails.configuration.x.mastodon.software_update_url.present? && current_user.can?(:view_devops) && SoftwareUpdate.urgent_pending? },
|
||||
html: { class: 'warning' }
|
||||
html: { class: SoftwareUpdate.urgent_pending? ? 'warning' : nil },
|
||||
if: -> { Rails.configuration.x.mastodon.software_update_url.present? && current_user.can?(:view_devops) && SoftwareUpdate.pending? }
|
||||
|
||||
n.item :profile, safe_join([material_symbol('person'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? && !self_destruct }, highlights_on: %r{/settings/profile|/settings/featured_tags|/settings/verification}
|
||||
n.item :privacy, safe_join([material_symbol('globe'), t('privacy.title')]), settings_privacy_path, if: -> { current_user.functional? && !self_destruct }, highlights_on: %r{/settings/privacy}
|
||||
|
||||
@@ -1,17 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Fabricator(:account) do
|
||||
transient :suspended, :silenced
|
||||
transient :suspended, :silenced, :legacy_keypair
|
||||
username { sequence(:username) { |i| "#{Faker::Internet.user_name(separators: %w(_))}#{i}" } }
|
||||
last_webfingered_at { Time.now.utc }
|
||||
public_key { SigningKeysHelpers::PUBLIC_RSA_TEST_KEY }
|
||||
private_key { |attrs| attrs[:domain].present? ? nil : SigningKeysHelpers::PRIVATE_RSA_TEST_KEY }
|
||||
public_key { |attrs| attrs[:legacy_keypair] ? SigningKeysHelpers::PUBLIC_RSA_TEST_KEY : '' }
|
||||
private_key { |attrs| attrs[:legacy_keypair] && attrs[:domain].nil? ? SigningKeysHelpers::PRIVATE_RSA_TEST_KEY : nil }
|
||||
suspended_at { |attrs| attrs[:suspended] ? Time.now.utc : nil }
|
||||
silenced_at { |attrs| attrs[:silenced] ? Time.now.utc : nil }
|
||||
user { |attrs| attrs[:domain].nil? ? Fabricate.build(:user, account: nil) : nil }
|
||||
uri { |attrs| attrs[:domain].nil? ? '' : "https://#{attrs[:domain]}/users/#{attrs[:username]}" }
|
||||
discoverable true
|
||||
indexable true
|
||||
|
||||
# This is not strictly needed but this avoids generating multiple keys
|
||||
# and, when `store_private_key` is passed, stores private keys for use in request specs
|
||||
keypairs do |attrs|
|
||||
if attrs[:legacy_keypair] || attrs[:public_key].present?
|
||||
[]
|
||||
else
|
||||
[
|
||||
Keypair.new(
|
||||
type: :rsa,
|
||||
public_key: SigningKeysHelpers::PUBLIC_RSA_TEST_KEY,
|
||||
private_key: attrs[:domain].blank? ? SigningKeysHelpers::PRIVATE_RSA_TEST_KEY : nil,
|
||||
uri: attrs[:domain].nil? ? nil : "https://#{attrs[:domain]}/users/#{attrs[:username]}#main-key",
|
||||
local_fragment: attrs[:domain].nil? ? '#main-key' : nil
|
||||
),
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Fabricator(:remote_account, from: :account) do
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Fabricator(:keypair) do
|
||||
account
|
||||
account { Fabricate(:account, keypairs: []) }
|
||||
type :rsa
|
||||
public_key SigningKeysHelpers::PUBLIC_RSA_TEST_KEY
|
||||
expires_at nil
|
||||
@@ -12,7 +12,7 @@ Fabricator(:keypair) do
|
||||
keypair.private_key ||= SigningKeysHelpers::PRIVATE_RSA_TEST_KEY
|
||||
keypair.local_fragment ||= "##{Random.hex}"
|
||||
else
|
||||
keypair.uri ||= ActivityPub::TagManager.instance.key_uri_for(keypair.account)
|
||||
keypair.uri ||= "#{ActivityPub::TagManager.instance.uri_for(keypair.account)}##{Random.hex}"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -7,8 +7,8 @@ RSpec.describe ActivityPub::LinkedDataSignature do
|
||||
|
||||
subject { described_class.new(json) }
|
||||
|
||||
let(:keyid) { 'http://example.com/alice#rsa-key' }
|
||||
let!(:sender) { Fabricate(:account, uri: 'http://example.com/alice', domain: 'example.com') }
|
||||
let(:keyid) { sender.keypair.uri }
|
||||
|
||||
let(:raw_json) do
|
||||
{
|
||||
@@ -38,6 +38,38 @@ RSpec.describe ActivityPub::LinkedDataSignature do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when signature matches and has an expiration date set in the future' do
|
||||
let(:raw_signature) do
|
||||
{
|
||||
'creator' => keyid,
|
||||
'created' => '2017-09-23T20:21:34Z',
|
||||
'expires' => '3000-01-01T00:00:00Z',
|
||||
}
|
||||
end
|
||||
|
||||
let(:signature) { raw_signature.merge('type' => 'RsaSignature2017', 'signatureValue' => sign(sender, raw_signature, raw_json)) }
|
||||
|
||||
it 'returns creator' do
|
||||
expect(subject.verify_actor!).to eq sender
|
||||
end
|
||||
end
|
||||
|
||||
context 'when signature matches but has an expiration date set in the past' do
|
||||
let(:raw_signature) do
|
||||
{
|
||||
'creator' => keyid,
|
||||
'created' => '2017-09-23T20:21:34Z',
|
||||
'expires' => '2017-09-23T20:21:35Z',
|
||||
}
|
||||
end
|
||||
|
||||
let(:signature) { raw_signature.merge('type' => 'RsaSignature2017', 'signatureValue' => sign(sender, raw_signature, raw_json)) }
|
||||
|
||||
it 'returns nil' do
|
||||
expect(subject.verify_actor!).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when local account record is missing a public key' do
|
||||
let(:raw_signature) do
|
||||
{
|
||||
@@ -55,8 +87,8 @@ RSpec.describe ActivityPub::LinkedDataSignature do
|
||||
signature
|
||||
|
||||
# Unset key
|
||||
old_key = sender.public_key
|
||||
sender.update!(private_key: '', public_key: '')
|
||||
old_key = sender.keypair.public_key
|
||||
sender.keypairs.delete_all
|
||||
|
||||
allow(ActivityPub::FetchRemoteKeyService).to receive(:new).and_return(service_stub)
|
||||
|
||||
@@ -153,6 +185,9 @@ RSpec.describe ActivityPub::LinkedDataSignature do
|
||||
expect(subject['signature']).to be_a Hash
|
||||
expect(subject['signature']['signatureValue']).to be_present
|
||||
expect(Array(subject['@context'])).to include('https://w3id.org/security/v1')
|
||||
|
||||
# Verification requires fetching the key, which we don't support for local keys
|
||||
allow(Keypair).to receive(:from_keyid).with(sender.keypair(type: :rsa).full_uri).and_return(sender.keypair(type: :rsa))
|
||||
expect(described_class.new(subject).verify_actor!).to eq sender
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,23 +45,135 @@ RSpec.describe ActivityPub::ObjectIntegrityProof do
|
||||
JSON
|
||||
end
|
||||
|
||||
before do
|
||||
asn1 = OpenSSL::ASN1::Sequence(
|
||||
[
|
||||
OpenSSL::ASN1::Sequence([OpenSSL::ASN1::ObjectId('ED25519')]),
|
||||
OpenSSL::ASN1::BitString(Multibase.decode_multicodec('z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2')[1]),
|
||||
]
|
||||
)
|
||||
keypair = OpenSSL::PKey.read(asn1.to_der)
|
||||
|
||||
Fabricate(:keypair, account: actor, uri: 'https://server.example/users/alice#ed25519-key', type: :ed25519, public_key: keypair.public_to_pem)
|
||||
end
|
||||
|
||||
context 'when the signature is correct' do
|
||||
before do
|
||||
asn1 = OpenSSL::ASN1::Sequence(
|
||||
[
|
||||
OpenSSL::ASN1::Sequence([OpenSSL::ASN1::ObjectId('ED25519')]),
|
||||
OpenSSL::ASN1::BitString(Multibase.decode_multicodec('z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2')[1]),
|
||||
]
|
||||
)
|
||||
keypair = OpenSSL::PKey.read(asn1.to_der)
|
||||
|
||||
Fabricate(:keypair, account: actor, uri: 'https://server.example/users/alice#ed25519-key', type: :ed25519, public_key: keypair.public_to_pem)
|
||||
end
|
||||
|
||||
it 'returns the actor' do
|
||||
expect(described_class.new(json).verify_actor!).to eq actor
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the signature is incorrect' do
|
||||
before do
|
||||
Fabricate(:keypair, account: actor, uri: 'https://server.example/users/alice#ed25519-key', type: :ed25519, public_key: OpenSSL::PKey.generate_key('Ed25519').public_to_pem)
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
expect(described_class.new(json).verify_actor!).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the signature is correct and has an expiration date set in the future' do
|
||||
let(:json) do
|
||||
JSON.parse(<<~JSON)
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/data-integrity/v2"
|
||||
],
|
||||
"id": "https://server.example/activities/1",
|
||||
"type": "Create",
|
||||
"actor": "https://server.example/users/alice",
|
||||
"object": {
|
||||
"id": "https://server.example/objects/1",
|
||||
"type": "Note",
|
||||
"attributedTo": "https://server.example/users/alice",
|
||||
"content": "Hello world"
|
||||
},
|
||||
"proof": {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/data-integrity/v2"
|
||||
],
|
||||
"type": "DataIntegrityProof",
|
||||
"cryptosuite": "eddsa-jcs-2022",
|
||||
"verificationMethod": "https://server.example/users/alice#ed25519-key",
|
||||
"proofPurpose": "assertionMethod",
|
||||
"proofValue": "z4bp44KNvTEeb7h8gY7tpbF9EaJxzbcYc6JNPxMv1wdWDakBt2vVEC3UzjctghA5XP2NevDnDCPzph2oNNb3qRJ8K",
|
||||
"created": "2023-02-24T23:36:38Z",
|
||||
"expires": "3000-01-01T00:00:00Z"
|
||||
}
|
||||
}
|
||||
JSON
|
||||
end
|
||||
|
||||
before do
|
||||
asn1 = OpenSSL::ASN1::Sequence(
|
||||
[
|
||||
OpenSSL::ASN1::Sequence([OpenSSL::ASN1::ObjectId('ED25519')]),
|
||||
OpenSSL::ASN1::BitString(Multibase.decode_multicodec('z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2')[1]),
|
||||
]
|
||||
)
|
||||
keypair = OpenSSL::PKey.read(asn1.to_der)
|
||||
|
||||
Fabricate(:keypair, account: actor, uri: 'https://server.example/users/alice#ed25519-key', type: :ed25519, public_key: keypair.public_to_pem)
|
||||
end
|
||||
|
||||
it 'returns the actor' do
|
||||
expect(described_class.new(json).verify_actor!).to eq actor
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the signature is correct and has an expiration date set in the past' do
|
||||
let(:json) do
|
||||
JSON.parse(<<~JSON)
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/data-integrity/v2"
|
||||
],
|
||||
"id": "https://server.example/activities/1",
|
||||
"type": "Create",
|
||||
"actor": "https://server.example/users/alice",
|
||||
"object": {
|
||||
"id": "https://server.example/objects/1",
|
||||
"type": "Note",
|
||||
"attributedTo": "https://server.example/users/alice",
|
||||
"content": "Hello world"
|
||||
},
|
||||
"proof": {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/data-integrity/v2"
|
||||
],
|
||||
"type": "DataIntegrityProof",
|
||||
"cryptosuite": "eddsa-jcs-2022",
|
||||
"verificationMethod": "https://server.example/users/alice#ed25519-key",
|
||||
"proofPurpose": "assertionMethod",
|
||||
"proofValue": "z25og1nNL6TLjQ8fHK4WmzWZzjb8BhcVvaoXToxE9qpcB6iqCWmWhmSAifmcWA11rtdomgGpkRNeEPDMXWJY5BDVQ",
|
||||
"created": "2023-02-24T23:36:38Z",
|
||||
"expires": "2023-02-24T23:36:39Z"
|
||||
}
|
||||
}
|
||||
JSON
|
||||
end
|
||||
|
||||
before do
|
||||
asn1 = OpenSSL::ASN1::Sequence(
|
||||
[
|
||||
OpenSSL::ASN1::Sequence([OpenSSL::ASN1::ObjectId('ED25519')]),
|
||||
OpenSSL::ASN1::BitString(Multibase.decode_multicodec('z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2')[1]),
|
||||
]
|
||||
)
|
||||
keypair = OpenSSL::PKey.read(asn1.to_der)
|
||||
|
||||
Fabricate(:keypair, account: actor, uri: 'https://server.example/users/alice#ed25519-key', type: :ed25519, public_key: keypair.public_to_pem)
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
expect(described_class.new(json).verify_actor!).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'verify_eddsa_jcs_2022' do
|
||||
|
||||
@@ -655,7 +655,7 @@ RSpec.describe Mastodon::CLI::Accounts do
|
||||
|
||||
context 'when there are duplicate URI accounts' do
|
||||
before do
|
||||
Fabricate.times(2, :account, domain: 'host.example', uri: uri)
|
||||
Fabricate.times(2, :account, domain: 'host.example', uri: uri, legacy_keypair: true)
|
||||
allow(ActivityPub::FetchRemoteAccountService).to receive(:new).and_return(service_double)
|
||||
end
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ RSpec.describe Mastodon::CLI::Maintenance do
|
||||
|
||||
def prepare_duplicate_data
|
||||
ActiveRecord::Base.connection.remove_index :accounts, name: :index_accounts_on_username_and_domain_lower
|
||||
duplicate_record(:account, username: duplicate_account_username, domain: duplicate_account_domain)
|
||||
duplicate_record(:account, username: duplicate_account_username, domain: duplicate_account_domain, legacy_keypair: true)
|
||||
duplicate_record(:account, username: duplicate_account_username, domain: nil)
|
||||
end
|
||||
|
||||
|
||||
@@ -736,9 +736,9 @@ RSpec.describe Account do
|
||||
it 'generates keys' do
|
||||
account = described_class.create!(domain: nil, username: 'user_without_keys')
|
||||
|
||||
expect(account)
|
||||
.to be_private_key
|
||||
.and be_public_key
|
||||
expect(account.private_key).to be_nil
|
||||
expect(account.public_key).to eq ''
|
||||
|
||||
expect(account.keypair.keypair)
|
||||
.to be_private
|
||||
.and be_public
|
||||
|
||||
@@ -45,8 +45,8 @@ RSpec.describe Keypair do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when no key with the expected key ID exists but there is an account with the same ID and a key' do
|
||||
let(:account) { Fabricate(:account, domain: 'example.com') }
|
||||
context 'when no key with the expected key ID exists but there is an account with the same ID and a legacy key' do
|
||||
let(:account) { Fabricate(:account, domain: 'example.com', legacy_keypair: true) }
|
||||
let(:keyid) { "#{ActivityPub::TagManager.instance.uri_for(account)}#main-rsa-key" }
|
||||
|
||||
it 'returns the expected Keypair' do
|
||||
@@ -60,7 +60,7 @@ RSpec.describe Keypair do
|
||||
end
|
||||
|
||||
context 'when no key with the expected key ID exists but there is an account with the same ID and no key' do
|
||||
let(:account) { Fabricate(:account, domain: 'example.com', public_key: '', private_key: nil) }
|
||||
let(:account) { Fabricate(:account, domain: 'example.com') }
|
||||
let(:keyid) { "#{ActivityPub::TagManager.instance.uri_for(account)}#main-rsa-key" }
|
||||
|
||||
it 'returns nil' do
|
||||
|
||||
@@ -23,7 +23,7 @@ RSpec.describe 'Instance actor endpoint' do
|
||||
inbox: instance_actor_inbox_url,
|
||||
outbox: instance_actor_outbox_url,
|
||||
publicKey: include(
|
||||
id: instance_actor_url(anchor: 'main-key')
|
||||
id: start_with(instance_actor_url)
|
||||
),
|
||||
url: about_more_url(instance_actor: true)
|
||||
)
|
||||
|
||||
@@ -704,7 +704,7 @@ RSpec.describe 'signature verification concern' do
|
||||
end
|
||||
|
||||
context 'with a known account' do
|
||||
let!(:actor) { Fabricate(:account, domain: 'remote.domain', uri: 'https://remote.domain/users/bob', private_key: nil, public_key: '') }
|
||||
let!(:actor) { Fabricate(:account, domain: 'remote.domain', uri: 'https://remote.domain/users/bob') }
|
||||
|
||||
before do
|
||||
Fabricate(:keypair, account: actor, type: :ed25519, public_key: actor_keypair.public_to_pem, uri: 'https://remote.domain/users/bob#main-key')
|
||||
|
||||
@@ -125,7 +125,7 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
||||
end
|
||||
|
||||
context 'when the account was known with a legacy key' do
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice', legacy_keypair: true) }
|
||||
|
||||
it 'invalidates the legacy key and stores the new key' do
|
||||
expect { subject.call('alice', 'example.com', payload) }
|
||||
@@ -135,13 +135,14 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
||||
end
|
||||
|
||||
context 'when the account was known with an old key' do
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice', public_key: '') }
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
|
||||
|
||||
before do
|
||||
alice.keypairs.delete_all
|
||||
Fabricate(:keypair, account: alice, uri: 'https://foo.test/actor#old-key', type: :rsa)
|
||||
end
|
||||
|
||||
it 'invalidates the legacy key and stores the new key' do
|
||||
it 'invalidates the old key and stores the new key' do
|
||||
expect { subject.call('alice', 'example.com', payload) }
|
||||
.to change { alice.reload.keypairs.to_a }.from(contain_exactly(have_attributes({ uri: 'https://foo.test/actor#old-key' }))).to(contain_exactly(have_attributes({ uri: 'https://foo.test/actor#key1', type: 'rsa', public_key: })))
|
||||
|
||||
@@ -222,7 +223,7 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
||||
end
|
||||
|
||||
context 'when the account was known with a legacy key' do
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice', legacy_keypair: true) }
|
||||
|
||||
it 'invalidates the legacy key and stores the new key' do
|
||||
expect { subject.call('alice', 'example.com', payload) }
|
||||
@@ -232,9 +233,10 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
||||
end
|
||||
|
||||
context 'when the account was known with an old key' do
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice', public_key: '') }
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
|
||||
|
||||
before do
|
||||
alice.keypairs.delete_all
|
||||
Fabricate(:keypair, account: alice, uri: 'https://foo.test/actor#old-key', type: :rsa)
|
||||
end
|
||||
|
||||
@@ -289,7 +291,7 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
||||
end
|
||||
|
||||
context 'when the account was known with a legacy key' do
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice', legacy_keypair: true) }
|
||||
|
||||
it 'invalidates the legacy key and stores the new keys' do
|
||||
expect { subject.call('alice', 'example.com', payload) }
|
||||
@@ -345,7 +347,7 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
||||
end
|
||||
|
||||
context 'when the account was known with a legacy key' do
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
|
||||
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice', legacy_keypair: true) }
|
||||
|
||||
it 'invalidates the legacy key and stores the new keys' do
|
||||
expect { subject.call('alice', 'example.com', payload) }
|
||||
|
||||
@@ -70,7 +70,7 @@ RSpec.describe FetchResourceService do
|
||||
|
||||
it 'signs request' do
|
||||
subject
|
||||
expect(a_request(:get, url).with(headers: { 'Signature' => /keyId="#{Regexp.escape(ActivityPub::TagManager.instance.key_uri_for(Account.representative))}"/ })).to have_been_made
|
||||
expect(a_request(:get, url).with(headers: { 'Signature' => /keyId="#{Regexp.escape(Account.representative.keypair(type: :rsa).full_uri)}"/ })).to have_been_made
|
||||
end
|
||||
|
||||
context 'when content type is application/atom+xml' do
|
||||
|
||||
Reference in new issue
Block a user