diff --git a/.eslintrc.json b/.eslintrc.json
index 14ad3b192..f48320d4d 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -133,7 +133,7 @@
"no-irregular-whitespace": "error",
"no-loop-func": "error",
"no-mixed-spaces-and-tabs": "error",
- "no-nested-ternary": "warn",
+ "no-nested-ternary": "error",
"no-restricted-imports": [
"error",
{
diff --git a/src/actions/nostr.ts b/src/actions/nostr.ts
index 86e24d887..d204fcd62 100644
--- a/src/actions/nostr.ts
+++ b/src/actions/nostr.ts
@@ -27,10 +27,10 @@ function logInNostr(pubkey: string) {
secret,
}));
- dispatch(setNostrPubkey(undefined));
-
const { access_token } = dispatch(authLoggedIn(token));
- return await dispatch(verifyCredentials(access_token as string));
+ await dispatch(verifyCredentials(access_token as string));
+
+ dispatch(setNostrPubkey(undefined));
};
}
diff --git a/src/actions/settings.ts b/src/actions/settings.ts
index 257656b74..e05771fdc 100644
--- a/src/actions/settings.ts
+++ b/src/actions/settings.ts
@@ -241,7 +241,8 @@ const saveSettings = (opts?: SettingOpts) =>
const getLocale = (state: RootState, fallback = 'en') => {
const localeWithVariant = (getSettings(state).get('locale') as string).replace('_', '-');
const locale = localeWithVariant.split('-')[0];
- return Object.keys(messages).includes(localeWithVariant) ? localeWithVariant : Object.keys(messages).includes(locale) ? locale : fallback;
+ const fallbackLocale = Object.keys(messages).includes(locale) ? locale : fallback;
+ return Object.keys(messages).includes(localeWithVariant) ? localeWithVariant : fallbackLocale;
};
type SettingsAction =
diff --git a/src/contexts/nostr-context.tsx b/src/contexts/nostr-context.tsx
index 6dcca2241..0e5b1a753 100644
--- a/src/contexts/nostr-context.tsx
+++ b/src/contexts/nostr-context.tsx
@@ -2,7 +2,7 @@ import { NRelay, NRelay1, NostrSigner } from '@nostrify/nostrify';
import React, { createContext, useContext, useState, useEffect, useMemo } from 'react';
import { NKeys } from 'soapbox/features/nostr/keys';
-import { useAppSelector, useOwnAccount } from 'soapbox/hooks';
+import { useAppSelector } from 'soapbox/hooks';
import { useInstance } from 'soapbox/hooks/useInstance';
interface NostrContextType {
@@ -25,13 +25,11 @@ export const NostrProvider: React.FC = ({ children }) => {
const [relay, setRelay] = useState();
const [isRelayOpen, setIsRelayOpen] = useState(false);
- const { account } = useOwnAccount();
-
const url = instance.nostr?.relay;
- const accountPubkey = useAppSelector((state) => state.meta.pubkey ?? account?.nostr.pubkey);
+ const accountPubkey = useAppSelector(({ meta, auth }) => meta.pubkey ?? auth.users.get(auth.me!)?.id);
const signer = useMemo(
- () => (accountPubkey ? NKeys.get(accountPubkey) : undefined) ?? window.nostr,
+ () => accountPubkey ? NKeys.get(accountPubkey) ?? window.nostr : undefined,
[accountPubkey, window.nostr],
);
diff --git a/src/features/admin/domains.tsx b/src/features/admin/domains.tsx
index ea03192f4..7ae4b19f3 100644
--- a/src/features/admin/domains.tsx
+++ b/src/features/admin/domains.tsx
@@ -51,7 +51,9 @@ const Domain: React.FC = ({ domain }) => {
}));
};
- const domainState = domain.last_checked_at ? (domain.resolves ? 'active' : 'error') : 'pending';
+ const resolveState = domain.resolves ? 'active' : 'error';
+ const domainState = domain.last_checked_at ? resolveState : 'pending';
+
const domainStateLabel = {
active: ,
error: ,
diff --git a/src/features/auth-login/components/registration-form.tsx b/src/features/auth-login/components/registration-form.tsx
index 19259ff52..ea5c9c94b 100644
--- a/src/features/auth-login/components/registration-form.tsx
+++ b/src/features/auth-login/components/registration-form.tsx
@@ -141,13 +141,19 @@ const RegistrationForm: React.FC = ({ inviteToken }) => {
/>
}
>);
+ const confirmationHeading = needsConfirmation
+ ? intl.formatMessage(messages.needsConfirmationHeader)
+ : undefined;
+
+ const approvalHeading = needsApproval
+ ? intl.formatMessage(messages.needsApprovalHeader)
+ : undefined;
+
+ const heading = confirmationHeading || approvalHeading;
+
dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/outline/check.svg'),
- heading: needsConfirmation
- ? intl.formatMessage(messages.needsConfirmationHeader)
- : needsApproval
- ? intl.formatMessage(messages.needsApprovalHeader)
- : undefined,
+ heading: heading,
message,
confirm: intl.formatMessage(messages.close),
}));
diff --git a/src/features/backups/index.tsx b/src/features/backups/index.tsx
index 9cac7cb13..6c9d97f92 100644
--- a/src/features/backups/index.tsx
+++ b/src/features/backups/index.tsx
@@ -88,12 +88,14 @@ const Backups = () => {
);
- const body = showLoading ? : backups.isEmpty() ? emptyMessage : (
+ const backupsContent = backups.isEmpty() ? emptyMessage : (
{backups.map((backup) => )}
);
+ const body = showLoading ? : backupsContent;
+
return (
{body}
diff --git a/src/features/filters/index.tsx b/src/features/filters/index.tsx
index e377ce78d..52e647cef 100644
--- a/src/features/filters/index.tsx
+++ b/src/features/filters/index.tsx
@@ -70,50 +70,56 @@ const Filters = () => {
emptyMessage={emptyMessage}
itemClassName='pb-4 last:pb-0'
>
- {filters.map((filter) => (
-
-
-
-
-
- {' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
- {filter.keywords.map(keyword => keyword.keyword).join(', ')}
-
-
-
- {' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
- {filter.context.map(context => contexts[context] ? intl.formatMessage(contexts[context]) : context).join(', ')}
-
-
+ {filters.map((filter) => {
+
+ const truthMessageFilter = filter.filter_action === 'hide' ?
+ :
+ ;
+
+ const falseMessageFilter = (filter.filter_action === 'hide' ?
+ :
+ );
+
+ return (
+
+
+
- {filtersV2 ? (
- filter.filter_action === 'hide' ?
- :
-
- ) : (filter.filter_action === 'hide' ?
- :
- )}
+
+ {' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
+ {filter.keywords.map(keyword => keyword.keyword).join(', ')}
- {filter.expires_at && (
+
+
+ {' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
+ {filter.context.map(context => contexts[context] ? intl.formatMessage(contexts[context]) : context).join(', ')}
+
+
- {new Date(filter.expires_at).getTime() <= Date.now()
- ?
- : }
+ {filtersV2 ? truthMessageFilter : falseMessageFilter}
- )}
+ {filter.expires_at && (
+
+ {new Date(filter.expires_at).getTime() <= Date.now()
+ ?
+ : }
+
+ )}
+
+
+
+
+
-
-
-
-
-
-
- ))}
+
+ );
+ },
+ )}
);
diff --git a/src/features/ui/components/modals/account-moderation-modal/account-moderation-modal.tsx b/src/features/ui/components/modals/account-moderation-modal/account-moderation-modal.tsx
index 12fd96e17..d8df08427 100644
--- a/src/features/ui/components/modals/account-moderation-modal/account-moderation-modal.tsx
+++ b/src/features/ui/components/modals/account-moderation-modal/account-moderation-modal.tsx
@@ -121,7 +121,7 @@ const AccountModerationModal: React.FC = ({ onClose, ac
- {(ownAccount.admin && account.local) && (
+ {(ownAccount.admin && (account.local || features.nostr)) && (
}>
diff --git a/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx b/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx
index 5dac02d2d..3818819b7 100644
--- a/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx
+++ b/src/features/ui/components/modals/captcha-modal/captcha-modal.tsx
@@ -22,6 +22,8 @@ const CaptchaModal: React.FC = ({ onClose }) => {
xPosition,
} = useCaptcha();
+ const messageButton = tryAgain ? : ;
+
return (
} width='sm'
@@ -46,10 +48,7 @@ const CaptchaModal: React.FC = ({ onClose }) => {
>
{isSubmitting ? (
- ) : (tryAgain ?
- :
-
- )}
+ ) : messageButton}