Skip to content

Commit

Permalink
Merge branch 'main' into @chrispader/GetMissingOnyxMessages-deferred-…
Browse files Browse the repository at this point in the history
…updates-after-revert
  • Loading branch information
chrispader committed Apr 27, 2024
2 parents 23eab2d + 10fc359 commit f48d931
Show file tree
Hide file tree
Showing 33 changed files with 275 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {promiseDoWhile} from '@github/libs/promiseWhile';
type CurrentStagingDeploys = Awaited<ReturnType<typeof GitHubUtils.octokit.actions.listWorkflowRuns>>['data']['workflow_runs'];

function run() {
console.info('[awaitStagingDeploys] POLL RATE', CONST.POLL_RATE);
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] getStringInput', getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GitHubUtils);
Expand Down
8 changes: 7 additions & 1 deletion .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12131,6 +12131,7 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873));
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
const promiseWhile_1 = __nccwpck_require__(9438);
function run() {
console.info('[awaitStagingDeploys] POLL RATE', CONST_1.default.POLL_RATE);
console.info('[awaitStagingDeploys] run()');
console.info('[awaitStagingDeploys] getStringInput', ActionUtils_1.getStringInput);
console.info('[awaitStagingDeploys] GitHubUtils', GithubUtils_1.default);
Expand Down Expand Up @@ -12742,7 +12743,12 @@ function promiseWhile(condition, action) {
resolve();
return;
}
Promise.resolve(actionResult).then(loop).catch(reject);
Promise.resolve(actionResult)
.then(() => {
// Set a timeout to delay the next loop iteration
setTimeout(loop, 1000); // 1000 ms delay
})
.catch(reject);
}
};
loop();
Expand Down
7 changes: 6 additions & 1 deletion .github/libs/promiseWhile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ function promiseWhile(condition: () => boolean, action: (() => Promise<void>) |
return;
}

