Skip to content

Commit

Permalink
chore: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed Jan 6, 2025
1 parent 97e95ef commit a44dc50
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 21 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"start-prod": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron .",
"start-prod:pretty": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron . | npx bunyan",
"start-dev": "cross-env NODE_ENV=development NODE_APP_INSTANCE=devprod$MULTI electron .",
"build-everything": "python3 --version && yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && tsc && yarn build:workers",
"build-everything:soft": "python3 --version && yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && tsc && yarn build:workers",
"build-everything": "yarn print-deps && yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && tsc && yarn build:workers",
"build-everything:soft": "yarn print-deps && yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && tsc && yarn build:workers",
"build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && yarn build:workers && yarn tsc -w",
"start-dev:pretty": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron . | npx bunyan",
"build:workers": "yarn worker:utils && yarn worker:libsession",
Expand All @@ -60,7 +60,8 @@
"worker:utils": "webpack --config=./utils.worker.config.js",
"worker:libsession": "rimraf 'ts/webworker/workers/node/libsession/*.node' && webpack --config=./libsession.worker.config.js",
"dedup-yarn-lock": "npx --yes yarn-deduplicate yarn.lock",
"prepare": "husky install"
"prepare": "husky install",
"print-deps": "node -v && python3 --version"
},
"dependencies": {
"@emoji-mart/data": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion ts/components/basic/StyledI18nSubText.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components';
import { forwardRef } from 'react';
import { Localizer } from './Localizer';
import { LocalizerComponentPropsObject } from '../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../localization/localeTools';

const StyledI18nSubTextContainer = styled('div')`
font-size: var(--font-size-md);
Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/TimerNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Localizer } from '../basic/Localizer';
import { SessionButtonColor } from '../basic/SessionButton';
import { SessionIcon } from '../icon';
import { getTimerNotificationStr } from '../../models/timerNotifications';
import { LocalizerComponentPropsObject } from '../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../localization/localeTools';

const FollowSettingButton = styled.button`
color: var(--primary-color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { Localizer } from '../../../basic/Localizer';
import { ExpirableReadableMessage } from './ExpirableReadableMessage';
import { NotificationBubble } from './notification-bubble/NotificationBubble';
import { LocalizerComponentPropsObject } from '../../../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../../../localization/localeTools';

// This component is used to display group updates in the conversation view.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PubKey } from '../../../../session/types/PubKey';

import { Localizer } from '../../../basic/Localizer';
import { nativeEmojiData } from '../../../../util/emoji';
import { LocalizerComponentPropsObject } from '../../../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../../../localization/localeTools';

export type TipPosition = 'center' | 'left' | 'right';

Expand Down
2 changes: 1 addition & 1 deletion ts/components/dialog/SessionConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SpacerLG } from '../basic/Text';
import { SessionSpinner } from '../loading';

import { StyledI18nSubText } from '../basic/StyledI18nSubText';
import { LocalizerComponentPropsObject } from '../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../localization/localeTools';

export interface SessionConfirmDialogProps {
i18nMessage?: LocalizerComponentPropsObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Localizer } from '../../basic/Localizer';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../../basic/SessionButton';
import { StyledModalDescriptionContainer } from '../shared/ModalDescriptionContainer';
import { BlockOrUnblockModalState } from './BlockOrUnblockModalState';
import { LocalizerComponentPropsObject } from '../../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../../localization/localeTools';

type ModalState = NonNullable<BlockOrUnblockModalState>;

Expand Down
2 changes: 1 addition & 1 deletion ts/components/registration/components/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { deleteDbLocally } from '../../../util/accountManager';
import { Flex } from '../../basic/Flex';
import { SessionButtonColor } from '../../basic/SessionButton';
import { SessionIconButton } from '../../icon';
import { LocalizerComponentPropsObject } from '../../../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../../../localization/localeTools';

/** Min height should match the onboarding step with the largest height this prevents the loading spinner from jumping around while still keeping things centered */
const StyledBackButtonContainer = styled(Flex)`
Expand Down
2 changes: 1 addition & 1 deletion ts/interactions/conversationInteractions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { GroupPromote } from '../session/utils/job_runners/jobs/GroupPromoteJob'
import { MessageSender } from '../session/sending';
import { StoreGroupRequestFactory } from '../session/apis/snode_api/factories/StoreGroupRequestFactory';
import { DURATION } from '../session/constants';
import { LocalizerComponentPropsObject } from '../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../localization/localeTools';

export async function copyPublicKeyByConvoId(convoId: string) {
if (OpenGroupUtils.isOpenGroupV2(convoId)) {
Expand Down
9 changes: 6 additions & 3 deletions ts/localization/localeTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ export function isPluralToken(token: string): token is PluralLocalizerTokens {
return token in pluralsDictionary;
}

type TokenWithArgs<D> = {
[K in keyof D]: D[K] extends { args: undefined } | { args: never } ? never : K;
}[keyof D];
/**
* This type extracts from a dictionary, the keys that have a property 'args' set (i.e. not undefined or never).
*/
type TokenWithArgs<Dict> = {
[Key in keyof Dict]: Dict[Key] extends { args: undefined } | { args: never } ? never : Key;
}[keyof Dict];

type MergedTokenWithArgs = TokenWithArgs<SimpleDictionary> | TokenWithArgs<PluralDictionary>;

Expand Down
2 changes: 1 addition & 1 deletion ts/models/groupUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LocalizerComponentPropsObject } from '../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../localization/localeTools';
import { ConvoHub } from '../session/conversations';
import { UserUtils } from '../session/utils';

Expand Down
2 changes: 1 addition & 1 deletion ts/models/timerNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PubKey } from '../session/types';
import { UserUtils } from '../session/utils';
import { TimerOptions } from '../session/disappearing_messages/timerOptions';
import { isLegacyDisappearingModeEnabled } from '../session/disappearing_messages/legacy';
import { LocalizerComponentPropsObject } from '../localization/localeTools';
import type { LocalizerComponentPropsObject } from '../localization/localeTools';

export function getTimerNotificationStr({
expirationMode,
Expand Down
6 changes: 3 additions & 3 deletions ts/state/ducks/metaGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ async function handleMemberAddedFromUI({
throw new Error('tried to make change to group but we do not have the admin secret key');
}

await checkWeAreAdminOrThrow(groupPk, 'handleMemberAddedFromUIOrNot');
await checkWeAreAdminOrThrow(groupPk, 'handleMemberAddedFromUI');

const { withHistory, withoutHistory, convo, us } = validateMemberAddChange({
withHistory: addMembersWithHistory,
Expand Down Expand Up @@ -675,12 +675,12 @@ async function handleMemberAddedFromUI({
await LibSessionUtil.saveDumpsToDb(groupPk);

throw new Error(
'handleMemberAddedFromUIOrNot: pushChangesToGroupSwarmIfNeeded did not return success'
'handleMemberAddedFromUI: pushChangesToGroupSwarmIfNeeded did not return success'
);
}
} catch (e) {
window.log.warn(
'handleNameChangeFromUIOrNot: pushChangesToGroupSwarmIfNeeded failed with:',
'handleMemberAddedFromUI: pushChangesToGroupSwarmIfNeeded failed with:',
e.message
);
}
Expand Down
2 changes: 1 addition & 1 deletion ts/util/i18n/functions/getMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ getMessageDefaultCopy.strippedWithObj = strippedWithObj;
getMessageDefaultCopy.getRawMessage = getRawMessage;
getMessageDefaultCopy.formatMessageWithArgs = formatMessageWithArgs;

export const getMessage: SetupI18nReturnType = getMessageDefault as SetupI18nReturnType;
export const getMessage: SetupI18nReturnType = getMessageDefaultCopy as SetupI18nReturnType;
2 changes: 1 addition & 1 deletion ts/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Persistor } from 'redux-persist/es/types';

import { PrimaryColorStateType, ThemeStateType } from './themes/constants/colors';
import type { GetMessageArgs, I18nMethods } from './types/localizer';
import { MergedLocalizerTokens } from './localization/localeTools';
import type { MergedLocalizerTokens } from './localization/localeTools';

export interface LibTextsecure {
messaging: boolean;
Expand Down

0 comments on commit a44dc50

Please sign in to comment.