Merge branch 'account-local' into 'main'
Add 'local' to account schema See merge request soapbox-pub/soapbox!2835
This commit is contained in:
@@ -10,7 +10,7 @@ import Icon from './icon';
|
||||
import { Button, HStack, Stack, Text } from './ui';
|
||||
import VerificationBadge from './verification-badge';
|
||||
|
||||
import type { Account as AccountEntity, Status as StatusEntity } from 'soapbox/types/entities';
|
||||
import type { Status as StatusEntity } from 'soapbox/types/entities';
|
||||
|
||||
const messages = defineMessages({
|
||||
eventBanner: { id: 'event.banner', defaultMessage: 'Event banner' },
|
||||
@@ -30,7 +30,7 @@ const EventPreview: React.FC<IEventPreview> = ({ status, className, hideAction,
|
||||
|
||||
const me = useAppSelector((state) => state.me);
|
||||
|
||||
const account = status.account as AccountEntity;
|
||||
const account = status.account;
|
||||
const event = status.event!;
|
||||
|
||||
const banner = event.banner;
|
||||
|
||||
@@ -14,7 +14,6 @@ import Badge from 'soapbox/components/badge';
|
||||
import ActionButton from 'soapbox/features/ui/components/action-button';
|
||||
import { UserPanel } from 'soapbox/features/ui/util/async-components';
|
||||
import { useAppSelector, useAppDispatch } from 'soapbox/hooks';
|
||||
import { isLocal } from 'soapbox/utils/accounts';
|
||||
|
||||
import { showProfileHoverCard } from './hover-ref-wrapper';
|
||||
import { dateFormatOptions } from './relative-timestamp';
|
||||
@@ -117,7 +116,7 @@ export const ProfileHoverCard: React.FC<IProfileHoverCard> = ({ visible = true }
|
||||
badges={badges}
|
||||
/>
|
||||
|
||||
{isLocal(account) ? (
|
||||
{account.local ? (
|
||||
<HStack alignItems='center' space={0.5}>
|
||||
<Icon
|
||||
src={require('@tabler/icons/calendar.svg')}
|
||||
|
||||
@@ -15,7 +15,7 @@ import StatusContent from './status-content';
|
||||
import StatusReplyMentions from './status-reply-mentions';
|
||||
import SensitiveContentOverlay from './statuses/sensitive-content-overlay';
|
||||
|
||||
import type { Account as AccountEntity, Status as StatusEntity } from 'soapbox/types/entities';
|
||||
import type { Status as StatusEntity } from 'soapbox/types/entities';
|
||||
|
||||
const messages = defineMessages({
|
||||
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' },
|
||||
@@ -51,7 +51,7 @@ const QuotedStatus: React.FC<IQuotedStatus> = ({ status, onCancel, compose }) =>
|
||||
|
||||
const handleExpandClick: MouseEventHandler<HTMLDivElement> = (e) => {
|
||||
if (!status) return;
|
||||
const account = status.account as AccountEntity;
|
||||
const account = status.account;
|
||||
|
||||
if (!compose && e.button === 0) {
|
||||
const statusUrl = `/@${account.acct}/posts/${status.id}`;
|
||||
@@ -79,7 +79,7 @@ const QuotedStatus: React.FC<IQuotedStatus> = ({ status, onCancel, compose }) =>
|
||||
return null;
|
||||
}
|
||||
|
||||
const account = status.account as AccountEntity;
|
||||
const account = status.account;
|
||||
|
||||
let actions = {};
|
||||
if (onCancel) {
|
||||
|
||||
@@ -23,14 +23,13 @@ import { HStack } from 'soapbox/components/ui';
|
||||
import { useAppDispatch, useAppSelector, useFeatures, useOwnAccount, useSettings, useSoapboxConfig } from 'soapbox/hooks';
|
||||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
import toast from 'soapbox/toast';
|
||||
import { isLocal, isRemote } from 'soapbox/utils/accounts';
|
||||
import copy from 'soapbox/utils/copy';
|
||||
import { getReactForStatus, reduceEmoji } from 'soapbox/utils/emoji-reacts';
|
||||
|
||||
import GroupPopover from './groups/popover/group-popover';
|
||||
|
||||
import type { Menu } from 'soapbox/components/dropdown-menu';
|
||||
import type { Account, Group, Status } from 'soapbox/types/entities';
|
||||
import type { Group, Status } from 'soapbox/types/entities';
|
||||
|
||||
const messages = defineMessages({
|
||||
adminAccount: { id: 'status.admin_account', defaultMessage: 'Moderate @{name}' },
|
||||
@@ -132,7 +131,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
const unmuteGroup = useUnmuteGroup(group as Group);
|
||||
const isMutingGroup = !!group?.relationship?.muting;
|
||||
const deleteGroupStatus = useDeleteGroupStatus(group as Group, status.id);
|
||||
const blockGroupMember = useBlockGroupMember(group as Group, status?.account as any);
|
||||
const blockGroupMember = useBlockGroupMember(group as Group, status.account);
|
||||
|
||||
const me = useAppSelector(state => state.me);
|
||||
const { groupRelationship } = useGroupRelationship(status.group?.id);
|
||||
@@ -267,20 +266,20 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
};
|
||||
|
||||
const handleMentionClick: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
dispatch(mentionCompose(status.account as Account));
|
||||
dispatch(mentionCompose(status.account));
|
||||
};
|
||||
|
||||
const handleDirectClick: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
dispatch(directCompose(status.account as Account));
|
||||
dispatch(directCompose(status.account));
|
||||
};
|
||||
|
||||
const handleChatClick: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
const account = status.account as Account;
|
||||
const account = status.account;
|
||||
dispatch(launchChat(account.id, history));
|
||||
};
|
||||
|
||||
const handleMuteClick: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
dispatch(initMuteModal(status.account as Account));
|
||||
dispatch(initMuteModal(status.account));
|
||||
};
|
||||
|
||||
const handleMuteGroupClick: React.EventHandler<React.MouseEvent> = () =>
|
||||
@@ -305,7 +304,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
};
|
||||
|
||||
const handleBlockClick: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
const account = status.account as Account;
|
||||
const account = status.account;
|
||||
|
||||
dispatch(openModal('CONFIRM', {
|
||||
icon: require('@tabler/icons/ban.svg'),
|
||||
@@ -333,7 +332,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
};
|
||||
|
||||
const handleReport: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
dispatch(initReport(ReportableEntities.STATUS, status.account as Account, { status }));
|
||||
dispatch(initReport(ReportableEntities.STATUS, status.account, { status }));
|
||||
};
|
||||
|
||||
const handleConversationMuteClick: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
@@ -347,7 +346,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
};
|
||||
|
||||
const onModerate: React.MouseEventHandler = (e) => {
|
||||
const account = status.account as Account;
|
||||
const account = status.account;
|
||||
dispatch(openModal('ACCOUNT_MODERATION', { accountId: account.id }));
|
||||
};
|
||||
|
||||
@@ -360,7 +359,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
};
|
||||
|
||||
const handleDeleteFromGroup: React.EventHandler<React.MouseEvent> = () => {
|
||||
const account = status.account as Account;
|
||||
const account = status.account;
|
||||
|
||||
dispatch(openModal('CONFIRM', {
|
||||
heading: intl.formatMessage(messages.deleteHeading),
|
||||
@@ -379,10 +378,10 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
const handleBlockFromGroup = () => {
|
||||
dispatch(openModal('CONFIRM', {
|
||||
heading: intl.formatMessage(messages.groupBlockFromGroupHeading),
|
||||
message: intl.formatMessage(messages.groupBlockFromGroupMessage, { name: (status.account as any).username }),
|
||||
message: intl.formatMessage(messages.groupBlockFromGroupMessage, { name: status.account.username }),
|
||||
confirm: intl.formatMessage(messages.groupBlockConfirm),
|
||||
onConfirm: () => {
|
||||
blockGroupMember({ account_ids: [(status.account as any).id] }, {
|
||||
blockGroupMember({ account_ids: [status.account.id] }, {
|
||||
onSuccess() {
|
||||
toast.success(intl.formatMessage(messages.blocked, { name: account?.acct }));
|
||||
},
|
||||
@@ -415,7 +414,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
icon: require('@tabler/icons/clipboard-copy.svg'),
|
||||
});
|
||||
|
||||
if (features.embeds && isLocal(account)) {
|
||||
if (features.embeds && account.local) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.embed),
|
||||
action: handleEmbed,
|
||||
@@ -449,7 +448,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
});
|
||||
}
|
||||
|
||||
if (features.federating && isRemote(account)) {
|
||||
if (features.federating && !account.local) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.external, { domain }),
|
||||
action: handleExternalClick,
|
||||
@@ -554,7 +553,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
|
||||
if (isGroupStatus && !!status.group) {
|
||||
const group = status.group as Group;
|
||||
const account = status.account as Account;
|
||||
const account = status.account;
|
||||
const isGroupOwner = groupRelationship?.role === GroupRoles.OWNER;
|
||||
const isGroupAdmin = groupRelationship?.role === GroupRoles.ADMIN;
|
||||
const isStatusFromOwner = group.owner.id === account.id;
|
||||
|
||||
@@ -8,7 +8,7 @@ import HoverStatusWrapper from 'soapbox/components/hover-status-wrapper';
|
||||
import { useAppDispatch } from 'soapbox/hooks';
|
||||
import { isPubkey } from 'soapbox/utils/nostr';
|
||||
|
||||
import type { Account, Status } from 'soapbox/types/entities';
|
||||
import type { Status } from 'soapbox/types/entities';
|
||||
|
||||
interface IStatusReplyMentions {
|
||||
status: Status;
|
||||
@@ -21,7 +21,7 @@ const StatusReplyMentions: React.FC<IStatusReplyMentions> = ({ status, hoverable
|
||||
const handleOpenMentionsModal: React.MouseEventHandler<HTMLSpanElement> = (e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
const account = status.account as Account;
|
||||
const account = status.account;
|
||||
|
||||
dispatch(openModal('MENTIONS', {
|
||||
username: account.acct,
|
||||
|
||||
@@ -24,10 +24,7 @@ import StatusInfo from './statuses/status-info';
|
||||
import Tombstone from './tombstone';
|
||||
import { Card, Icon, Stack, Text } from './ui';
|
||||
|
||||
import type {
|
||||
Account as AccountEntity,
|
||||
Status as StatusEntity,
|
||||
} from 'soapbox/types/entities';
|
||||
import type { Status as StatusEntity } from 'soapbox/types/entities';
|
||||
|
||||
// Defined in components/scrollable-list
|
||||
export type ScrollPosition = { height: number; top: number };
|
||||
@@ -168,7 +165,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||
|
||||
const handleHotkeyMention = (e?: KeyboardEvent): void => {
|
||||
e?.preventDefault();
|
||||
dispatch(mentionCompose(actualStatus.account as AccountEntity));
|
||||
dispatch(mentionCompose(actualStatus.account));
|
||||
};
|
||||
|
||||
const handleHotkeyOpen = (): void => {
|
||||
|
||||
@@ -3,11 +3,10 @@ import { FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
import { translateStatus, undoStatusTranslation } from 'soapbox/actions/statuses';
|
||||
import { useAppDispatch, useAppSelector, useFeatures, useInstance } from 'soapbox/hooks';
|
||||
import { isLocal } from 'soapbox/utils/accounts';
|
||||
|
||||
import { Stack, Button, Text } from './ui';
|
||||
|
||||
import type { Account, Status } from 'soapbox/types/entities';
|
||||
import type { Status } from 'soapbox/types/entities';
|
||||
|
||||
interface ITranslateButton {
|
||||
status: Status;
|
||||
@@ -28,7 +27,7 @@ const TranslateButton: React.FC<ITranslateButton> = ({ status }) => {
|
||||
target_languages: targetLanguages,
|
||||
} = instance.pleroma.metadata.translation;
|
||||
|
||||
const renderTranslate = (me || allowUnauthenticated) && (allowRemote || isLocal(status.account as Account)) && ['public', 'unlisted'].includes(status.visibility) && status.contentHtml.length > 0 && status.language !== null && intl.locale !== status.language;
|
||||
const renderTranslate = (me || allowUnauthenticated) && (allowRemote || status.account.local) && ['public', 'unlisted'].includes(status.visibility) && status.contentHtml.length > 0 && status.language !== null && intl.locale !== status.language;
|
||||
|
||||
const supportsLanguages = (!sourceLanguages || sourceLanguages.includes(status.language!)) && (!targetLanguages || targetLanguages.includes(intl.locale));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user