Skip to content

Commit

Permalink
Merge branch 'main' into fix/34755-concierge-navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Feb 15, 2024
2 parents b965cdd + 6914b13 commit 50a8bb1
Show file tree
Hide file tree
Showing 636 changed files with 16,793 additions and 12,409 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deployExpensifyHelp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
directory: ./docs/_site

- name: Setup Cloudflare CLI
run: pip3 install cloudflare
run: pip3 install cloudflare==2.17.0

- name: Purge Cloudflare cache
run: /home/runner/.local/bin/cli4 --delete hosts=["help.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["help.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
env:
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}

Expand All @@ -66,7 +66,7 @@ jobs:
with:
token: ${{ secrets.OS_BOTIFY_TOKEN }}
body: ${{ format('A preview of your ExpensifyHelp changes have been deployed to {0} ⚡️', steps.deploy.outputs.alias) }}

- name: Reindex google search
if: ${{ github.event_name == 'push' }}
run : |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:
uses: ./.github/actions/composite/setupNode

- name: Setup Cloudflare CLI
run: pip3 install cloudflare
run: pip3 install cloudflare==2.17.0

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down Expand Up @@ -338,13 +338,13 @@ jobs:

- name: Purge production Cloudflare cache
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: /home/runner/.local/bin/cli4 --delete hosts=["new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
env:
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}