Promise.resolve(actionResult).then(loop).catch(reject);
Promise.resolve(actionResult)
.then(() => {
// Set a timeout to delay the next loop iteration
setTimeout(loop, 1000); // 1000 ms delay
})
.catch(reject);
}
};
loop();
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001046605
versionName "1.4.66-5"
versionCode 1001046700
versionName "1.4.67-0"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
File renamed without changes
14 changes: 14 additions & 0 deletions assets/images/receipt-scan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.66</string>
<string>1.4.67</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.66.5</string>
<string>1.4.67.0</string>
<key>FullStory</key>
<dict>
<key>OrgId</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.66</string>
<string>1.4.67</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.66.5</string>
<string>1.4.67.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleShortVersionString</key>
<string>1.4.66</string>
<string>1.4.67</string>
<key>CFBundleVersion</key>
<string>1.4.66.5</string>
<string>1.4.67.0</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.66-5",
"version": "1.4.67-0",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
6 changes: 6 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,12 @@ const CONST = {
OWNER_EMAIL_FAKE: '__FAKE__',
OWNER_ACCOUNT_ID_FAKE: 0,
DEFAULT_REPORT_NAME: 'Chat Report',
PERMISSIONS: {
READ: 'read',
WRITE: 'write',
SHARE: 'share',
OWN: 'own',
},
},
NEXT_STEP: {
FINISHED: 'Finished!',
Expand Down
30 changes: 25 additions & 5 deletions src/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import getButtonState from '@libs/getButtonState';
import CONST from '@src/CONST';
import type IconAsset from '@src/types/utils/IconAsset';
import Hoverable from './Hoverable';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
Expand All @@ -17,7 +18,13 @@ import Tooltip from './Tooltip';

type BannerProps = {
/** Text to display in the banner. */
text: string;
text?: string;

/** Content to display in the banner. */
content?: React.ReactNode;

/** The icon asset to display to the left of the text */
icon?: IconAsset | null;

/** Should this component render the left-aligned exclamation icon? */
shouldShowIcon?: boolean;
Expand All @@ -41,7 +48,18 @@ type BannerProps = {
textStyles?: StyleProp<TextStyle>;
};

function Banner({text, onClose, onPress, containerStyles, textStyles, shouldRenderHTML = false, shouldShowIcon = false, shouldShowCloseButton = false}: BannerProps) {
function Banner({
text,
content,
icon = Expensicons.Exclamation,
onClose,
onPress,
containerStyles,
textStyles,
shouldRenderHTML = false,
shouldShowIcon = false,
shouldShowCloseButton = false,
}: BannerProps) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand All @@ -65,15 +83,17 @@ function Banner({text, onClose, onPress, containerStyles, textStyles, shouldRend
]}
>
<View style={[styles.flexRow, styles.flexGrow1, styles.mw100, styles.alignItemsCenter]}>
{shouldShowIcon && (
{shouldShowIcon && icon && (
<View style={[styles.mr3]}>
<Icon
src={Expensicons.Exclamation}
src={icon}
fill={StyleUtils.getIconFillColor(getButtonState(shouldHighlight))}
/>
</View>
)}
{shouldRenderHTML ? (
{content && content}

{shouldRenderHTML && text ? (
<RenderHTML html={text} />
) : (
<Text
Expand Down
6 changes: 4 additions & 2 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import ChatBubbles from '@assets/images/chatbubbles.svg';
import Checkmark from '@assets/images/checkmark.svg';
import Close from '@assets/images/close.svg';
import ClosedSign from '@assets/images/closed-sign.svg';
import Coins from '@assets/images/coins.svg';
import Collapse from '@assets/images/collapse.svg';
import Concierge from '@assets/images/concierge.svg';
import Connect from '@assets/images/connect.svg';
Expand Down Expand Up @@ -123,6 +124,7 @@ import Printer from '@assets/images/printer.svg';
import Profile from '@assets/images/profile.svg';
import QrCode from '@assets/images/qrcode.svg';
import QuestionMark from '@assets/images/question-mark-circle.svg';
import ReceiptScan from '@assets/images/receipt-scan.svg';
import ReceiptSearch from '@assets/images/receipt-search.svg';
import Receipt from '@assets/images/receipt.svg';
import RemoveMembers from '@assets/images/remove-members.svg';
Expand All @@ -143,7 +145,6 @@ import Stopwatch from '@assets/images/stopwatch.svg';
import Sync from '@assets/images/sync.svg';
import Tag from '@assets/images/tag.svg';
import Task from '@assets/images/task.svg';
import Tax from '@assets/images/tax.svg';
import Thread from '@assets/images/thread.svg';
import ThreeDots from '@assets/images/three-dots.svg';
import ThumbsUp from '@assets/images/thumbs-up.svg';
Expand Down Expand Up @@ -234,7 +235,7 @@ export {
Fullscreen,
Folder,
Tag,
Tax,
Coins,
Thread,
Gallery,
Gear,
Expand Down Expand Up @@ -288,6 +289,7 @@ export {
QrCode,
QuestionMark,
Receipt,
ReceiptScan,
RemoveMembers,
ReceiptSearch,
Rotate,
Expand Down
2 changes: 1 addition & 1 deletion src/components/TabSelector/TabSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getIconAndTitle(route: string, translate: LocaleContextProps['translate
case CONST.TAB_REQUEST.MANUAL:
return {icon: Expensicons.Pencil, title: translate('tabSelector.manual')};
case CONST.TAB_REQUEST.SCAN:
return {icon: Expensicons.Receipt, title: translate('tabSelector.scan')};
return {icon: Expensicons.ReceiptScan, title: translate('tabSelector.scan')};
case CONST.TAB.NEW_CHAT:
return {icon: Expensicons.User, title: translate('tabSelector.chat')};
case CONST.TAB.NEW_ROOM:
Expand Down
4 changes: 4 additions & 0 deletions src/components/TaskHeaderActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ function TaskHeaderActionButton({report, session}: TaskHeaderActionButtonProps)
const {translate} = useLocalize();
const styles = useThemeStyles();

if (!ReportUtils.canWriteInReport(report)) {
return null;
}

return (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentEnd]}>
<Button
Expand Down
10 changes: 10 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,16 @@ export default {
},
copyReferralLink: 'Copy invite link',
},
systemChatFooterMessage: {
[CONST.INTRO_CHOICES.MANAGE_TEAM]: {
phrase1: 'Chat with your setup specialist in ',
phrase2: ' for help',
},
default: {
phrase1: 'Message ',
phrase2: ' for help with setup',
},
},
violations: {
allTagLevelsRequired: 'All tags required',
autoReportedRejectedExpense: ({rejectReason, rejectedBy}: ViolationsAutoReportedRejectedExpenseParams) => `${rejectedBy} rejected this expense with the comment "${rejectReason}"`,
Expand Down
10 changes: 10 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3263,6 +3263,16 @@ export default {
},
copyReferralLink: 'Copiar enlace de invitación',
},
systemChatFooterMessage: {
[CONST.INTRO_CHOICES.MANAGE_TEAM]: {
phrase1: 'Chatea con tu especialista asignado en ',
phrase2: ' para obtener ayuda',
},
default: {
phrase1: 'Envía un email a ',
phrase2: ' para obtener ayuda con la configuración',
},
},
violations: {
allTagLevelsRequired: 'Todas las etiquetas son obligatorias',
autoReportedRejectedExpense: ({rejectedBy, rejectReason}: ViolationsAutoReportedRejectedExpenseParams) => `${rejectedBy} rechazó la solicitud y comentó "${rejectReason}"`,
Expand Down
20 changes: 18 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,10 +1172,25 @@ function isJoinRequestInAdminRoom(report: OnyxEntry<Report>): boolean {
return ReportActionsUtils.isActionableJoinRequestPending(report.reportID);
}

/**
* Checks if the user can write in the provided report
*/
function canWriteInReport(report: OnyxEntry<Report>): boolean {
if (Array.isArray(report?.permissions) && report?.permissions.length > 0) {
return report?.permissions?.includes(CONST.REPORT.PERMISSIONS.WRITE);
}

return true;
}

/**
* Checks if the current user is allowed to comment on the given report.
*/
function isAllowedToComment(report: OnyxEntry<Report>): boolean {
if (!canWriteInReport(report)) {
return false;
}

// Default to allowing all users to post
const capability = report?.writeCapability ?? CONST.REPORT.WRITE_CAPABILITIES.ALL;

Expand Down Expand Up @@ -5374,7 +5389,7 @@ function canUserPerformWriteAction(report: OnyxEntry<Report>) {
return false;
}

return !isArchivedRoom(report) && isEmptyObject(reportErrors) && report && isAllowedToComment(report) && !isAnonymousUser;
return !isArchivedRoom(report) && isEmptyObject(reportErrors) && report && isAllowedToComment(report) && !isAnonymousUser && canWriteInReport(report);
}

/**
Expand Down Expand Up @@ -6281,7 +6296,6 @@ export {
getParsedComment,
getParticipantAccountIDs,
getParticipants,
getPayeeName,
getPendingChatMembers,
getPersonalDetailsForAccountID,
getPolicyDescriptionText,
Expand Down Expand Up @@ -6316,6 +6330,7 @@ export {
getWorkspaceChats,
getWorkspaceIcon,
goBackToDetailsPage,
getPayeeName,
hasActionsWithErrors,
hasAutomatedExpensifyAccountIDs,
hasExpensifyGuidesEmails,
Expand Down Expand Up @@ -6403,6 +6418,7 @@ export {
isValidReport,
isValidReportIDFromPath,
isWaitingForAssigneeToCompleteTask,
canWriteInReport,
navigateToDetailsPage,
navigateToPrivateNotes,
parseReportRouteParams,
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,7 @@ function createWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policyName
errors: {},
},
},
chatReportIDAdmins: makeMeAdmin ? Number(adminsChatReportID) : undefined,
},
},
{
Expand Down
4 changes: 4 additions & 0 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ function canModifyTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID
return true;
}

if (!ReportUtils.canWriteInReport(ReportUtils.getReport(taskReport?.reportID))) {
return false;
}

return !isEmptyObject(taskReport) && ReportUtils.isAllowedToComment(taskReport);
}

Expand Down
Loading

0 comments on commit f48d931

Please sign in to comment.