Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ShridharGoel authored Aug 24, 2024
1 parent 9eea593 commit fbba9bb
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ async function run() {
} else if (assistantResponse.includes('[EDIT_COMMENT]') && !payload.comment?.body.includes('Edited by **proposal-police**')) {
// extract the text after [EDIT_COMMENT] from assistantResponse since this is a
// bot related action keyword
let extractedNotice = assistantResponse.split('[EDIT_COMMENT] ')?.[1]?.replace('"', '');
// format the github's updated_at like: 2024-01-24 13:15:24 UTC not 2024-01-28 18:18:28.000 UTC
const date = new Date(payload.comment?.updated_at ?? '');
const formattedDate = `${date.toISOString()?.split('.')?.[0]?.replace('T', ' ')} UTC`;
extractedNotice = extractedNotice.replace('{updated_timestamp}', formattedDate);
let extractedNotice = assistantResponse.split('[EDIT_COMMENT] ').at(1)?.replace('"', '');
// format the date like: 2024-01-24 13:15:24 UTC not 2024-01-28 18:18:28.000 UTC
const formattedDate = `${date.toISOString()?.split('.').at(0)?.replace('T', ' ')} UTC`;
extractedNotice = extractedNotice?.replace('{updated_timestamp}', formattedDate);
console.log('ProposalPolice™ editing issue comment...', payload.comment.id);
await GithubUtils.octokit.issues.updateComment({
...context.repo,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DisplayNames/DisplayNamesWithTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function DisplayNamesWithToolTip({shouldUseFullTitle, fullTitle, displayNamesWit
const {width: containerWidth, left: containerLeft} = containerRef.current.getBoundingClientRect();

// We have to return the value as Number so we can't use `measureWindow` which takes a callback
const {width: textNodeWidth, left: textNodeLeft} = childRefs.current.at(index)?.getBoundingClientRect();
const {width: textNodeWidth, left: textNodeLeft} = childRefs.current.at(index)?.getBoundingClientRect() ?? {width: 0, left: 0};
const tooltipX = textNodeWidth / 2 + textNodeLeft;
const containerRight = containerWidth + containerLeft;
const textNodeRight = textNodeWidth + textNodeLeft;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ValidateAccountMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function ValidateAccountMessage({backTo}: ValidateAccountMessageProps) {
<TextLink
fontSize={variables.fontSizeLabel}
onPress={() => {
const login = loginList?.[loginNames?.[0]] ?? {};
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(login?.partnerUserID ?? loginNames?.[0], backTo));
const login = loginList?.[loginNames.at(0) ?? ''] ?? {};
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(login?.partnerUserID ?? loginNames.at(0) ?? '', backTo));
}}
>
{translate('bankAccount.validateAccountError.phrase4')}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function insertTagIntoTransactionTagsString(transactionTags: string, tag: string
const tagArray = TransactionUtils.getTagArrayFromName(transactionTags);
tagArray[tagIndex] = tag;

while (tagArray.length > 0 && !tagArray[tagArray.length - 1]) {
while (tagArray.length > 0 && !tagArray.at(tagArray.length - 1)) {
tagArray.pop();
}

Expand Down
8 changes: 2 additions & 6 deletions src/libs/actions/OnyxUpdateManager/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,11 @@ function detectGapsAndSplit(lastUpdateIDFromClient: number): DetectGapAndSplitRe
}
}

// When "firstUpdateAfterGaps" is not set yet, we need to set it to the last update in the list,
// because we will fetch all missing updates up to the previous one and can then always apply the last update in the deferred updates.
const firstUpdateAfterGapWithFallback = firstUpdateAfterGaps ?? Number(updateValues.at(updateValues.length - 1).lastUpdateID);

let updatesAfterGaps: DeferredUpdatesDictionary = {};
const updatesAfterGaps: DeferredUpdatesDictionary = {};
if (gapExists) {
// If there is a gap and we didn't detect two chained updates, "firstUpdateToBeAppliedAfterGap" will always be the the last deferred update.
// We will fetch all missing updates up to the previous update and can always apply the last deferred update.
const firstUpdateToBeAppliedAfterGap = firstUpdateIDAfterGaps ?? Number(updateValues[updateValues.length - 1].lastUpdateID);
const firstUpdateToBeAppliedAfterGap = firstUpdateIDAfterGaps ?? Number(updateValues.at(updateValues.length - 1).lastUpdateID);

// Add all deferred updates after the gap(s) to "updatesAfterGaps".
// If "firstUpdateToBeAppliedAfterGap" is set to the last deferred update, the array will be empty.
Expand Down
30 changes: 1 addition & 29 deletions src/pages/ReimbursementAccount/BankAccountStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,35 +161,7 @@ function BankAccountStep({
/>
</View>
</Section>
{!user?.validated && (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.m4]}>
<Icon
src={Expensicons.Exclamation}
fill={theme.danger}
/>

<Text style={[styles.mutedTextLabel, styles.ml4, styles.flex1]}>
{translate('bankAccount.validateAccountError.phrase1')}
<TextLink
fontSize={variables.fontSizeLabel}
onPress={() => Session.signOutAndRedirectToSignIn()}
>
{translate('bankAccount.validateAccountError.phrase2')}
</TextLink>
{translate('bankAccount.validateAccountError.phrase3')}
<TextLink
fontSize={variables.fontSizeLabel}
onPress={() => {
const login = loginList?.[loginNames?.at(0) ?? ''] ?? {};
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(login?.partnerUserID ?? loginNames?.at(0) ?? ''));
}}
>
{translate('bankAccount.validateAccountError.phrase4')}
</TextLink>
.
</Text>
</View>
)}
{!user?.validated && <ValidateAccountMessage />}
<View style={[styles.mv0, styles.mh5, styles.flexRow, styles.justifyContentBetween]}>
<TextLink href={CONST.PRIVACY_URL}>{translate('common.privacy')}</TextLink>
<PressableWithoutFeedback
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepParticipants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function IOURequestStepParticipants({
HttpUtils.cancelPendingRequests(READ_COMMANDS.SEARCH_FOR_REPORTS);

const firstParticipantReportID = val.at(0)?.reportID ?? '';
const rateID = DistanceRequestUtils.getCustomUnitRateID(firstParticipantReportID);
const rateID = DistanceRequestUtils.getCustomUnitRateID(firstParticipantReportID, !canUseP2PDistanceRequests);
const isInvoice = iouType === CONST.IOU.TYPE.INVOICE && ReportUtils.isInvoiceRoomWithID(firstParticipantReportID);
numberOfParticipants.current = val.length;

Expand Down

0 comments on commit fbba9bb

Please sign in to comment.