- name: Purge staging Cloudflare cache
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: /home/runner/.local/bin/cli4 --delete hosts=["staging.new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["staging.new.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache
env:
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = ({config}) => {
config.resolve.alias = {
'react-native-config': 'react-web-config',
'react-native$': 'react-native-web',
'@react-native-community/netinfo': path.resolve(__dirname, '../__mocks__/@react-native-community/netinfo.js'),
'@react-native-community/netinfo': path.resolve(__dirname, '../__mocks__/@react-native-community/netinfo.ts'),
'@react-navigation/native': path.resolve(__dirname, '../__mocks__/@react-navigation/native'),

// Module alias support for storybook files, coping from `webpack.common.js`
Expand Down
112 changes: 112 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [Debugging](#debugging)
* [App Structure and Conventions](#app-structure-and-conventions)
* [Philosophy](#Philosophy)
* [Security](#Security)
* [Internationalization](#Internationalization)
* [Deploying](#deploying)

Expand Down Expand Up @@ -395,6 +396,117 @@ This application is built with the following principles.

----

# Security
Updated rules for managing members across all types of chats in New Expensify.

- **Nobody can leave or be removed from something they were automatically added to. For example:**

- DM members can't leave or be removed from their DMs
- Members can't leave or be removed from their own workspace chats
- Admins can't leave or be removed from workspace chats
- Members can't leave or be removed from the #announce room
- Admins can't leave or be removed from #admins
- Domain members can't leave or be removed from their domain chat
- Report submitters can't leave or be removed from their reports
- Report managers can't leave or be removed from their reports
- Group owners cannot be removed from their groups - they need to transfer ownership first
- **Excepting the above, admins can remove anyone. For example:**
- Group admins can remove other group admins, as well as group members
- Workspace admins can remove other workspace admins, as well as workspace members, and invited guests
- **Excepting the above, members can remove guests. For example:**
- Workspace members can remove non-workspace guests.
- **Excepting the above, anybody can remove themselves from any object**

1. ### DM
| | Member
| :---: | :---:
| **Invite** | ❌
| **Remove** | ❌
| **Leave** | ❌
| **Can be removed** | ❌
- DM always has two participants. None of the participant can leave or be removed from the DM. Also no additional member can be invited to the chat.

2. ### Workspace
1. #### Workspace
| | Creator | Member(Employee/User) | Admin | Auditor?
| :---: | :---: | :---: | :---: | :---:
| **Invite** | ✅ | ❌ | ✅ | ❌
| **Remove** | ✅ | ❌ | ✅ | ❌
| **Leave** | ❌ | ✅ | ❌ | ✅
| **Can be removed** | ❌ | ✅ | ✅ | ✅

- Creator can't leave or be removed from their own workspace
- Admins can't leave from the workspace
- Admins can remove other workspace admins, as well as workspace members, and invited guests
- Creator can remove other workspace admins, as well as workspace members, and invited guests
- Members and Auditors cannot invite or remove anyone from the workspace

2. #### Workspace #announce room
| | Member(Employee/User) | Admin | Auditor?
| :---: | :---: | :---: | :---:
| **Invite** | ❌ | ❌ | ❌
| **Remove** | ❌ | ❌ | ❌
| **Leave** | ❌ | ❌ | ❌
| **Can be removed** ||||

- No one can leave or be removed from the #announce room

3. #### Workspace #admin room
| | Admin |
| :---: | :---:
| **Invite** | ❌
| **Remove** | ❌
| **Leave** | ❌
| **Can be removed** | ❌

- Admins can't leave or be removed from #admins

4. #### Workspace rooms
| | Creator | Member | Guest(outside of the workspace)
| :---: | :---: | :---: | :---:
| **Invite** | ✅ | ✅ | ✅
| **Remove** | ✅ | ✅ | ❌
| **Leave** | ✅ | ✅ | ✅
| **Can be removed** | ✅ | ✅ | ✅

- Everyone can be removed/can leave from the room including creator
- Guests are not able to remove anyone from the room

4. #### Workspace chats
| | Admin | Member(default) | Member(invited)
| :---: | :---: | :---: | :---:
| **Invite** | ✅ | ✅ | ❌
| **Remove** | ✅ | ✅ | ❌
| **Leave** | ❌ | ❌ | ✅
| **Can be removed** | ❌ | ❌ | ✅

- Admins are not able to leave/be removed from the workspace chat
- Default members(automatically invited) are not able to leave/be removed from the workspace chat
- Invited members(invited by members) are not able to invite or remove from the workspace chat
- Invited members(invited by members) are able to leave the workspace chat
- Default members and admins are able to remove invited members

3. ### Domain chat
| | Member
| :---: | :---:
| **Remove** | ❌
| **Leave** | ❌
| **Can be removed** | ❌

- Domain members can't leave or be removed from their domain chat

4. ### Reports
| | Submitter | Manager
| :---: | :---: | :---:
| **Remove** | ❌ | ❌
| **Leave** | ❌ | ❌
| **Can be removed** | ❌ | ❌

- Report submitters can't leave or be removed from their reports (eg, if they are the report.accountID)
- Report managers can't leave or be removed from their reports (eg, if they are the report.managerID)

----

# Internationalization
This application is built with Internationalization (I18n) / Localization (L10n) support, so it's important to always
localize the following types of data when presented to the user (even accessibility texts that are not rendered):
Expand Down
1 change: 0 additions & 1 deletion __mocks__/@react-native-async-storage/async-storage.js

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/@react-native-camera-roll/camera-roll.js

This file was deleted.

15 changes: 15 additions & 0 deletions __mocks__/@react-native-camera-roll/camera-roll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {CameraRoll} from '@react-native-camera-roll/camera-roll';

type CameraRollMock = {
CameraRoll: {
save: typeof CameraRoll.save;
};
};

const cameraRollMock: CameraRollMock = {
CameraRoll: {
save: jest.fn(),
},
};

export default cameraRollMock;
3 changes: 3 additions & 0 deletions __mocks__/@react-native-clipboard/clipboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import MockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock';

export default MockClipboard;
19 changes: 0 additions & 19 deletions __mocks__/@react-native-community/netinfo.js

This file was deleted.

31 changes: 31 additions & 0 deletions __mocks__/@react-native-community/netinfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {NetInfoCellularGeneration, NetInfoStateType} from '@react-native-community/netinfo';
import type {addEventListener, configure, fetch, NetInfoState, refresh, useNetInfo} from '@react-native-community/netinfo';

const defaultState: NetInfoState = {
type: NetInfoStateType.cellular,
isConnected: true,
isInternetReachable: true,
details: {
isConnectionExpensive: true,
cellularGeneration: NetInfoCellularGeneration['3g'],
carrier: 'T-Mobile',
},
};

type NetInfoMock = {
configure: typeof configure;
fetch: typeof fetch;
refresh: typeof refresh;
addEventListener: typeof addEventListener;
useNetInfo: typeof useNetInfo;
};

const netInfoMock: NetInfoMock = {
configure: () => {},
fetch: () => Promise.resolve(defaultState),
refresh: () => Promise.resolve(defaultState),
addEventListener: () => () => {},
useNetInfo: () => defaultState,
};

export default netInfoMock;
22 changes: 0 additions & 22 deletions __mocks__/console.js

This file was deleted.

1 change: 0 additions & 1 deletion __mocks__/fileMock.js

This file was deleted.

3 changes: 3 additions & 0 deletions __mocks__/fileMock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const fileMock = 'test-file-stub';

export default fileMock;
3 changes: 0 additions & 3 deletions __mocks__/fs/promises.js

This file was deleted.

8 changes: 8 additions & 0 deletions __mocks__/fs/promises.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {fs} from 'memfs';
import type {FsPromisesApi} from 'memfs/lib/node/types';

type PromisesMock = FsPromisesApi;

const promisesMock: PromisesMock = fs.promises;

export default promisesMock;
1 change: 0 additions & 1 deletion __mocks__/react-native-blob-util.js

This file was deleted.

5 changes: 5 additions & 0 deletions __mocks__/react-native-blob-util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type RNFetchBlob from 'react-native-blob-util';

const ReactNativeBlobUtilMock: Partial<typeof RNFetchBlob> = {};

export default ReactNativeBlobUtilMock;
6 changes: 0 additions & 6 deletions __mocks__/react-native-config.js

This file was deleted.

8 changes: 8 additions & 0 deletions __mocks__/react-native-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import dotenv from 'dotenv';
import path from 'path';

type ReactNativeConfigMock = dotenv.DotenvParseOutput | undefined;

const reactNativeConfigMock: ReactNativeConfigMock = dotenv.config({path: path.resolve('./.env.example')}).parsed;

export default reactNativeConfigMock;
3 changes: 0 additions & 3 deletions __mocks__/react-native-device-info.js

This file was deleted.

6 changes: 6 additions & 0 deletions __mocks__/react-native-device-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type DeviceInfoModule from 'react-native-device-info';
import MockDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';

const DeviceInfo: typeof DeviceInfoModule = MockDeviceInfo;

export default DeviceInfo;
23 changes: 23 additions & 0 deletions __mocks__/react-native-document-picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
getConstants: jest.fn(),
pick: jest.fn(),
releaseSecureAccess: jest.fn(),
pickDirectory: jest.fn(),

types: Object.freeze({
allFiles: 'public.item',
audio: 'public.audio',
csv: 'public.comma-separated-values-text',
doc: 'com.microsoft.word.doc',
docx: 'org.openxmlformats.wordprocessingml.document',
images: 'public.image',
pdf: 'com.adobe.pdf',
plainText: 'public.plain-text',
ppt: 'com.microsoft.powerpoint.ppt',
pptx: 'org.openxmlformats.presentationml.presentation',
video: 'public.movie',
xls: 'com.microsoft.excel.xls',
xlsx: 'org.openxmlformats.spreadsheetml.sheet',
zip: 'public.zip-archive',
}),
};
5 changes: 0 additions & 5 deletions __mocks__/react-native-image-picker.js

This file was deleted.

7 changes: 0 additions & 7 deletions __mocks__/react-native-key-command.js

This file was deleted.

9 changes: 9 additions & 0 deletions __mocks__/react-native-key-command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {addListener as _addListener, constants as _constants} from 'react-native-key-command';

const registerKeyCommands = () => {};
const unregisterKeyCommands = () => {};
const constants: Partial<typeof _constants> = {};
const eventEmitter = () => {};
const addListener: typeof _addListener = () => () => {};

export {addListener, constants, eventEmitter, registerKeyCommands, unregisterKeyCommands};
3 changes: 0 additions & 3 deletions __mocks__/react-native-localize.js

This file was deleted.

3 changes: 3 additions & 0 deletions __mocks__/react-native-localize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import mockRNLocalize from 'react-native-localize/mock';

module.exports = mockRNLocalize;
Loading

0 comments on commit 50a8bb1

Please sign in to comment.