Upgrade Prettier to 2.4.1
This commit is contained in:
parent
f204784afe
commit
5619eeca83
176 changed files with 1961 additions and 2465 deletions
|
@ -153,9 +153,10 @@ type GroupCallStateChangeArgumentType = {
|
|||
remoteParticipants: Array<GroupCallParticipantInfoType>;
|
||||
};
|
||||
|
||||
type GroupCallStateChangeActionPayloadType = GroupCallStateChangeArgumentType & {
|
||||
ourUuid: UUIDStringType;
|
||||
};
|
||||
type GroupCallStateChangeActionPayloadType =
|
||||
GroupCallStateChangeArgumentType & {
|
||||
ourUuid: UUIDStringType;
|
||||
};
|
||||
|
||||
export type HangUpType = {
|
||||
conversationId: string;
|
||||
|
@ -900,9 +901,8 @@ function peekNotConnectedGroupCall(
|
|||
|
||||
await calling.updateCallHistoryForGroupCall(conversationId, peekInfo);
|
||||
|
||||
const formattedPeekInfo = calling.formatGroupCallPeekInfoForRedux(
|
||||
peekInfo
|
||||
);
|
||||
const formattedPeekInfo =
|
||||
calling.formatGroupCallPeekInfoForRedux(peekInfo);
|
||||
|
||||
dispatch({
|
||||
type: PEEK_NOT_CONNECTED_GROUP_CALL_FULFILLED,
|
||||
|
@ -1947,7 +1947,8 @@ export function reducer(
|
|||
...state,
|
||||
activeCallState: {
|
||||
...activeCallState,
|
||||
showNeedsScreenRecordingPermissionsWarning: !activeCallState.showNeedsScreenRecordingPermissionsWarning,
|
||||
showNeedsScreenRecordingPermissionsWarning:
|
||||
!activeCallState.showNeedsScreenRecordingPermissionsWarning,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2348,7 +2348,8 @@ export function reducer(
|
|||
|
||||
return {
|
||||
...state,
|
||||
outboundMessagesPendingConversationVerification: newOutboundMessagesPendingConversationVerification,
|
||||
outboundMessagesPendingConversationVerification:
|
||||
newOutboundMessagesPendingConversationVerification,
|
||||
};
|
||||
}
|
||||
if (action.type === 'MESSAGE_CHANGED') {
|
||||
|
@ -2770,12 +2771,8 @@ export function reducer(
|
|||
return state;
|
||||
}
|
||||
|
||||
let {
|
||||
newest,
|
||||
oldest,
|
||||
oldestUnread,
|
||||
totalUnread,
|
||||
} = existingConversation.metrics;
|
||||
let { newest, oldest, oldestUnread, totalUnread } =
|
||||
existingConversation.metrics;
|
||||
|
||||
if (messages.length < 1) {
|
||||
return state;
|
||||
|
@ -3341,11 +3338,8 @@ export function reducer(
|
|||
|
||||
if (action.type === COLOR_SELECTED) {
|
||||
const { conversationLookup } = state;
|
||||
const {
|
||||
conversationId,
|
||||
conversationColor,
|
||||
customColorData,
|
||||
} = action.payload;
|
||||
const { conversationId, conversationColor, customColorData } =
|
||||
action.payload;
|
||||
|
||||
const existing = conversationLookup[conversationId];
|
||||
if (!existing) {
|
||||
|
|
|
@ -254,10 +254,8 @@ export function reducer(
|
|||
return state;
|
||||
}
|
||||
|
||||
const {
|
||||
draftPreferredReactions,
|
||||
selectedDraftEmojiIndex,
|
||||
} = customizePreferredReactionsModal;
|
||||
const { draftPreferredReactions, selectedDraftEmojiIndex } =
|
||||
customizePreferredReactionsModal;
|
||||
if (selectedDraftEmojiIndex === undefined) {
|
||||
return state;
|
||||
}
|
||||
|
@ -284,9 +282,10 @@ export function reducer(
|
|||
...state,
|
||||
customizePreferredReactionsModal: {
|
||||
...state.customizePreferredReactionsModal,
|
||||
draftPreferredReactions: DEFAULT_PREFERRED_REACTION_EMOJI_SHORT_NAMES.map(
|
||||
shortName => convertShortName(shortName, skinTone)
|
||||
),
|
||||
draftPreferredReactions:
|
||||
DEFAULT_PREFERRED_REACTION_EMOJI_SHORT_NAMES.map(shortName =>
|
||||
convertShortName(shortName, skinTone)
|
||||
),
|
||||
selectedDraftEmojiIndex: undefined,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -203,13 +203,11 @@ const doSearch = debounce(
|
|||
|
||||
if (!searchConversationId) {
|
||||
(async () => {
|
||||
const {
|
||||
conversationIds,
|
||||
contactIds,
|
||||
} = await queryConversationsAndContacts(query, {
|
||||
ourConversationId,
|
||||
noteToSelf,
|
||||
});
|
||||
const { conversationIds, contactIds } =
|
||||
await queryConversationsAndContacts(query, {
|
||||
ourConversationId,
|
||||
noteToSelf,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: 'SEARCH_DISCUSSIONS_RESULTS_FULFILLED',
|
||||
|
@ -258,9 +256,8 @@ async function queryConversationsAndContacts(
|
|||
const { ourConversationId, noteToSelf } = options;
|
||||
const query = providedQuery.replace(/[+.()]*/g, '');
|
||||
|
||||
const searchResults: Array<DBConversationType> = await dataSearchConversations(
|
||||
query
|
||||
);
|
||||
const searchResults: Array<DBConversationType> =
|
||||
await dataSearchConversations(query);
|
||||
|
||||
// Split into two groups - active conversations and items just from address book
|
||||
let conversationIds: Array<string> = [];
|
||||
|
|
|
@ -19,11 +19,8 @@ import { trigger } from '../../shims/events';
|
|||
|
||||
import type { NoopActionType } from './noop';
|
||||
|
||||
const {
|
||||
getRecentStickers,
|
||||
updateStickerLastUsed,
|
||||
updateStickerPackStatus,
|
||||
} = dataInterface;
|
||||
const { getRecentStickers, updateStickerLastUsed, updateStickerPackStatus } =
|
||||
dataInterface;
|
||||
|
||||
// State
|
||||
|
||||
|
|
|
@ -32,40 +32,44 @@ export const getBadgesById = createSelector(getBadgeState, state =>
|
|||
|
||||
export const getBadgesSelector = createSelector(
|
||||
getBadgesById,
|
||||
badgesById => (
|
||||
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
|
||||
): Array<BadgeType> => {
|
||||
const result: Array<BadgeType> = [];
|
||||
badgesById =>
|
||||
(
|
||||
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
|
||||
): Array<BadgeType> => {
|
||||
const result: Array<BadgeType> = [];
|
||||
|
||||
for (const { id } of conversationBadges) {
|
||||
const badge = getOwn(badgesById, id);
|
||||
if (!badge) {
|
||||
log.error('getBadgesSelector: conversation badge was not found');
|
||||
continue;
|
||||
for (const { id } of conversationBadges) {
|
||||
const badge = getOwn(badgesById, id);
|
||||
if (!badge) {
|
||||
log.error('getBadgesSelector: conversation badge was not found');
|
||||
continue;
|
||||
}
|
||||
result.push(badge);
|
||||
}
|
||||
result.push(badge);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
);
|
||||
|
||||
export const getPreferredBadgeSelector = createSelector(
|
||||
getBadgesById,
|
||||
badgesById => (
|
||||
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
|
||||
): undefined | BadgeType => {
|
||||
const firstId: undefined | string = conversationBadges[0]?.id;
|
||||
if (!firstId) {
|
||||
return undefined;
|
||||
}
|
||||
badgesById =>
|
||||
(
|
||||
conversationBadges: ReadonlyArray<Pick<BadgeType, 'id'>>
|
||||
): undefined | BadgeType => {
|
||||
const firstId: undefined | string = conversationBadges[0]?.id;
|
||||
if (!firstId) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const badge = getOwn(badgesById, firstId);
|
||||
if (!badge) {
|
||||
log.error('getPreferredBadgeSelector: conversation badge was not found');
|
||||
return undefined;
|
||||
}
|
||||
const badge = getOwn(badgesById, firstId);
|
||||
if (!badge) {
|
||||
log.error(
|
||||
'getPreferredBadgeSelector: conversation badge was not found'
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return badge;
|
||||
}
|
||||
return badge;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -35,9 +35,9 @@ export type CallSelectorType = (
|
|||
) => CallStateType | undefined;
|
||||
export const getCallSelector = createSelector(
|
||||
getCallsByConversation,
|
||||
(callsByConversation: CallsByConversationType): CallSelectorType => (
|
||||
conversationId: string
|
||||
) => getOwn(callsByConversation, conversationId)
|
||||
(callsByConversation: CallsByConversationType): CallSelectorType =>
|
||||
(conversationId: string) =>
|
||||
getOwn(callsByConversation, conversationId)
|
||||
);
|
||||
|
||||
export const getActiveCall = createSelector(
|
||||
|
|
|
@ -115,9 +115,9 @@ const getAllConversations = createSelector(
|
|||
|
||||
export const getConversationsByTitleSelector = createSelector(
|
||||
getAllConversations,
|
||||
(conversations): ((title: string) => Array<ConversationType>) => (
|
||||
title: string
|
||||
) => conversations.filter(conversation => conversation.title === title)
|
||||
(conversations): ((title: string) => Array<ConversationType>) =>
|
||||
(title: string) =>
|
||||
conversations.filter(conversation => conversation.title === title)
|
||||
);
|
||||
|
||||
export const getSelectedConversationId = createSelector(
|
||||
|
@ -675,14 +675,16 @@ export const getConversationSelector = createSelector(
|
|||
|
||||
export const getConversationByIdSelector = createSelector(
|
||||
getConversationLookup,
|
||||
conversationLookup => (id: string): undefined | ConversationType =>
|
||||
getOwn(conversationLookup, id)
|
||||
conversationLookup =>
|
||||
(id: string): undefined | ConversationType =>
|
||||
getOwn(conversationLookup, id)
|
||||
);
|
||||
|
||||
export const getConversationByUuidSelector = createSelector(
|
||||
getConversationsByUuid,
|
||||
conversationsByUuid => (uuid: UUIDStringType): undefined | ConversationType =>
|
||||
getOwn(conversationsByUuid, uuid)
|
||||
conversationsByUuid =>
|
||||
(uuid: UUIDStringType): undefined | ConversationType =>
|
||||
getOwn(conversationsByUuid, uuid)
|
||||
);
|
||||
|
||||
// A little optimization to reset our selector cache whenever high-level application data
|
||||
|
@ -749,9 +751,8 @@ export const getContactNameColorSelector = createSelector(
|
|||
conversationId: string,
|
||||
contactId: string
|
||||
): ContactNameColorType => {
|
||||
const contactNameColors = conversationMemberColorsSelector(
|
||||
conversationId
|
||||
);
|
||||
const contactNameColors =
|
||||
conversationMemberColorsSelector(conversationId);
|
||||
const color = contactNameColors.get(contactId);
|
||||
if (!color) {
|
||||
log.warn(`No color generated for contact ${contactId}`);
|
||||
|
@ -968,9 +969,11 @@ export const getGroupAdminsSelector = createSelector(
|
|||
getConversationSelector,
|
||||
(conversationSelector: GetConversationByIdType) => {
|
||||
return (conversationId: string): Array<ConversationType> => {
|
||||
const { groupId, groupVersion, memberships = [] } = conversationSelector(
|
||||
conversationId
|
||||
);
|
||||
const {
|
||||
groupId,
|
||||
groupVersion,
|
||||
memberships = [],
|
||||
} = conversationSelector(conversationId);
|
||||
|
||||
if (
|
||||
!isGroupV2({
|
||||
|
@ -1001,25 +1004,27 @@ const getOutboundMessagesPendingConversationVerification = createSelector(
|
|||
conversations.outboundMessagesPendingConversationVerification
|
||||
);
|
||||
|
||||
const getConversationIdsStoppingMessageSendBecauseOfVerification = createSelector(
|
||||
getOutboundMessagesPendingConversationVerification,
|
||||
(outboundMessagesPendingConversationVerification): Array<string> =>
|
||||
Object.keys(outboundMessagesPendingConversationVerification)
|
||||
);
|
||||
const getConversationIdsStoppingMessageSendBecauseOfVerification =
|
||||
createSelector(
|
||||
getOutboundMessagesPendingConversationVerification,
|
||||
(outboundMessagesPendingConversationVerification): Array<string> =>
|
||||
Object.keys(outboundMessagesPendingConversationVerification)
|
||||
);
|
||||
|
||||
export const getConversationsStoppingMessageSendBecauseOfVerification = createSelector(
|
||||
getConversationByIdSelector,
|
||||
getConversationIdsStoppingMessageSendBecauseOfVerification,
|
||||
(
|
||||
conversationSelector: (id: string) => undefined | ConversationType,
|
||||
conversationIds: ReadonlyArray<string>
|
||||
): Array<ConversationType> => {
|
||||
const conversations = conversationIds
|
||||
.map(conversationId => conversationSelector(conversationId))
|
||||
.filter(isNotNil);
|
||||
return sortByTitle(conversations);
|
||||
}
|
||||
);
|
||||
export const getConversationsStoppingMessageSendBecauseOfVerification =
|
||||
createSelector(
|
||||
getConversationByIdSelector,
|
||||
getConversationIdsStoppingMessageSendBecauseOfVerification,
|
||||
(
|
||||
conversationSelector: (id: string) => undefined | ConversationType,
|
||||
conversationIds: ReadonlyArray<string>
|
||||
): Array<ConversationType> => {
|
||||
const conversations = conversationIds
|
||||
.map(conversationId => conversationSelector(conversationId))
|
||||
.filter(isNotNil);
|
||||
return sortByTitle(conversations);
|
||||
}
|
||||
);
|
||||
|
||||
export const getMessageIdsPendingBecauseOfVerification = createSelector(
|
||||
getOutboundMessagesPendingConversationVerification,
|
||||
|
|
|
@ -473,7 +473,8 @@ export const getPropsForQuote = createSelectorCreator(memoizeByRoot, isEqual)(
|
|||
const firstAttachment = quote.attachments && quote.attachments[0];
|
||||
const conversation = getConversation(message, conversationSelector);
|
||||
|
||||
const defaultConversationColor = window.Events.getDefaultConversationColor();
|
||||
const defaultConversationColor =
|
||||
window.Events.getDefaultConversationColor();
|
||||
|
||||
return {
|
||||
authorId,
|
||||
|
@ -592,7 +593,8 @@ const getShallowPropsForMessage = createSelectorCreator(memoizeByRoot, isEqual)(
|
|||
});
|
||||
const contactNameColor = contactNameColorSelector(conversationId, authorId);
|
||||
|
||||
const defaultConversationColor = window.Events.getDefaultConversationColor();
|
||||
const defaultConversationColor =
|
||||
window.Events.getDefaultConversationColor();
|
||||
|
||||
return {
|
||||
canDeleteForEveryone: canDeleteForEveryone(message),
|
||||
|
|
|
@ -22,14 +22,12 @@ import type { SafetyNumberProps } from '../../components/SafetyNumberChangeDialo
|
|||
const mapStateToProps = (state: StateType) => {
|
||||
return {
|
||||
...state.app,
|
||||
conversationsStoppingMessageSendBecauseOfVerification: getConversationsStoppingMessageSendBecauseOfVerification(
|
||||
state
|
||||
),
|
||||
conversationsStoppingMessageSendBecauseOfVerification:
|
||||
getConversationsStoppingMessageSendBecauseOfVerification(state),
|
||||
i18n: getIntl(state),
|
||||
isCustomizingPreferredReactions: getIsCustomizingPreferredReactions(state),
|
||||
numberOfMessagesPendingBecauseOfVerification: getNumberOfMessagesPendingBecauseOfVerification(
|
||||
state
|
||||
),
|
||||
numberOfMessagesPendingBecauseOfVerification:
|
||||
getNumberOfMessagesPendingBecauseOfVerification(state),
|
||||
renderCallManager: () => <SmartCallManager />,
|
||||
renderCustomizingPreferredReactionsModal: () => (
|
||||
<SmartCustomizingPreferredReactionsModal />
|
||||
|
|
|
@ -44,9 +44,8 @@ function renderSafetyNumberViewer(props: SafetyNumberViewerProps): JSX.Element {
|
|||
return <SmartSafetyNumberViewer {...props} />;
|
||||
}
|
||||
|
||||
const getGroupCallVideoFrameSource = callingService.getGroupCallVideoFrameSource.bind(
|
||||
callingService
|
||||
);
|
||||
const getGroupCallVideoFrameSource =
|
||||
callingService.getGroupCallVideoFrameSource.bind(callingService);
|
||||
|
||||
async function notifyForCall(
|
||||
title: string,
|
||||
|
|
|
@ -44,12 +44,8 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
|||
throw new Error(`Conversation id ${id} not found!`);
|
||||
}
|
||||
|
||||
const {
|
||||
announcementsOnly,
|
||||
areWeAdmin,
|
||||
draftText,
|
||||
draftBodyRanges,
|
||||
} = conversation;
|
||||
const { announcementsOnly, areWeAdmin, draftText, draftBodyRanges } =
|
||||
conversation;
|
||||
|
||||
const receivedPacks = getReceivedStickerPacks(state);
|
||||
const installedPacks = getInstalledStickerPacks(state);
|
||||
|
@ -125,9 +121,8 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
|||
conversationType: conversation.type,
|
||||
isSMSOnly: Boolean(isConversationSMSOnly(conversation)),
|
||||
isFetchingUUID: conversation.isFetchingUUID,
|
||||
isMissingMandatoryProfileSharing: isMissingRequiredProfileSharing(
|
||||
conversation
|
||||
),
|
||||
isMissingMandatoryProfileSharing:
|
||||
isMissingRequiredProfileSharing(conversation),
|
||||
// Groups
|
||||
announcementsOnly,
|
||||
areWeAdmin,
|
||||
|
|
|
@ -107,9 +107,8 @@ const mapStateToProps = (state: StateType, ownProps: OwnProps) => {
|
|||
]),
|
||||
badge: getPreferredBadgeSelector(state)(conversation.badges),
|
||||
conversationTitle: state.conversations.selectedConversationTitle,
|
||||
isMissingMandatoryProfileSharing: isMissingRequiredProfileSharing(
|
||||
conversation
|
||||
),
|
||||
isMissingMandatoryProfileSharing:
|
||||
isMissingRequiredProfileSharing(conversation),
|
||||
isSMSOnly: isConversationSMSOnly(conversation),
|
||||
i18n: getIntl(state),
|
||||
showBackButton: state.conversations.selectedConversationPanelDepth > 0,
|
||||
|
|
|
@ -17,11 +17,8 @@ export type OwnProps = {
|
|||
};
|
||||
|
||||
const mapStateToProps = (state: StateType, props: OwnProps) => {
|
||||
const {
|
||||
conversationId,
|
||||
setDontNotifyForMentionsIfMuted,
|
||||
setMuteExpiration,
|
||||
} = props;
|
||||
const { conversationId, setDontNotifyForMentionsIfMuted, setMuteExpiration } =
|
||||
props;
|
||||
|
||||
const conversationSelector = getConversationByIdSelector(state);
|
||||
const conversation = conversationSelector(conversationId);
|
||||
|
|
|
@ -43,11 +43,8 @@ export type PropsType = {
|
|||
};
|
||||
|
||||
const mapStateToProps = (_state: StateType, props: PropsType) => {
|
||||
const {
|
||||
compositionAreaProps,
|
||||
conversationHeaderProps,
|
||||
timelineProps,
|
||||
} = props;
|
||||
const { compositionAreaProps, conversationHeaderProps, timelineProps } =
|
||||
props;
|
||||
|
||||
return {
|
||||
renderCompositionArea: () => (
|
||||
|
|
|
@ -28,9 +28,8 @@ export const SmartReactionPicker = React.forwardRef<
|
|||
HTMLDivElement,
|
||||
ExternalProps
|
||||
>((props, ref) => {
|
||||
const {
|
||||
openCustomizePreferredReactionsModal,
|
||||
} = usePreferredReactionsActions();
|
||||
const { openCustomizePreferredReactionsModal } =
|
||||
usePreferredReactionsActions();
|
||||
const { onSetSkinTone } = useItemsActions();
|
||||
|
||||
const i18n = useSelector<StateType, LocalizerType>(getIntl);
|
||||
|
|
|
@ -177,9 +177,8 @@ const getWarning = (
|
|||
switch (conversation.type) {
|
||||
case 'direct':
|
||||
if (!conversation.acceptedMessageRequest && !conversation.isBlocked) {
|
||||
const getConversationsWithTitle = getConversationsByTitleSelector(
|
||||
state
|
||||
);
|
||||
const getConversationsWithTitle =
|
||||
getConversationsByTitleSelector(state);
|
||||
const conversationsWithSameTitle = getConversationsWithTitle(
|
||||
conversation.title
|
||||
);
|
||||
|
@ -221,9 +220,8 @@ const getWarning = (
|
|||
type: ContactSpoofingType.MultipleGroupMembersWithSameTitle,
|
||||
acknowledgedGroupNameCollisions:
|
||||
conversation.acknowledgedGroupNameCollisions || {},
|
||||
groupNameCollisions: dehydrateCollisionsWithConversations(
|
||||
groupNameCollisions
|
||||
),
|
||||
groupNameCollisions:
|
||||
dehydrateCollisionsWithConversations(groupNameCollisions),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -308,9 +306,8 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
|||
!conversation.acceptedMessageRequest
|
||||
),
|
||||
...conversationMessages,
|
||||
invitedContactsForNewlyCreatedGroup: getInvitedContactsForNewlyCreatedGroup(
|
||||
state
|
||||
),
|
||||
invitedContactsForNewlyCreatedGroup:
|
||||
getInvitedContactsForNewlyCreatedGroup(state),
|
||||
selectedMessageId: selectedMessage ? selectedMessage.id : undefined,
|
||||
|
||||
warning: getWarning(conversation, state),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue