mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
feat(app): show paused-messaging banner across the app (#3178)
This commit is contained in:
1 parent
973aaced96
commit
bc5dcdfe21
61 files changed
+7917
-7775
No files matched your search
+5
-6
@@ -2,10 +2,10 @@
|
||||
|
||||
import i18n from '@app/app/I18n';
|
||||
import {GenericErrorModal} from '@app/features/app/components/alerts/GenericErrorModal';
|
||||
import {failureCode, failureMessage} from '@app/features/platform/utils/ResponseInspection';
|
||||
import {failureCode} from '@app/features/platform/utils/ResponseInspection';
|
||||
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
|
||||
import {modal} from '@app/features/ui/commands/ModalCommands';
|
||||
import {ACCOUNT_LIMITED_NOTICE_DESCRIPTOR} from '@app/features/user/utils/AccountLimitUtils';
|
||||
import {handleAccountLimitedError} from '@app/features/user/utils/AccountLimitUtils';
|
||||
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
|
||||
@@ -36,6 +36,7 @@ const INVITE_LINK_FAILED_MESSAGE_DESCRIPTOR = msg({
|
||||
});
|
||||
|
||||
export function showGroupRecipientAddFailedModal(error: unknown): void {
|
||||
if (handleAccountLimitedError(error)) return;
|
||||
const code = failureCode(error);
|
||||
ModalCommands.push(
|
||||
modal(() => {
|
||||
@@ -47,9 +48,6 @@ export function showGroupRecipientAddFailedModal(error: unknown): void {
|
||||
case APIErrorCodes.RATE_LIMITED:
|
||||
message = i18n._(RATE_LIMITED_DESCRIPTOR);
|
||||
break;
|
||||
case APIErrorCodes.ACCOUNT_LIMITED:
|
||||
message = failureMessage(error) || i18n._(ACCOUNT_LIMITED_NOTICE_DESCRIPTOR);
|
||||
break;
|
||||
default:
|
||||
message = i18n._(ADD_TO_GROUP_FAILED_MESSAGE_DESCRIPTOR);
|
||||
break;
|
||||
@@ -65,7 +63,8 @@ export function showGroupRecipientAddFailedModal(error: unknown): void {
|
||||
);
|
||||
}
|
||||
|
||||
export function showGroupInviteCreateFailedModal(): void {
|
||||
export function showGroupInviteCreateFailedModal(error: unknown): void {
|
||||
if (handleAccountLimitedError(error)) return;
|
||||
ModalCommands.push(
|
||||
modal(() => (
|
||||
<GenericErrorModal
|
||||
|
||||
@@ -14,6 +14,7 @@ import {TRY_AGAIN_IN_A_MOMENT_DESCRIPTOR} from '@app/features/i18n/utils/CommonM
|
||||
import * as InviteCommands from '@app/features/invite/commands/InviteCommands';
|
||||
import {Logger} from '@app/features/platform/utils/AppLogger';
|
||||
import * as TextCopyCommands from '@app/features/ui/commands/TextCopyCommands';
|
||||
import {blockIfAccountLimited} from '@app/features/user/utils/AccountLimitUtils';
|
||||
import {MS_PER_DAY} from '@fluxer/date_utils/src/DateConstants';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
import {useCallback, useMemo, useRef, useState} from 'react';
|
||||
@@ -74,6 +75,7 @@ export function useAddFriendsToGroupModalLogic(channelId: string): State & Handl
|
||||
[remainingSlotsCount],
|
||||
);
|
||||
const handleAddFriends = useCallback(async () => {
|
||||
if (blockIfAccountLimited()) return;
|
||||
setIsAdding(true);
|
||||
try {
|
||||
const promises = selectedUserIds.map((userId) =>
|
||||
@@ -109,7 +111,7 @@ export function useAddFriendsToGroupModalLogic(channelId: string): State & Handl
|
||||
return fullUrl;
|
||||
} catch (error) {
|
||||
logger.error('Failed to generate invite:', error);
|
||||
showGroupInviteCreateFailedModal();
|
||||
showGroupInviteCreateFailedModal(error);
|
||||
return null;
|
||||
} finally {
|
||||
setIsGeneratingInvite(false);
|
||||
|
||||
@@ -19,6 +19,7 @@ import {modal} from '@app/features/ui/commands/ModalCommands';
|
||||
import {UserSettingsModal} from '@app/features/user/components/modals/UserSettingsModal';
|
||||
import type {User} from '@app/features/user/models/User';
|
||||
import Users from '@app/features/user/state/Users';
|
||||
import {blockIfAccountLimited} from '@app/features/user/utils/AccountLimitUtils';
|
||||
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
|
||||
import {ME} from '@fluxer/constants/src/AppConstants';
|
||||
import type {I18n} from '@lingui/core';
|
||||
@@ -220,6 +221,7 @@ export function useCreateDMModalLogic(
|
||||
const createChannel = useCallback(
|
||||
async (userIds: Array<string>) => {
|
||||
if (restriction) return;
|
||||
if (userIds.length !== 1 && blockIfAccountLimited()) return;
|
||||
setIsCreating(true);
|
||||
try {
|
||||
const channel =
|
||||
|
||||
Reference in new issue
Block a user