author int64 658 755k | date stringlengths 19 19 | timezone int64 -46,800 43.2k | hash stringlengths 40 40 | message stringlengths 5 490 | mods list | language stringclasses 20 values | license stringclasses 3 values | repo stringlengths 5 68 | original_message stringlengths 12 491 |
|---|---|---|---|---|---|---|---|---|---|
129,181 | 05.01.2023 13:28:50 | -3,600 | e1af827cf64f4f1d1ebc1cbe6c1e7032981414ab | [desktop] Enable flow in the desktop workspace
Summary:
[ENG-2219](https://linear.app/comm/issue/ENG-2219)
Adds flow support in the desktop workspace.
Test Plan:
Run `flow` in `desktop`
Check if `lint-staged` fails when trying to commit file with type errors
Reviewers: tomek, atul, ashoat
Subscribers: ashoat | [
{
"change_type": "MODIFY",
"old_path": ".buildkite/eslint_flow_jest.yml",
"new_path": ".buildkite/eslint_flow_jest.yml",
"diff": "@@ -5,7 +5,7 @@ steps:\n- 'curl --proto \"=https\" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y'\n- '. /root/.cargo/env'\n- 'yarn cleaninstall --frozen-lockfile --skip-optional --network-timeout 180000'\n- - 'yarn eslint --max-warnings=0 && yarn workspace lib flow && yarn workspace web flow && yarn workspace landing flow && yarn workspace native flow && yarn workspace keyserver flow'\n+ - 'yarn eslint --max-warnings=0 && yarn workspace lib flow && yarn workspace web flow && yarn workspace landing flow && yarn workspace native flow && yarn workspace keyserver flow && yarn workspace desktop flow'\n- 'yarn workspace lib test && yarn workspace keyserver test'\nplugins:\n- docker#v3.13.0:\n"
},
{
"change_type": "MODIFY",
"old_path": ".github/workflows/eslint_flow_jest.yml",
"new_path": ".github/workflows/eslint_flow_jest.yml",
"diff": "@@ -41,6 +41,10 @@ jobs:\nworking-directory: ./native\nrun: ./node_modules/.bin/flow\n+ - name: '[desktop] flow'\n+ working-directory: ./desktop\n+ run: ./node_modules/.bin/flow\n+\n- name: '[lib] test'\nworking-directory: ./lib\nrun: yarn test\n"
},
{
"change_type": "MODIFY",
"old_path": ".lintstagedrc.js",
"new_path": ".lintstagedrc.js",
"diff": "@@ -38,6 +38,9 @@ module.exports = {\n'{landing,lib}/**/*.js': function landingFlow(files) {\nreturn 'yarn workspace landing flow --quiet';\n},\n+ '{desktop,lib}/**/*.js': function desktopFlow(files) {\n+ return 'yarn workspace desktop flow --quiet';\n+ },\n'services/identity/**/*.rs': function testIdentity(files) {\nreturn 'bash -c \"cd services/identity && cargo test\"';\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/.eslintrc.json",
"new_path": "desktop/.eslintrc.json",
"diff": "{\n- \"rules\": {\n- \"flowtype/require-valid-file-annotation\": \"off\"\n- },\n\"env\": { \"node\": true }\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "desktop/.flowconfig",
"diff": "+[include]\n+../lib\n+\n+[libs]\n+../lib/flow-typed\n+\n+[options]\n+exact_by_default=true\n+\n+format.bracket_spacing=false\n+\n+[lints]\n+sketchy-null-number=warn\n+sketchy-null-mixed=warn\n+sketchy-number=warn\n+untyped-type-import=warn\n+nonstrict-import=warn\n+deprecated-type=warn\n+unsafe-getters-setters=warn\n+unnecessary-invariant=warn\n+\n+[strict]\n+deprecated-type\n+nonstrict-import\n+sketchy-null\n+unclear-type\n+unsafe-getters-setters\n+untyped-import\n+untyped-type-import\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/babel.config.cjs",
"new_path": "desktop/babel.config.cjs",
"diff": "module.exports = {\npresets: [\n['@babel/preset-env', { targets: { electron: 22 }, modules: 'commonjs' }],\n+ '@babel/preset-flow',\n],\nplugins: [\n'@babel/plugin-proposal-class-properties',\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "desktop/flow-typed/npm/electron_vx.x.x.js",
"diff": "+// @flow\n+// flow-typed signature: f8bfa3876f1890f644b65b1ebd801ed8\n+// flow-typed version: <<STUB>>/electron_v22.0.0/flow_v0.182.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'electron'\n+ *\n+ * Fill this stub out by replacing all the `any` types.\n+ *\n+ * Once filled out, we encourage you to share your work with the\n+ * community by sending a pull request to:\n+ * https://github.com/flowtype/flow-typed\n+ */\n+\n+declare module 'electron' {\n+ declare module.exports: any;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/forge.config.cjs",
"new_path": "desktop/forge.config.cjs",
"diff": "@@ -61,7 +61,13 @@ module.exports = {\npackagerConfig: {\nname: 'Comm',\nicon: 'icons/icon',\n- ignore: ['src', '.*config\\\\.cjs', '\\\\.eslintrc\\\\.json'],\n+ ignore: [\n+ 'src',\n+ '.*config\\\\.cjs',\n+ '\\\\.eslintrc\\\\.json',\n+ '\\\\.flowconfig',\n+ 'flow-typed',\n+ ],\nappBundleId: 'app.comm.macos',\nosxSign: { identity: 'Developer ID Application' },\nosxNotarize: {\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/package.json",
"new_path": "desktop/package.json",
"diff": "\"@electron-forge/maker-squirrel\": \"^6.0.4\",\n\"@electron-forge/plugin-base\": \"^6.0.4\",\n\"electron\": \"^22.0.0\",\n+ \"flow-bin\": \"^0.182.0\",\n+ \"flow-typed\": \"^3.2.1\",\n\"fs-extra\": \"^10.1.0\",\n\"klaw\": \"^4.0.1\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/src/handle-squirrel-event.js",
"new_path": "desktop/src/handle-squirrel-event.js",
"diff": "+// @flow\n+\nimport { spawn } from 'child_process';\nimport { app } from 'electron';\nimport path from 'path';\n@@ -6,7 +8,7 @@ import path from 'path';\n// uninstalling and updating so we can for example create or delete shortcuts.\n// After handling some of these events the app will be closed. If this function\n// returns false, the app should start normally.\n-export function handleSquirrelEvent() {\n+export function handleSquirrelEvent(): boolean {\nif (process.argv.length === 1) {\nreturn false;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/src/main.js",
"new_path": "desktop/src/main.js",
"diff": "+// @flow\n+\nimport {\napp,\nBrowserWindow,\n"
},
{
"change_type": "MODIFY",
"old_path": "desktop/src/preload.js",
"new_path": "desktop/src/preload.js",
"diff": "+// @flow\n+\nimport { contextBridge, ipcRenderer } from 'electron';\nconst bridge = {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/.flowconfig",
"new_path": "native/.flowconfig",
"diff": ".*/comm/web/.*\n.*/comm/keyserver/.*\n+.*/comm/desktop/.*\n.*/android/app/build/.*\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [desktop] Enable flow in the desktop workspace
Summary:
[ENG-2219](https://linear.app/comm/issue/ENG-2219)
Adds flow support in the desktop workspace.
Test Plan:
- Run `flow` in `desktop`
- Check if `lint-staged` fails when trying to commit file with type errors
Reviewers: tomek, atul, ashoat
Reviewed By: ashoat
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D6174 |
129,197 | 06.01.2023 09:15:04 | 21,600 | 3e7b49ecbe4fe44eefdcb5e5c10bd5ef7eace826 | [image-picker] install expo package
Summary: Doing the installation again. Installed package by modifying `package.json` and running `yarn cleaninstall`.
Test Plan: Build succeeds. Run succeeds.
Reviewers: atul, ashoat
Subscribers: tomek, ashoat | [
{
"change_type": "MODIFY",
"old_path": "native/ios/Podfile.lock",
"new_path": "native/ios/Podfile.lock",
"diff": "@@ -98,6 +98,8 @@ PODS:\n- ExpoImageManipulator (11.0.0):\n- EXImageLoader\n- ExpoModulesCore\n+ - ExpoImagePicker (14.0.2):\n+ - ExpoModulesCore\n- ExpoKeepAwake (11.0.1):\n- ExpoModulesCore\n- ExpoModulesCore (1.0.3):\n@@ -565,6 +567,7 @@ DEPENDENCIES:\n- expo-dev-menu-interface (from `../../node_modules/expo-dev-menu-interface/ios`)\n- ExpoHaptics (from `../../node_modules/expo-haptics/ios`)\n- ExpoImageManipulator (from `../../node_modules/expo-image-manipulator/ios`)\n+ - ExpoImagePicker (from `../../node_modules/expo-image-picker/ios`)\n- ExpoKeepAwake (from `../../node_modules/expo-keep-awake/ios`)\n- ExpoModulesCore (from `../../node_modules/expo-modules-core`)\n- EXSecureStore (from `../../node_modules/expo-secure-store/ios`)\n@@ -682,6 +685,8 @@ EXTERNAL SOURCES:\n:path: \"../../node_modules/expo-haptics/ios\"\nExpoImageManipulator:\n:path: \"../../node_modules/expo-image-manipulator/ios\"\n+ ExpoImagePicker:\n+ :path: \"../../node_modules/expo-image-picker/ios\"\nExpoKeepAwake:\n:path: \"../../node_modules/expo-keep-awake/ios\"\nExpoModulesCore:\n@@ -834,6 +839,7 @@ SPEC CHECKSUMS:\nexpo-dev-menu-interface: 45581093393dacd51ce5e7f641cf9ed5064a2e3f\nExpoHaptics: 5a56d30a87ea213dd00b09566dc4b441a4dff97f\nExpoImageManipulator: 5f3c1ab8dd81de11491b5051bb925abc91fe57e4\n+ ExpoImagePicker: d2a1cea4023008ae2fb0d95f33422b80772cc76e\nExpoKeepAwake: 69b59d0a8d2b24de9f82759c39b3821fec030318\nExpoModulesCore: b5d21c8880afda6fb6ee95469f9ac2ec9b98e995\nEXSecureStore: daec0117c922a67c658cb229152a9e252e5c1750\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"expo-font\": \"~11.0.1\",\n\"expo-haptics\": \"~12.0.1\",\n\"expo-image-manipulator\": \"~11.0.0\",\n+ \"expo-image-picker\": \"~14.0.2\",\n\"expo-media-library\": \"~15.0.0\",\n\"expo-secure-store\": \"~12.0.0\",\n\"expo-splash-screen\": \"~0.17.4\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -10858,6 +10858,14 @@ expo-image-manipulator@~11.0.0:\ndependencies:\nexpo-image-loader \"~4.0.0\"\n+expo-image-picker@~14.0.2:\n+ version \"14.0.2\"\n+ resolved \"https://registry.yarnpkg.com/expo-image-picker/-/expo-image-picker-14.0.2.tgz#a611a43142be4c6f763ee39efd80e55f5a414ed7\"\n+ integrity sha512-dC0efykReusbjOtcvXYagABrVuwuOFwTfEx87VNjCZejig5aIPPj14UsViSV7xEQ+wkHvVnxyirox5xIbD196w==\n+ dependencies:\n+ expo-image-loader \"~4.0.0\"\n+ uuid \"7.0.2\"\n+\nexpo-json-utils@~0.4.0:\nversion \"0.4.0\"\nresolved \"https://registry.yarnpkg.com/expo-json-utils/-/expo-json-utils-0.4.0.tgz#47ae83a1cc973101d62371f94790e9ad39491751\"\n@@ -22755,6 +22763,11 @@ uuid@3.2.1:\nresolved \"https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14\"\nintegrity sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==\n+uuid@7.0.2:\n+ version \"7.0.2\"\n+ resolved \"https://registry.yarnpkg.com/uuid/-/uuid-7.0.2.tgz#7ff5c203467e91f5e0d85cfcbaaf7d2ebbca9be6\"\n+ integrity sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw==\n+\nuuid@^2.0.3:\nversion \"2.0.3\"\nresolved \"https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [image-picker] install expo package
Summary: Doing the installation again. Installed package by modifying `package.json` and running `yarn cleaninstall`.
Test Plan: Build succeeds. Run succeeds.
Reviewers: atul, ashoat
Reviewed By: ashoat
Subscribers: tomek, ashoat
Differential Revision: https://phab.comm.dev/D6187 |
129,184 | 11.01.2023 16:07:08 | 18,000 | ee86b784e39807d818821ddcd6d448b2472f7a4f | [web] Introduce `LoginFormWrapper` component
Summary:
Basically wrap `LoginForm` with `RainbowKitProvider` and `WagmiConfig`.
Inspired heavily by (read: copied from) `landing/siwe.react.js`.
Test Plan: Tested implicitly by subsequent diffs.
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.react.js",
"new_path": "web/account/log-in-form.react.js",
"diff": "// @flow\n+import '@rainbow-me/rainbowkit/dist/index.css';\n+\n+import {\n+ darkTheme,\n+ getDefaultWallets,\n+ RainbowKitProvider,\n+} from '@rainbow-me/rainbowkit';\nimport invariant from 'invariant';\n+import _merge from 'lodash/fp/merge';\nimport * as React from 'react';\n+import { chain, configureChains, createClient, WagmiConfig } from 'wagmi';\n+import { alchemyProvider } from 'wagmi/providers/alchemy';\n+import { publicProvider } from 'wagmi/providers/public';\nimport { logInActionTypes, logIn } from 'lib/actions/user-actions';\nimport { useModalContext } from 'lib/components/modal-provider.react';\n@@ -28,6 +39,26 @@ import { webLogInExtraInfoSelector } from '../selectors/account-selectors';\nimport css from './log-in-form.css';\nimport PasswordInput from './password-input.react';\n+// details can be found https://0.6.x.wagmi.sh/docs/providers/configuring-chains\n+const availableProviders = process.env.COMM_ALCHEMY_KEY\n+ ? [alchemyProvider({ apiKey: process.env.COMM_ALCHEMY_KEY })]\n+ : [publicProvider()];\n+const { chains, provider } = configureChains(\n+ [chain.mainnet],\n+ availableProviders,\n+);\n+\n+const { connectors } = getDefaultWallets({\n+ appName: 'comm',\n+ chains,\n+});\n+\n+const wagmiClient = createClient({\n+ autoConnect: true,\n+ connectors,\n+ provider,\n+});\n+\nconst loadingStatusSelector = createLoadingStatusSelector(logInActionTypes);\nfunction LoginForm(): React.Node {\nconst inputDisabled = useSelector(loadingStatusSelector) === 'loading';\n@@ -163,4 +194,25 @@ function LoginForm(): React.Node {\n);\n}\n-export default LoginForm;\n+function LoginFormWrapper(): React.Node {\n+ const theme = React.useMemo(() => {\n+ return _merge(darkTheme())({\n+ radii: {\n+ modal: 0,\n+ modalMobile: 0,\n+ },\n+ colors: {\n+ modalBackdrop: '#242529',\n+ },\n+ });\n+ }, []);\n+ return (\n+ <WagmiConfig client={wagmiClient}>\n+ <RainbowKitProvider chains={chains} theme={theme} modalSize=\"compact\">\n+ <LoginForm />\n+ </RainbowKitProvider>\n+ </WagmiConfig>\n+ );\n+}\n+\n+export default LoginFormWrapper;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Introduce `LoginFormWrapper` component
Summary:
Basically wrap `LoginForm` with `RainbowKitProvider` and `WagmiConfig`.
Inspired heavily by (read: copied from) `landing/siwe.react.js`.
Test Plan: Tested implicitly by subsequent diffs.
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6217 |
129,184 | 11.01.2023 16:47:59 | 18,000 | fa7a753bbe74ff767dff14648d2c271d05e6b145 | [web] Add `siweButton` to `LogInForm` component
Summary:
Doesn't do anything at the moment.
Depends on D6217
Test Plan:
Here's how it looks:
{F325054}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.css",
"new_path": "web/account/log-in-form.css",
"diff": "@@ -40,3 +40,10 @@ div.modal_form_error {\npadding-left: 6px;\nalign-self: center;\n}\n+\n+div.ethereum_logo_container {\n+ display: flex;\n+ justify-content: center;\n+ align-content: center;\n+ margin: 0 4px;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.react.js",
"new_path": "web/account/log-in-form.react.js",
"diff": "@@ -10,6 +10,7 @@ import {\nimport invariant from 'invariant';\nimport _merge from 'lodash/fp/merge';\nimport * as React from 'react';\n+import { FaEthereum } from 'react-icons/fa';\nimport { chain, configureChains, createClient, WagmiConfig } from 'wagmi';\nimport { alchemyProvider } from 'wagmi/providers/alchemy';\nimport { publicProvider } from 'wagmi/providers/public';\n@@ -30,6 +31,7 @@ import {\nuseDispatchActionPromise,\nuseServerCall,\n} from 'lib/utils/action-utils';\n+import { isDev } from 'lib/utils/dev-utils.js';\nimport Button from '../components/button.react';\nimport LoadingIndicator from '../loading-indicator.react';\n@@ -151,6 +153,27 @@ function LoginForm(): React.Node {\nreturn 'Log in';\n}, [inputDisabled]);\n+ const siweButtonColor = React.useMemo(\n+ () => ({ backgroundColor: 'white', color: 'black' }),\n+ [],\n+ );\n+\n+ let siweButton;\n+ if (isDev) {\n+ siweButton = (\n+ <Button\n+ onClick={undefined}\n+ variant=\"filled\"\n+ buttonColor={siweButtonColor}\n+ >\n+ <div className={css.ethereum_logo_container}>\n+ <FaEthereum />\n+ </div>\n+ Sign in with Ethereum\n+ </Button>\n+ );\n+ }\n+\nreturn (\n<div className={css.modal_body}>\n<form method=\"POST\">\n@@ -187,6 +210,7 @@ function LoginForm(): React.Node {\n>\n{loginButtonContent}\n</Button>\n+ {siweButton}\n<div className={css.modal_form_error}>{errorMessage}</div>\n</div>\n</form>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Add `siweButton` to `LogInForm` component
Summary:
Doesn't do anything at the moment.
---
Depends on D6217
Test Plan:
Here's how it looks:
{F325054}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6218 |
129,184 | 11.01.2023 17:59:23 | 18,000 | 6649fafa888adb170e66a989b7f45e1459eb51a0 | [web] Display `ConnectButton` after `ConnectModal` flow completes successfully
Summary:
Display `ConnectButton` with wallet info once `ConnectModal` flow completes successfully and `signer` (via `useSigner()` hook) exists.
Depends on D6220
Test Plan:
Here's what it looks like:
{F325150}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.css",
"new_path": "web/account/log-in-form.css",
"diff": "@@ -65,3 +65,10 @@ hr:after {\ncontent: 'or';\nbackground-color: #1f1f1fff;\n}\n+\n+div.connectButtonContainer {\n+ width: 100%;\n+ display: flex;\n+ justify-content: center;\n+ align-content: center;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.react.js",
"new_path": "web/account/log-in-form.react.js",
"diff": "import '@rainbow-me/rainbowkit/dist/index.css';\nimport {\n+ ConnectButton,\ndarkTheme,\ngetDefaultWallets,\nRainbowKitProvider,\n+ useConnectModal,\n} from '@rainbow-me/rainbowkit';\nimport invariant from 'invariant';\nimport _merge from 'lodash/fp/merge';\nimport * as React from 'react';\nimport { FaEthereum } from 'react-icons/fa';\n-import { chain, configureChains, createClient, WagmiConfig } from 'wagmi';\n+import {\n+ chain,\n+ configureChains,\n+ createClient,\n+ WagmiConfig,\n+ useSigner,\n+} from 'wagmi';\nimport { alchemyProvider } from 'wagmi/providers/alchemy';\nimport { publicProvider } from 'wagmi/providers/public';\n@@ -63,6 +71,8 @@ const wagmiClient = createClient({\nconst loadingStatusSelector = createLoadingStatusSelector(logInActionTypes);\nfunction LoginForm(): React.Node {\n+ const { openConnectModal } = useConnectModal();\n+ const { data: signer } = useSigner();\nconst inputDisabled = useSelector(loadingStatusSelector) === 'loading';\nconst loginExtraInfo = useSelector(webLogInExtraInfoSelector);\nconst callLogIn = useServerCall(logIn);\n@@ -158,13 +168,30 @@ function LoginForm(): React.Node {\n[],\n);\n- let siweButton;\n+ let siweSeparator;\nif (isDev) {\n+ siweSeparator = <hr />;\n+ }\n+\n+ let siweConnectButton;\n+ if (isDev && signer) {\n+ siweConnectButton = (\n+ <div className={css.connectButtonContainer}>\n+ <ConnectButton />\n+ </div>\n+ );\n+ }\n+\n+ const onSIWEButtonClick = React.useCallback(() => {\n+ openConnectModal && openConnectModal();\n+ }, [openConnectModal]);\n+\n+ let siweButton;\n+ if (isDev && openConnectModal) {\nsiweButton = (\n<>\n- <hr />\n<Button\n- onClick={undefined}\n+ onClick={onSIWEButtonClick}\nvariant=\"filled\"\nbuttonColor={siweButtonColor}\n>\n@@ -213,6 +240,8 @@ function LoginForm(): React.Node {\n>\n{loginButtonContent}\n</Button>\n+ {siweSeparator}\n+ {siweConnectButton}\n{siweButton}\n<div className={css.modal_form_error}>{errorMessage}</div>\n</div>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Display `ConnectButton` after `ConnectModal` flow completes successfully
Summary:
Display `ConnectButton` with wallet info once `ConnectModal` flow completes successfully and `signer` (via `useSigner()` hook) exists.
---
Depends on D6220
Test Plan:
Here's what it looks like:
{F325150}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6221 |
129,184 | 11.01.2023 19:06:11 | 18,000 | 51f87ca168df00287d516046a91a8855b4c92fc6 | [native] `codeVersion` -> 173 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 172\n- versionName '1.0.172'\n+ versionCode 173\n+ versionName '1.0.173'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{172};\n+ const int codeVersion{173};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 172;\n+ CURRENT_PROJECT_VERSION = 173;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.172;\n+ MARKETING_VERSION = 1.0.173;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 172;\n+ CURRENT_PROJECT_VERSION = 173;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.172;\n+ MARKETING_VERSION = 1.0.173;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.172</string>\n+ <string>1.0.173</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>172</string>\n+ <string>173</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.172</string>\n+ <string>1.0.173</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>172</string>\n+ <string>173</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 173 |
129,184 | 11.01.2023 19:09:02 | 18,000 | 2b3b850ef56718847e70d98ca35d942a00ac5480 | [native] `codeVersion` -> 174 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 173\n- versionName '1.0.173'\n+ versionCode 174\n+ versionName '1.0.174'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{173};\n+ const int codeVersion{174};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 173;\n+ CURRENT_PROJECT_VERSION = 174;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.173;\n+ MARKETING_VERSION = 1.0.174;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 173;\n+ CURRENT_PROJECT_VERSION = 174;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.173;\n+ MARKETING_VERSION = 1.0.174;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.173</string>\n+ <string>1.0.174</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>173</string>\n+ <string>174</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.173</string>\n+ <string>1.0.174</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>173</string>\n+ <string>174</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 174 |
129,180 | 22.12.2022 14:42:39 | -3,600 | 9c267823c49bbbcb7bc9c77625729976dc6c7ab6 | [web] Keyboard support for typeahead [2/13] - Moved typeahead-utils.js
Summary: Moved utility functions to web/utils.
Test Plan:
Typeahead without keyboard support works.
Final tests performed in last diffs.
Reviewers: inka, kamil, ginsu, tomek
Subscribers: ashoat, atul, tomek, ginsu, kamil, inka | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -51,9 +51,9 @@ import Multimedia from '../media/multimedia.react';\nimport { useSelector } from '../redux/redux-utils';\nimport { nonThreadCalendarQuery } from '../selectors/nav-selectors';\nimport SWMansionIcon from '../SWMansionIcon.react';\n+import { typeaheadRegex } from '../utils/typeahead-utils';\nimport css from './chat-input-bar.css';\nimport TypeaheadTooltip from './typeahead-tooltip.react';\n-import { typeaheadRegex } from './typeahead-utils';\ntype BaseProps = {\n+threadInfo: ThreadInfo,\n+inputState: InputState,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/typeahead-tooltip.react.js",
"new_path": "web/chat/typeahead-tooltip.react.js",
"diff": "@@ -10,12 +10,12 @@ import type { RelativeMemberInfo } from 'lib/types/thread-types';\nimport Button from '../components/button.react';\nimport type { InputState } from '../input/input-state';\n-import { type TypeaheadMatchedStrings } from './chat-input-bar.react';\n-import css from './typeahead-tooltip.css';\nimport {\ngetTypeaheadTooltipActions,\ngetTypeaheadTooltipPosition,\n-} from './typeahead-utils';\n+} from '../utils/typeahead-utils';\n+import type { TypeaheadMatchedStrings } from './chat-input-bar.react';\n+import css from './typeahead-tooltip.css';\nexport type TypeaheadTooltipProps = {\n+inputState: InputState,\n"
},
{
"change_type": "RENAME",
"old_path": "web/chat/typeahead-utils.js",
"new_path": "web/utils/typeahead-utils.js",
"diff": "@@ -6,13 +6,13 @@ import { oldValidUsernameRegexString } from 'lib/shared/account-utils';\nimport { stringForUserExplicit } from 'lib/shared/user-utils';\nimport type { RelativeMemberInfo } from 'lib/types/thread-types';\n+import { typeaheadStyle } from '../chat/chat-constants';\n+import { type InputState } from '../input/input-state';\n+\nconst typeaheadRegex: RegExp = new RegExp(\n`(?<textPrefix>(?:^(?:.|\\n)*\\\\s+)|^)@(?<username>${oldValidUsernameRegexString})?$`,\n);\n-import { type InputState } from '../input/input-state';\n-import { typeaheadStyle } from './chat-constants';\n-\nexport type TypeaheadTooltipAction = {\n+key: string,\n+onClick: (SyntheticEvent<HTMLButtonElement>) => mixed,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Keyboard support for typeahead [2/13] - Moved typeahead-utils.js
Summary: Moved utility functions to web/utils.
Test Plan:
Typeahead without keyboard support works.
Final tests performed in last diffs.
Reviewers: inka, kamil, ginsu, tomek
Reviewed By: ginsu, tomek
Subscribers: ashoat, atul, tomek, ginsu, kamil, inka
Differential Revision: https://phab.comm.dev/D6042 |
129,180 | 22.12.2022 16:04:11 | -3,600 | 84aef4c58dca6baa016b4814da2c52ad3d46175c | [web] Keyboard support for typeahead [9/13] - Refactor getTypeaheadTooltipButtons as a function
Summary: Moved creating buttons in overlay to utility function.
Test Plan:
Typeahead without keyboard support works.
Final tests performed in last diffs.
Reviewers: inka, kamil, ginsu, tomek
Subscribers: ashoat, atul, tomek, ginsu, kamil, inka | [
{
"change_type": "MODIFY",
"old_path": "web/chat/typeahead-tooltip.react.js",
"new_path": "web/chat/typeahead-tooltip.react.js",
"diff": "@@ -5,10 +5,10 @@ import * as React from 'react';\nimport type { RelativeMemberInfo } from 'lib/types/thread-types';\n-import Button from '../components/button.react';\nimport type { InputState } from '../input/input-state';\nimport {\ngetTypeaheadTooltipActions,\n+ getTypeaheadTooltipButtons,\ngetTypeaheadTooltipPosition,\n} from '../utils/typeahead-utils';\nimport type { TypeaheadMatchedStrings } from './chat-input-bar.react';\n@@ -70,13 +70,10 @@ function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node {\n[tooltipPosition],\n);\n- const tooltipButtons = React.useMemo(() => {\n- return actions.map(({ key, onClick, actionButtonContent }) => (\n- <Button key={key} onClick={onClick} className={css.suggestion}>\n- <span>@{actionButtonContent}</span>\n- </Button>\n- ));\n- }, [actions]);\n+ const tooltipButtons = React.useMemo(\n+ () => getTypeaheadTooltipButtons(actions),\n+ [actions],\n+ );\nif (!actions || actions.length === 0) {\nreturn null;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/utils/typeahead-utils.js",
"new_path": "web/utils/typeahead-utils.js",
"diff": "@@ -7,6 +7,8 @@ import { stringForUserExplicit } from 'lib/shared/user-utils';\nimport type { RelativeMemberInfo } from 'lib/types/thread-types';\nimport { typeaheadStyle } from '../chat/chat-constants';\n+import css from '../chat/typeahead-tooltip.css';\n+import Button from '../components/button.react';\nconst webTypeaheadRegex: RegExp = new RegExp(\n`(?<textPrefix>(?:^(?:.|\\n)*\\\\s+)|^)@(?<username>${oldValidUsernameRegexString})?$`,\n@@ -119,6 +121,16 @@ function getTypeaheadTooltipActions(\nactionButtonContent: stringForUserExplicit(suggestedUser),\n}));\n}\n+\n+function getTypeaheadTooltipButtons(\n+ actions: $ReadOnlyArray<TypeaheadTooltipAction>,\n+): $ReadOnlyArray<React.Node> {\n+ return actions.map(({ key, onClick, actionButtonContent }) => (\n+ <Button key={key} onClick={onClick} className={css.suggestion}>\n+ <span>@{actionButtonContent}</span>\n+ </Button>\n+ ));\n+}\nfunction getTypeaheadTooltipPosition(\ntextarea: HTMLTextAreaElement,\nactionsLength: number,\n@@ -153,5 +165,6 @@ export {\nwebTypeaheadRegex,\ngetCaretOffsets,\ngetTypeaheadTooltipActions,\n+ getTypeaheadTooltipButtons,\ngetTypeaheadTooltipPosition,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Keyboard support for typeahead [9/13] - Refactor getTypeaheadTooltipButtons as a function
Summary: Moved creating buttons in overlay to utility function.
Test Plan:
Typeahead without keyboard support works.
Final tests performed in last diffs.
Reviewers: inka, kamil, ginsu, tomek
Reviewed By: inka, tomek
Subscribers: ashoat, atul, tomek, ginsu, kamil, inka
Differential Revision: https://phab.comm.dev/D6049 |
129,180 | 22.12.2022 16:29:32 | -3,600 | fb601172deb063dcd4eba1db9781bceff09c4d9a | [web] Keyboard support for typeahead [12/13] - Scrolling thourgh overlay as user interacts with it
Summary: Overlay scrolls automatically when users moves through users suggested to mention.
Test Plan:
Tested on video below:
{F306054}
Reviewers: inka, kamil, ginsu, tomek
Subscribers: ashoat, atul, tomek, ginsu, kamil, inka | [
{
"change_type": "MODIFY",
"old_path": "web/chat/typeahead-tooltip.react.js",
"new_path": "web/chat/typeahead-tooltip.react.js",
"diff": "@@ -8,6 +8,7 @@ import { leastPositiveResidue } from 'lib/utils/math-utils';\nimport type { InputState } from '../input/input-state';\nimport {\n+ getTypeaheadOverlayScroll,\ngetTypeaheadTooltipActions,\ngetTypeaheadTooltipButtons,\ngetTypeaheadTooltipPosition,\n@@ -36,6 +37,8 @@ function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node {\nsetChosenPositionInOverlay,\n] = React.useState<number>(0);\n+ const overlayRef = React.useRef<?HTMLDivElement>();\n+\nReact.useEffect(() => {\nsetChosenPositionInOverlay(0);\n}, [suggestedUsers]);\n@@ -144,6 +147,17 @@ function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node {\ninputState.setTypeaheadState,\n]);\n+ React.useEffect(() => {\n+ const current = overlayRef.current;\n+ if (current) {\n+ const newScrollTop = getTypeaheadOverlayScroll(\n+ current.scrollTop,\n+ chosenPositionInOverlay,\n+ );\n+ current.scrollTo(0, newScrollTop);\n+ }\n+ }, [chosenPositionInOverlay]);\n+\nif (suggestedUsers.length === 0) {\nreturn null;\n}\n@@ -154,7 +168,11 @@ function TypeaheadTooltip(props: TypeaheadTooltipProps): React.Node {\n});\nreturn (\n- <div className={overlayClasses} style={tooltipPositionStyle}>\n+ <div\n+ ref={overlayRef}\n+ className={overlayClasses}\n+ style={tooltipPositionStyle}\n+ >\n{tooltipButtons}\n</div>\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "web/utils/typeahead-utils.js",
"new_path": "web/utils/typeahead-utils.js",
"diff": "@@ -154,6 +154,30 @@ function getTypeaheadTooltipButtons(\n});\n}\n+function getTypeaheadOverlayScroll(\n+ currentScrollTop: number,\n+ chosenActionPosition: number,\n+): number {\n+ const upperButtonBoundary = chosenActionPosition * typeaheadStyle.rowHeight;\n+ const lowerButtonBoundary =\n+ (chosenActionPosition + 1) * typeaheadStyle.rowHeight;\n+\n+ if (upperButtonBoundary < currentScrollTop) {\n+ return upperButtonBoundary;\n+ } else if (\n+ lowerButtonBoundary - typeaheadStyle.tooltipMaxHeight >\n+ currentScrollTop\n+ ) {\n+ return (\n+ lowerButtonBoundary +\n+ typeaheadStyle.tooltipVerticalPadding -\n+ typeaheadStyle.tooltipMaxHeight\n+ );\n+ }\n+\n+ return currentScrollTop;\n+}\n+\nfunction getTypeaheadTooltipPosition(\ntextarea: HTMLTextAreaElement,\nactionsLength: number,\n@@ -189,5 +213,6 @@ export {\ngetCaretOffsets,\ngetTypeaheadTooltipActions,\ngetTypeaheadTooltipButtons,\n+ getTypeaheadOverlayScroll,\ngetTypeaheadTooltipPosition,\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/utils/typeahead-utils.test.js",
"diff": "+// @flow\n+\n+import { typeaheadStyle } from '../chat/chat-constants';\n+import { getTypeaheadOverlayScroll } from './typeahead-utils';\n+\n+describe('getTypeaheadOverlayScroll', () => {\n+ it(\n+ 'should return the same scroll position when' +\n+ 'it is already scrolled to the top and changing between 2nd button',\n+ () => expect(getTypeaheadOverlayScroll(0, 1)).toEqual(0),\n+ );\n+\n+ it(\n+ 'should scroll down when it is scrolled to the top' +\n+ 'and changing to button out of screen',\n+ () =>\n+ expect(getTypeaheadOverlayScroll(0, 6)).toEqual(\n+ (6 + 1) * typeaheadStyle.rowHeight +\n+ typeaheadStyle.tooltipVerticalPadding -\n+ typeaheadStyle.tooltipMaxHeight,\n+ ),\n+ );\n+\n+ it(\n+ 'should scroll up when it is scrolled somewhere down' +\n+ 'and changing to button out of screen to the top',\n+ () =>\n+ expect(getTypeaheadOverlayScroll(500, 3)).toEqual(\n+ 3 * typeaheadStyle.rowHeight,\n+ ),\n+ );\n+});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Keyboard support for typeahead [12/13] - Scrolling thourgh overlay as user interacts with it
Summary: Overlay scrolls automatically when users moves through users suggested to mention.
Test Plan:
Tested on video below:
{F306054}
Reviewers: inka, kamil, ginsu, tomek
Reviewed By: tomek
Subscribers: ashoat, atul, tomek, ginsu, kamil, inka
Differential Revision: https://phab.comm.dev/D6052 |
129,180 | 05.01.2023 14:52:13 | -3,600 | 520eeeaba4cbb1854bd578d635dbe9ddd331f49b | [web] Empty password caused "Unknown error" during login
Summary: Solving this: https://linear.app/comm/issue/ENG-2655/[web]-unknown-error-when-password-is-empty-during-login
Test Plan:
Tested correct and incorrect passwords.
{F319250}
Reviewers: tomek, inka, ashoat
Subscribers: ashoat, atul, inka, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.react.js",
"new_path": "web/account/log-in-form.react.js",
"diff": "@@ -171,6 +171,10 @@ function LoginForm(): React.Node {\nsetErrorMessage('alphanumeric usernames only');\nusernameInputRef.current?.focus();\nreturn;\n+ } else if (password === '') {\n+ setErrorMessage('password is empty');\n+ usernameInputRef.current?.focus();\n+ return;\n}\nconst extraInfo = loginExtraInfo();\n@@ -181,7 +185,7 @@ function LoginForm(): React.Node {\n({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload),\n);\n},\n- [dispatchActionPromise, logInAction, loginExtraInfo, username],\n+ [dispatchActionPromise, logInAction, loginExtraInfo, username, password],\n);\nconst loginButtonContent = React.useMemo(() => {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Empty password caused "Unknown error" during login
Summary: Solving this: https://linear.app/comm/issue/ENG-2655/[web]-unknown-error-when-password-is-empty-during-login
Test Plan:
Tested correct and incorrect passwords.
{F319250}
Reviewers: tomek, inka, ashoat
Reviewed By: tomek, ashoat
Subscribers: ashoat, atul, inka, tomek
Differential Revision: https://phab.comm.dev/D6182 |
129,205 | 05.01.2023 13:48:27 | -3,600 | 04a0815b1ec777a0d25e373fe951c9727132c7f8 | [services][backup] Add BackupItem database methods
Summary:
Implemented methods for managing `BackupItem`s and the `backup-service-backup` table.
Depends on D6179
Test Plan: Called these locally and ensured that entities are properly inserted/read/removed from database.
Reviewers: varun, tomek, jon, max
Subscribers: ashoat, atul | [
{
"change_type": "MODIFY",
"old_path": "services/backup/src/database.rs",
"new_path": "services/backup/src/database.rs",
"diff": "-use aws_sdk_dynamodb::{model::AttributeValue, Error as DynamoDBError};\n+use aws_sdk_dynamodb::{\n+ model::AttributeValue, output::GetItemOutput, Error as DynamoDBError,\n+};\nuse chrono::{DateTime, Utc};\nuse std::{\n+ collections::HashMap,\nfmt::{Display, Formatter},\nsync::Arc,\n};\n+use tracing::error;\n+\n+use crate::constants::{\n+ BACKUP_TABLE_FIELD_ATTACHMENT_HOLDERS, BACKUP_TABLE_FIELD_BACKUP_ID,\n+ BACKUP_TABLE_FIELD_COMPACTION_HOLDER, BACKUP_TABLE_FIELD_CREATED,\n+ BACKUP_TABLE_FIELD_RECOVERY_DATA, BACKUP_TABLE_FIELD_USER_ID,\n+ BACKUP_TABLE_INDEX_USERID_CREATED, BACKUP_TABLE_NAME,\n+};\n#[derive(Clone, Debug)]\npub struct BackupItem {\n@@ -42,7 +53,46 @@ impl DatabaseClient {\n&self,\nbackup_item: BackupItem,\n) -> Result<(), Error> {\n- unimplemented!()\n+ let item = HashMap::from([\n+ (\n+ BACKUP_TABLE_FIELD_USER_ID.to_string(),\n+ AttributeValue::S(backup_item.user_id),\n+ ),\n+ (\n+ BACKUP_TABLE_FIELD_CREATED.to_string(),\n+ AttributeValue::S(backup_item.created.to_rfc3339()),\n+ ),\n+ (\n+ BACKUP_TABLE_FIELD_BACKUP_ID.to_string(),\n+ AttributeValue::S(backup_item.backup_id),\n+ ),\n+ (\n+ BACKUP_TABLE_FIELD_RECOVERY_DATA.to_string(),\n+ AttributeValue::S(backup_item.recovery_data),\n+ ),\n+ (\n+ BACKUP_TABLE_FIELD_COMPACTION_HOLDER.to_string(),\n+ AttributeValue::S(backup_item.compaction_holder),\n+ ),\n+ (\n+ BACKUP_TABLE_FIELD_ATTACHMENT_HOLDERS.to_string(),\n+ AttributeValue::S(backup_item.attachment_holders),\n+ ),\n+ ]);\n+\n+ self\n+ .client\n+ .put_item()\n+ .table_name(BACKUP_TABLE_NAME)\n+ .set_item(Some(item))\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to put backup item\");\n+ Error::AwsSdk(e.into())\n+ })?;\n+\n+ Ok(())\n}\npub async fn find_backup_item(\n@@ -50,18 +100,88 @@ impl DatabaseClient {\nuser_id: &str,\nbackup_id: &str,\n) -> Result<Option<BackupItem>, Error> {\n- unimplemented!()\n+ let item_key = HashMap::from([\n+ (\n+ BACKUP_TABLE_FIELD_USER_ID.to_string(),\n+ AttributeValue::S(user_id.to_string()),\n+ ),\n+ (\n+ BACKUP_TABLE_FIELD_BACKUP_ID.to_string(),\n+ AttributeValue::S(backup_id.to_string()),\n+ ),\n+ ]);\n+\n+ match self\n+ .client\n+ .get_item()\n+ .table_name(BACKUP_TABLE_NAME)\n+ .set_key(Some(item_key))\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to find backup item\");\n+ Error::AwsSdk(e.into())\n+ })? {\n+ GetItemOutput {\n+ item: Some(item), ..\n+ } => {\n+ let backup_item = parse_backup_item(item)?;\n+ Ok(Some(backup_item))\n+ }\n+ _ => Ok(None),\n+ }\n}\npub async fn find_last_backup_item(\n&self,\nuser_id: &str,\n) -> Result<Option<BackupItem>, Error> {\n- unimplemented!()\n+ let response = self\n+ .client\n+ .query()\n+ .table_name(BACKUP_TABLE_NAME)\n+ .index_name(BACKUP_TABLE_INDEX_USERID_CREATED)\n+ .key_condition_expression(\"#userID = :valueToMatch\")\n+ .expression_attribute_names(\"#userID\", BACKUP_TABLE_FIELD_USER_ID)\n+ .expression_attribute_values(\n+ \":valueToMatch\",\n+ AttributeValue::S(user_id.to_string()),\n+ )\n+ .limit(1)\n+ .scan_index_forward(false)\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to find last backup\");\n+ Error::AwsSdk(e.into())\n+ })?;\n+\n+ match response.items.unwrap_or_default().pop() {\n+ Some(item) => {\n+ let backup_item = parse_backup_item(item)?;\n+ Ok(Some(backup_item))\n+ }\n+ None => Ok(None),\n+ }\n}\npub async fn remove_backup_item(&self, backup_id: &str) -> Result<(), Error> {\n- unimplemented!()\n+ self\n+ .client\n+ .delete_item()\n+ .table_name(BACKUP_TABLE_NAME)\n+ .key(\n+ BACKUP_TABLE_FIELD_BACKUP_ID,\n+ AttributeValue::S(backup_id.to_string()),\n+ )\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to remove backup item\");\n+ Error::AwsSdk(e.into())\n+ })?;\n+\n+ Ok(())\n}\n// log item\n@@ -195,3 +315,40 @@ fn parse_datetime_attribute(\n))\n}\n}\n+\n+fn parse_backup_item(\n+ mut item: HashMap<String, AttributeValue>,\n+) -> Result<BackupItem, DBItemError> {\n+ let user_id = parse_string_attribute(\n+ BACKUP_TABLE_FIELD_USER_ID,\n+ item.remove(BACKUP_TABLE_FIELD_USER_ID),\n+ )?;\n+ let backup_id = parse_string_attribute(\n+ BACKUP_TABLE_FIELD_BACKUP_ID,\n+ item.remove(BACKUP_TABLE_FIELD_BACKUP_ID),\n+ )?;\n+ let created = parse_datetime_attribute(\n+ BACKUP_TABLE_FIELD_CREATED,\n+ item.remove(BACKUP_TABLE_FIELD_CREATED),\n+ )?;\n+ let recovery_data = parse_string_attribute(\n+ BACKUP_TABLE_FIELD_RECOVERY_DATA,\n+ item.remove(BACKUP_TABLE_FIELD_RECOVERY_DATA),\n+ )?;\n+ let compaction_holder = parse_string_attribute(\n+ BACKUP_TABLE_FIELD_COMPACTION_HOLDER,\n+ item.remove(BACKUP_TABLE_FIELD_COMPACTION_HOLDER),\n+ )?;\n+ let attachment_holders = parse_string_attribute(\n+ BACKUP_TABLE_FIELD_ATTACHMENT_HOLDERS,\n+ item.remove(BACKUP_TABLE_FIELD_ATTACHMENT_HOLDERS),\n+ )?;\n+ Ok(BackupItem {\n+ user_id,\n+ backup_id,\n+ created,\n+ recovery_data,\n+ compaction_holder,\n+ attachment_holders,\n+ })\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services][backup] Add BackupItem database methods
Summary:
Implemented methods for managing `BackupItem`s and the `backup-service-backup` table.
Depends on D6179
Test Plan: Called these locally and ensured that entities are properly inserted/read/removed from database.
Reviewers: varun, tomek, jon, max
Reviewed By: varun, tomek
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D6180 |
129,205 | 05.01.2023 13:55:09 | -3,600 | e47f94c6b4069b260fbf73ccb9636e4b24514b70 | [services][backup] Add LogItem database methods
Summary:
Implemented methods for managing `LogItem`s and the `backup-service-log` table.
Depends on D6180
Test Plan: Called these locally and ensured that entities are properly inserted/read/removed from database.
Reviewers: varun, tomek, jon, max
Subscribers: ashoat, atul | [
{
"change_type": "MODIFY",
"old_path": "services/backup/src/database.rs",
"new_path": "services/backup/src/database.rs",
"diff": "@@ -14,6 +14,9 @@ use crate::constants::{\nBACKUP_TABLE_FIELD_COMPACTION_HOLDER, BACKUP_TABLE_FIELD_CREATED,\nBACKUP_TABLE_FIELD_RECOVERY_DATA, BACKUP_TABLE_FIELD_USER_ID,\nBACKUP_TABLE_INDEX_USERID_CREATED, BACKUP_TABLE_NAME,\n+ LOG_TABLE_FIELD_ATTACHMENT_HOLDERS, LOG_TABLE_FIELD_BACKUP_ID,\n+ LOG_TABLE_FIELD_DATA_HASH, LOG_TABLE_FIELD_LOG_ID,\n+ LOG_TABLE_FIELD_PERSISTED_IN_BLOB, LOG_TABLE_FIELD_VALUE, LOG_TABLE_NAME,\n};\n#[derive(Clone, Debug)]\n@@ -186,7 +189,46 @@ impl DatabaseClient {\n// log item\npub async fn put_log_item(&self, log_item: LogItem) -> Result<(), Error> {\n- unimplemented!()\n+ let item = HashMap::from([\n+ (\n+ LOG_TABLE_FIELD_BACKUP_ID.to_string(),\n+ AttributeValue::S(log_item.backup_id),\n+ ),\n+ (\n+ LOG_TABLE_FIELD_LOG_ID.to_string(),\n+ AttributeValue::S(log_item.log_id),\n+ ),\n+ (\n+ LOG_TABLE_FIELD_PERSISTED_IN_BLOB.to_string(),\n+ AttributeValue::Bool(log_item.persisted_in_blob),\n+ ),\n+ (\n+ LOG_TABLE_FIELD_VALUE.to_string(),\n+ AttributeValue::S(log_item.value),\n+ ),\n+ (\n+ LOG_TABLE_FIELD_DATA_HASH.to_string(),\n+ AttributeValue::S(log_item.data_hash),\n+ ),\n+ (\n+ LOG_TABLE_FIELD_ATTACHMENT_HOLDERS.to_string(),\n+ AttributeValue::S(log_item.attachment_holders),\n+ ),\n+ ]);\n+\n+ self\n+ .client\n+ .put_item()\n+ .table_name(LOG_TABLE_NAME)\n+ .set_item(Some(item))\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to put log item\");\n+ Error::AwsSdk(e.into())\n+ })?;\n+\n+ Ok(())\n}\npub async fn find_log_item(\n@@ -194,18 +236,89 @@ impl DatabaseClient {\nbackup_id: &str,\nlog_id: &str,\n) -> Result<Option<LogItem>, Error> {\n- unimplemented!()\n+ let item_key = HashMap::from([\n+ (\n+ LOG_TABLE_FIELD_BACKUP_ID.to_string(),\n+ AttributeValue::S(backup_id.to_string()),\n+ ),\n+ (\n+ LOG_TABLE_FIELD_LOG_ID.to_string(),\n+ AttributeValue::S(log_id.to_string()),\n+ ),\n+ ]);\n+\n+ match self\n+ .client\n+ .get_item()\n+ .table_name(LOG_TABLE_NAME)\n+ .set_key(Some(item_key))\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to find log item\");\n+ Error::AwsSdk(e.into())\n+ })? {\n+ GetItemOutput {\n+ item: Some(item), ..\n+ } => {\n+ let log_item = parse_log_item(item)?;\n+ Ok(Some(log_item))\n+ }\n+ _ => Ok(None),\n+ }\n}\npub async fn find_log_items_for_backup(\n&self,\nbackup_id: &str,\n) -> Result<Vec<LogItem>, Error> {\n- unimplemented!()\n+ let response = self\n+ .client\n+ .query()\n+ .table_name(LOG_TABLE_NAME)\n+ .key_condition_expression(\"#backupID = :valueToMatch\")\n+ .expression_attribute_names(\"#backupID\", LOG_TABLE_FIELD_BACKUP_ID)\n+ .expression_attribute_values(\n+ \":valueToMatch\",\n+ AttributeValue::S(backup_id.to_string()),\n+ )\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to find log items for backup\");\n+ Error::AwsSdk(e.into())\n+ })?;\n+\n+ if response.count == 0 {\n+ return Ok(Vec::new());\n+ }\n+\n+ let mut results: Vec<LogItem> =\n+ Vec::with_capacity(response.count() as usize);\n+ for item in response.items.unwrap_or_default() {\n+ let log_item = parse_log_item(item)?;\n+ results.push(log_item);\n+ }\n+ Ok(results)\n}\npub async fn remove_log_item(&self, log_id: &str) -> Result<(), Error> {\n- unimplemented!()\n+ self\n+ .client\n+ .delete_item()\n+ .table_name(LOG_TABLE_NAME)\n+ .key(\n+ LOG_TABLE_FIELD_LOG_ID,\n+ AttributeValue::S(log_id.to_string()),\n+ )\n+ .send()\n+ .await\n+ .map_err(|e| {\n+ error!(\"DynamoDB client failed to remove log item\");\n+ Error::AwsSdk(e.into())\n+ })?;\n+\n+ Ok(())\n}\n}\n@@ -352,3 +465,40 @@ fn parse_backup_item(\nattachment_holders,\n})\n}\n+\n+fn parse_log_item(\n+ mut item: HashMap<String, AttributeValue>,\n+) -> Result<LogItem, DBItemError> {\n+ let backup_id = parse_string_attribute(\n+ LOG_TABLE_FIELD_BACKUP_ID,\n+ item.remove(LOG_TABLE_FIELD_BACKUP_ID),\n+ )?;\n+ let log_id = parse_string_attribute(\n+ LOG_TABLE_FIELD_LOG_ID,\n+ item.remove(LOG_TABLE_FIELD_LOG_ID),\n+ )?;\n+ let persisted_in_blob = parse_bool_attribute(\n+ LOG_TABLE_FIELD_PERSISTED_IN_BLOB,\n+ item.remove(LOG_TABLE_FIELD_PERSISTED_IN_BLOB),\n+ )?;\n+ let value = parse_string_attribute(\n+ LOG_TABLE_FIELD_VALUE,\n+ item.remove(LOG_TABLE_FIELD_VALUE),\n+ )?;\n+ let data_hash = parse_string_attribute(\n+ LOG_TABLE_FIELD_DATA_HASH,\n+ item.remove(LOG_TABLE_FIELD_DATA_HASH),\n+ )?;\n+ let attachment_holders = parse_string_attribute(\n+ LOG_TABLE_FIELD_ATTACHMENT_HOLDERS,\n+ item.remove(LOG_TABLE_FIELD_ATTACHMENT_HOLDERS),\n+ )?;\n+ Ok(LogItem {\n+ log_id,\n+ backup_id,\n+ persisted_in_blob,\n+ value,\n+ data_hash,\n+ attachment_holders,\n+ })\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services][backup] Add LogItem database methods
Summary:
Implemented methods for managing `LogItem`s and the `backup-service-log` table.
Depends on D6180
Test Plan: Called these locally and ensured that entities are properly inserted/read/removed from database.
Reviewers: varun, tomek, jon, max
Reviewed By: varun
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D6181 |
129,187 | 13.01.2023 09:52:47 | 25,200 | b294723065af4ad110135310d7967564e06f7c59 | [native] `codeVersion` -> 175 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 174\n- versionName '1.0.174'\n+ versionCode 175\n+ versionName '1.0.175'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{174};\n+ const int codeVersion{175};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 174;\n+ CURRENT_PROJECT_VERSION = 175;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.174;\n+ MARKETING_VERSION = 1.0.175;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 174;\n+ CURRENT_PROJECT_VERSION = 175;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.174;\n+ MARKETING_VERSION = 1.0.175;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.174</string>\n+ <string>1.0.175</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>174</string>\n+ <string>175</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.174</string>\n+ <string>1.0.175</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>174</string>\n+ <string>175</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 175 |
129,187 | 13.01.2023 10:17:08 | 25,200 | ac6379585c8699a3d6ab0c63a561983434579605 | [native] `codeVersion` -> 176 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 175\n- versionName '1.0.175'\n+ versionCode 176\n+ versionName '1.0.176'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{175};\n+ const int codeVersion{176};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 175;\n+ CURRENT_PROJECT_VERSION = 176;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.175;\n+ MARKETING_VERSION = 1.0.176;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 175;\n+ CURRENT_PROJECT_VERSION = 176;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.175;\n+ MARKETING_VERSION = 1.0.176;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.175</string>\n+ <string>1.0.176</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>175</string>\n+ <string>176</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.175</string>\n+ <string>1.0.176</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>175</string>\n+ <string>176</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 176 |
129,182 | 16.01.2023 11:26:09 | -3,600 | ac72e5c0db35bc5a7e429a181c69c92a9dab06aa | [native] Fix typo in native/navigation/community-drawer-content.react.js
Summary: Fixing a typo
Test Plan: run `flow check` in native/
Reviewers: michal
Subscribers: ashoat, tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "native/navigation/community-drawer-content.react.js",
"new_path": "native/navigation/community-drawer-content.react.js",
"diff": "@@ -37,7 +37,7 @@ function CommunityDrawerContent(): React.Node {\nconst navigateToThread = useNavigateToThread();\nconst childThreadInfosMap = useSelector(childThreadInfos);\n- const setOpenCommunnityOrClose = React.useCallback((index: string) => {\n+ const setOpenCommunityOrClose = React.useCallback((index: string) => {\nsetOpenCommunity(open => (open === index ? null : index));\n}, []);\n@@ -53,13 +53,13 @@ function CommunityDrawerContent(): React.Node {\n<CommunityDrawerItemCommunity\nkey={item.key}\nitemData={itemData}\n- toggleExpanded={setOpenCommunnityOrClose}\n+ toggleExpanded={setOpenCommunityOrClose}\nexpanded={itemData.threadInfo.id === openCommunity}\nnavigateToThread={navigateToThread}\n/>\n);\n},\n- [navigateToThread, openCommunity, setOpenCommunnityOrClose],\n+ [navigateToThread, openCommunity, setOpenCommunityOrClose],\n);\nconst labelStylesObj = useStyles(labelUnboundStyles);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix typo in native/navigation/community-drawer-content.react.js
Summary: Fixing a typo
Test Plan: run `flow check` in native/
Reviewers: michal
Reviewed By: michal
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D6200 |
129,187 | 13.01.2023 13:39:10 | 25,200 | 52d0d63f631f2ed2328a3c576165853e47059336 | [native] Create native/facts/alchemy.json file in release GitHub Actions
Summary: Context in [ENG-2589](https://linear.app/comm/issue/ENG-2589/get-alchemy-api-key-into-react-native-app). We need the Alchemy key in the mobile app so we can do ENS lookups.
Test Plan: Test plan described here:
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/android_release.yml",
"new_path": ".github/workflows/android_release.yml",
"diff": "@@ -29,6 +29,12 @@ jobs:\n- name: yarn --frozen-lockfile --network-timeout 180000\nrun: yarn --frozen-lockfile --network-timeout 180000\n+ - name: Save ALCHEMY_API_KEY to file\n+ working-directory: ./native\n+ env:\n+ ALCHEMY_API_KEY: ${{secrets.ALCHEMY_API_KEY}}\n+ run: mkdir -p facts && echo '{\"key\":\"'\"$ALCHEMY_API_KEY\"'\"}' > facts/alchemy.json\n+\n- name: Save ANDROID_KEY_STORE_B64 to file\nenv:\nANDROID_KEY_STORE_B64: ${{secrets.ANDROID_KEY_STORE_B64}}\n"
},
{
"change_type": "MODIFY",
"old_path": ".github/workflows/ios_release.yml",
"new_path": ".github/workflows/ios_release.yml",
"diff": "@@ -44,6 +44,12 @@ jobs:\n- name: yarn --frozen-lockfile --network-timeout 180000\nrun: yarn --frozen-lockfile --network-timeout 180000\n+ - name: Save ALCHEMY_API_KEY to file\n+ working-directory: ./native\n+ env:\n+ ALCHEMY_API_KEY: ${{secrets.ALCHEMY_API_KEY}}\n+ run: mkdir -p facts && echo '{\"key\":\"'\"$ALCHEMY_API_KEY\"'\"}' > facts/alchemy.json\n+\n- name: Save auth_key to file\nworking-directory: ./native/ios\nenv:\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Create native/facts/alchemy.json file in release GitHub Actions
Summary: Context in [ENG-2589](https://linear.app/comm/issue/ENG-2589/get-alchemy-api-key-into-react-native-app). We need the Alchemy key in the mobile app so we can do ENS lookups.
Test Plan: Test plan described here: https://linear.app/comm/issue/ENG-2589#comment-e9f23909
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6260 |
129,187 | 13.01.2023 13:32:46 | 25,200 | 70e41be68bb0033a2747fc1f7fa59f7cf0eb5e0d | [landing][web] Update to
Summary: `keyserver` had a newer version for some reason.
Test Plan: We're only updating from 5.7.0 to 5.7.2. Confirmed in [release notes](https://github.com/ethers-io/ethers.js/releases) that should be no breaking changes
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "landing/package.json",
"new_path": "landing/package.json",
"diff": "\"@rainbow-me/rainbowkit\": \"^0.5.0\",\n\"classnames\": \"^2.2.5\",\n\"core-js\": \"^3.6.5\",\n- \"ethers\": \"^5.7.0\",\n+ \"ethers\": \"^5.7.2\",\n\"invariant\": \"^2.2.4\",\n\"isomorphic-fetch\": \"^3.0.0\",\n\"lib\": \"0.0.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "web/package.json",
"new_path": "web/package.json",
"diff": "\"detect-browser\": \"^4.0.4\",\n\"exif-js\": \"^2.3.0\",\n\"history\": \"^4.6.3\",\n- \"ethers\": \"^5.7.0\",\n+ \"ethers\": \"^5.7.2\",\n\"invariant\": \"^2.2.4\",\n\"is-svg\": \"^4.3.0\",\n\"isomorphic-fetch\": \"^3.0.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "resolved \"https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892\"\nintegrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==\n-\"@ethersproject/networks@5.7.0\", \"@ethersproject/networks@^5.7.0\":\n- version \"5.7.0\"\n- resolved \"https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.0.tgz#df72a392f1a63a57f87210515695a31a245845ad\"\n- integrity sha512-MG6oHSQHd4ebvJrleEQQ4HhVu8Ichr0RDYEfHzsVAVjHNM+w36x9wp9r+hf1JstMXtseXDtkiVoARAG6M959AA==\n- dependencies:\n- \"@ethersproject/logger\" \"^5.7.0\"\n-\n\"@ethersproject/networks@5.7.1\":\nversion \"5.7.1\"\nresolved \"https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6\"\ndependencies:\n\"@ethersproject/logger\" \"^5.7.0\"\n+\"@ethersproject/networks@^5.7.0\":\n+ version \"5.7.0\"\n+ resolved \"https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.0.tgz#df72a392f1a63a57f87210515695a31a245845ad\"\n+ integrity sha512-MG6oHSQHd4ebvJrleEQQ4HhVu8Ichr0RDYEfHzsVAVjHNM+w36x9wp9r+hf1JstMXtseXDtkiVoARAG6M959AA==\n+ dependencies:\n+ \"@ethersproject/logger\" \"^5.7.0\"\n+\n\"@ethersproject/pbkdf2@5.7.0\", \"@ethersproject/pbkdf2@^5.7.0\":\nversion \"5.7.0\"\nresolved \"https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102\"\ndependencies:\n\"@ethersproject/logger\" \"^5.7.0\"\n-\"@ethersproject/providers@5.7.0\":\n- version \"5.7.0\"\n- resolved \"https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.0.tgz#a885cfc7650a64385e7b03ac86fe9c2d4a9c2c63\"\n- integrity sha512-+TTrrINMzZ0aXtlwO/95uhAggKm4USLm1PbeCBR/3XZ7+Oey+3pMyddzZEyRhizHpy1HXV0FRWRMI1O3EGYibA==\n- dependencies:\n- \"@ethersproject/abstract-provider\" \"^5.7.0\"\n- \"@ethersproject/abstract-signer\" \"^5.7.0\"\n- \"@ethersproject/address\" \"^5.7.0\"\n- \"@ethersproject/base64\" \"^5.7.0\"\n- \"@ethersproject/basex\" \"^5.7.0\"\n- \"@ethersproject/bignumber\" \"^5.7.0\"\n- \"@ethersproject/bytes\" \"^5.7.0\"\n- \"@ethersproject/constants\" \"^5.7.0\"\n- \"@ethersproject/hash\" \"^5.7.0\"\n- \"@ethersproject/logger\" \"^5.7.0\"\n- \"@ethersproject/networks\" \"^5.7.0\"\n- \"@ethersproject/properties\" \"^5.7.0\"\n- \"@ethersproject/random\" \"^5.7.0\"\n- \"@ethersproject/rlp\" \"^5.7.0\"\n- \"@ethersproject/sha2\" \"^5.7.0\"\n- \"@ethersproject/strings\" \"^5.7.0\"\n- \"@ethersproject/transactions\" \"^5.7.0\"\n- \"@ethersproject/web\" \"^5.7.0\"\n- bech32 \"1.1.4\"\n- ws \"7.4.6\"\n-\n\"@ethersproject/providers@5.7.2\":\nversion \"5.7.2\"\nresolved \"https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb\"\n\"@ethersproject/transactions\" \"^5.7.0\"\n\"@ethersproject/wordlists\" \"^5.7.0\"\n-\"@ethersproject/web@5.7.0\", \"@ethersproject/web@^5.7.0\":\n- version \"5.7.0\"\n- resolved \"https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.0.tgz#40850c05260edad8b54827923bbad23d96aac0bc\"\n- integrity sha512-ApHcbbj+muRASVDSCl/tgxaH2LBkRMEYfLOLVa0COipx0+nlu0QKet7U2lEg0vdkh8XRSLf2nd1f1Uk9SrVSGA==\n+\"@ethersproject/web@5.7.1\":\n+ version \"5.7.1\"\n+ resolved \"https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae\"\n+ integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==\ndependencies:\n\"@ethersproject/base64\" \"^5.7.0\"\n\"@ethersproject/bytes\" \"^5.7.0\"\n\"@ethersproject/properties\" \"^5.7.0\"\n\"@ethersproject/strings\" \"^5.7.0\"\n-\"@ethersproject/web@5.7.1\":\n- version \"5.7.1\"\n- resolved \"https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae\"\n- integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==\n+\"@ethersproject/web@^5.7.0\":\n+ version \"5.7.0\"\n+ resolved \"https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.0.tgz#40850c05260edad8b54827923bbad23d96aac0bc\"\n+ integrity sha512-ApHcbbj+muRASVDSCl/tgxaH2LBkRMEYfLOLVa0COipx0+nlu0QKet7U2lEg0vdkh8XRSLf2nd1f1Uk9SrVSGA==\ndependencies:\n\"@ethersproject/base64\" \"^5.7.0\"\n\"@ethersproject/bytes\" \"^5.7.0\"\n@@ -10519,42 +10493,6 @@ ethereumjs-util@^6.0.0:\nethjs-util \"0.1.6\"\nrlp \"^2.2.3\"\n-ethers@^5.7.0:\n- version \"5.7.0\"\n- resolved \"https://registry.yarnpkg.com/ethers/-/ethers-5.7.0.tgz#0055da174b9e076b242b8282638bc94e04b39835\"\n- integrity sha512-5Xhzp2ZQRi0Em+0OkOcRHxPzCfoBfgtOQA+RUylSkuHbhTEaQklnYi2hsWbRgs3ztJsXVXd9VKBcO1ScWL8YfA==\n- dependencies:\n- \"@ethersproject/abi\" \"5.7.0\"\n- \"@ethersproject/abstract-provider\" \"5.7.0\"\n- \"@ethersproject/abstract-signer\" \"5.7.0\"\n- \"@ethersproject/address\" \"5.7.0\"\n- \"@ethersproject/base64\" \"5.7.0\"\n- \"@ethersproject/basex\" \"5.7.0\"\n- \"@ethersproject/bignumber\" \"5.7.0\"\n- \"@ethersproject/bytes\" \"5.7.0\"\n- \"@ethersproject/constants\" \"5.7.0\"\n- \"@ethersproject/contracts\" \"5.7.0\"\n- \"@ethersproject/hash\" \"5.7.0\"\n- \"@ethersproject/hdnode\" \"5.7.0\"\n- \"@ethersproject/json-wallets\" \"5.7.0\"\n- \"@ethersproject/keccak256\" \"5.7.0\"\n- \"@ethersproject/logger\" \"5.7.0\"\n- \"@ethersproject/networks\" \"5.7.0\"\n- \"@ethersproject/pbkdf2\" \"5.7.0\"\n- \"@ethersproject/properties\" \"5.7.0\"\n- \"@ethersproject/providers\" \"5.7.0\"\n- \"@ethersproject/random\" \"5.7.0\"\n- \"@ethersproject/rlp\" \"5.7.0\"\n- \"@ethersproject/sha2\" \"5.7.0\"\n- \"@ethersproject/signing-key\" \"5.7.0\"\n- \"@ethersproject/solidity\" \"5.7.0\"\n- \"@ethersproject/strings\" \"5.7.0\"\n- \"@ethersproject/transactions\" \"5.7.0\"\n- \"@ethersproject/units\" \"5.7.0\"\n- \"@ethersproject/wallet\" \"5.7.0\"\n- \"@ethersproject/web\" \"5.7.0\"\n- \"@ethersproject/wordlists\" \"5.7.0\"\n-\nethers@^5.7.2:\nversion \"5.7.2\"\nresolved \"https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing][web] Update to ethers@5.7.2
Summary: `keyserver` had a newer version for some reason.
Test Plan: We're only updating from 5.7.0 to 5.7.2. Confirmed in [release notes](https://github.com/ethers-io/ethers.js/releases) that should be no breaking changes
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6263 |
129,184 | 17.01.2023 10:21:16 | 18,000 | 33c47ab36ebe7ed915954e3c84f6bf2791e55bf2 | Temporary changes for release | [
{
"change_type": "MODIFY",
"old_path": "native/account/logged-out-modal.react.js",
"new_path": "native/account/logged-out-modal.react.js",
"diff": "@@ -465,9 +465,8 @@ class LoggedOutModal extends React.PureComponent<Props, State> {\nlet panel = null;\nlet buttons = null;\n- let siweButton = null;\n- if (__DEV__) {\n- siweButton = (\n+\n+ const siweButton = (\n<>\n<TouchableOpacity\nonPress={this.onPressSIWE}\n@@ -488,7 +487,6 @@ class LoggedOutModal extends React.PureComponent<Props, State> {\n</View>\n</>\n);\n- }\nif (this.state.mode === 'log-in') {\npanel = (\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Temporary changes for release |
129,184 | 17.01.2023 10:24:08 | 18,000 | 61d86b31d1d0d52d441da3479632181eaf1a152c | [native] `codeVersion` -> 177 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 176\n- versionName '1.0.176'\n+ versionCode 177\n+ versionName '1.0.177'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{176};\n+ const int codeVersion{177};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 176;\n+ CURRENT_PROJECT_VERSION = 177;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.176;\n+ MARKETING_VERSION = 1.0.177;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 176;\n+ CURRENT_PROJECT_VERSION = 177;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.176;\n+ MARKETING_VERSION = 1.0.177;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.176</string>\n+ <string>1.0.177</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>176</string>\n+ <string>177</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.176</string>\n+ <string>1.0.177</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>176</string>\n+ <string>177</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 177 |
129,184 | 19.01.2023 02:02:49 | 18,000 | fdb5cad7fd47dc87091520e062c4ae18bcaf3c55 | [web] Rename `siweConnectButton` to `siweLoginForm`
Summary: Simple rename. In addition to the `ConnectButton`, we'll also be including some copy and a "Sign in" button.
Test Plan: NA
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.react.js",
"new_path": "web/account/siwe.react.js",
"diff": "@@ -90,9 +90,9 @@ function SIWE(): React.Node {\n[],\n);\n- let siweConnectButton;\n+ let siweLoginForm;\nif (signer && !siweNonce) {\n- siweConnectButton = (\n+ siweLoginForm = (\n<div className={css.connectButtonContainer}>\n<LoadingIndicator\nstatus={getSIWENonceCallLoadingStatus}\n@@ -101,7 +101,7 @@ function SIWE(): React.Node {\n</div>\n);\n} else if (signer) {\n- siweConnectButton = (\n+ siweLoginForm = (\n<div className={css.connectButtonContainer}>\n<ConnectButton />\n</div>\n@@ -132,7 +132,7 @@ function SIWE(): React.Node {\nreturn (\n<div className={css.siweContainer}>\n<hr />\n- {siweConnectButton}\n+ {siweLoginForm}\n{siweButton}\n</div>\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Rename `siweConnectButton` to `siweLoginForm`
Summary: Simple rename. In addition to the `ConnectButton`, we'll also be including some copy and a "Sign in" button.
Test Plan: NA
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6303 |
129,205 | 09.01.2023 15:39:52 | -3,600 | 93b265f7635e2fc8e66f750fc2644f9d07f7e7a2 | [services][backup] AddAttachments 1/4 - create handler module
Summary:
Created module for AddAttachments endpoint and added its invocation in the grpc handler.
Depends on D6203
Test Plan: Service builds and starts. This code has no logic yet.
Reviewers: varun, tomek, jon, max
Subscribers: ashoat, atul | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "services/backup/src/service/handlers/add_attachments.rs",
"diff": "+use tonic::Status;\n+\n+use super::proto;\n+use crate::database::DatabaseClient;\n+\n+pub async fn handle_add_attachments(\n+ db: &DatabaseClient,\n+ request: proto::AddAttachmentsRequest,\n+) -> Result<(), Status> {\n+ unimplemented!()\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/backup/src/service/mod.rs",
"new_path": "services/backup/src/service/mod.rs",
"diff": "@@ -18,6 +18,7 @@ pub use proto::backup_service_server::BackupServiceServer;\n/// submodule containing gRPC endpoint handler implementations\nmod handlers {\n+ pub(super) mod add_attachments;\npub(super) mod create_backup;\n// re-exports for convenient usage in handlers\n@@ -139,12 +140,28 @@ impl BackupService for MyBackupService {\nErr(Status::unimplemented(\"unimplemented\"))\n}\n- #[instrument(skip(self))]\n+ #[instrument(skip_all,\n+ fields(\n+ backup_id = &request.get_ref().backup_id,\n+ log_id = &request.get_ref().log_id)\n+ )]\nasync fn add_attachments(\n&self,\n- _request: Request<proto::AddAttachmentsRequest>,\n+ request: Request<proto::AddAttachmentsRequest>,\n) -> Result<Response<()>, Status> {\n- Err(Status::unimplemented(\"unimplemented\"))\n+ info!(\n+ \"AddAttachment request. New holders: {}\",\n+ &request.get_ref().holders\n+ );\n+\n+ handlers::add_attachments::handle_add_attachments(\n+ &self.db,\n+ request.into_inner(),\n+ )\n+ .await?;\n+\n+ info!(\"Request processed successfully\");\n+ Ok(Response::new(()))\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services][backup] AddAttachments 1/4 - create handler module
Summary:
Created module for AddAttachments endpoint and added its invocation in the grpc handler.
Depends on D6203
Test Plan: Service builds and starts. This code has no logic yet.
Reviewers: varun, tomek, jon, max
Reviewed By: tomek
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D6204 |
129,205 | 10.01.2023 16:30:02 | -3,600 | 4d3018f173365924d3b4b1fbae7efb70913542ea | [services][backup] SendLog 1/4 - create handler module
Summary:
Created module for SendLog endpoint and added its its invocation in the grpc handler.
Depends on D6207
Test Plan: Service builds and starts. This code has no logic yet.
Reviewers: varun, tomek, jon, max, michal
Subscribers: ashoat, atul | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "services/backup/src/service/handlers/send_log.rs",
"diff": "+use tonic::Status;\n+use uuid::Uuid;\n+\n+use crate::{\n+ blob::PutClient, constants::ID_SEPARATOR, database::DatabaseClient,\n+ service::proto::SendLogResponse,\n+};\n+\n+enum LogPersistence {\n+ /// Log entirely stored in DynamoDB database\n+ DB,\n+ /// Log contents stored with Blob service\n+ BLOB { holder: String },\n+}\n+\n+pub struct SendLogHandler {\n+ // flow control\n+ pub should_close_stream: bool,\n+\n+ // inputs\n+ user_id: Option<String>,\n+ backup_id: Option<String>,\n+ log_hash: Option<String>,\n+\n+ // internal state\n+ log_id: Option<String>,\n+ log_buffer: Vec<u8>,\n+ persistence_method: LogPersistence,\n+ should_receive_data: bool,\n+\n+ // client instances\n+ db: DatabaseClient,\n+ blob_client: Option<PutClient>,\n+}\n+\n+impl SendLogHandler {\n+ pub fn new(db: &DatabaseClient) -> Self {\n+ SendLogHandler {\n+ db: db.clone(),\n+ blob_client: None,\n+ user_id: None,\n+ backup_id: None,\n+ log_hash: None,\n+ log_id: None,\n+ log_buffer: Vec::new(),\n+ persistence_method: LogPersistence::DB,\n+ should_receive_data: false,\n+ should_close_stream: false,\n+ }\n+ }\n+\n+ pub async fn handle_user_id(\n+ &mut self,\n+ user_id: String,\n+ ) -> Result<(), Status> {\n+ unimplemented!()\n+ }\n+ pub async fn handle_backup_id(\n+ &mut self,\n+ backup_id: String,\n+ ) -> Result<(), Status> {\n+ unimplemented!()\n+ }\n+ pub async fn handle_log_hash(\n+ &mut self,\n+ log_hash: Vec<u8>,\n+ ) -> Result<(), Status> {\n+ unimplemented!()\n+ }\n+ pub async fn handle_log_data(\n+ &mut self,\n+ data_chunk: Vec<u8>,\n+ ) -> Result<(), Status> {\n+ unimplemented!()\n+ }\n+\n+ pub async fn finish(self) -> Result<SendLogResponse, Status> {\n+ unimplemented!()\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/backup/src/service/mod.rs",
"new_path": "services/backup/src/service/mod.rs",
"diff": "@@ -20,12 +20,14 @@ pub use proto::backup_service_server::BackupServiceServer;\nmod handlers {\npub(super) mod add_attachments;\npub(super) mod create_backup;\n+ pub(super) mod send_log;\n// re-exports for convenient usage in handlers\npub(self) use super::handle_db_error;\npub(self) use super::proto;\n}\nuse self::handlers::create_backup::CreateBackupHandler;\n+use self::handlers::send_log::SendLogHandler;\npub struct MyBackupService {\ndb: DatabaseClient,\n@@ -106,12 +108,50 @@ impl BackupService for MyBackupService {\n))\n}\n- #[instrument(skip(self))]\n+ #[instrument(skip_all, fields(backup_id, log_hash, log_id))]\nasync fn send_log(\n&self,\n- _request: Request<tonic::Streaming<proto::SendLogRequest>>,\n+ request: Request<tonic::Streaming<proto::SendLogRequest>>,\n) -> Result<Response<proto::SendLogResponse>, Status> {\n- Err(Status::unimplemented(\"unimplemented\"))\n+ use proto::send_log_request::Data::*;\n+\n+ info!(\"SendLog request: {:?}\", request);\n+ let mut handler = SendLogHandler::new(&self.db);\n+\n+ let mut in_stream = request.into_inner();\n+ while let Some(message) = in_stream.next().await {\n+ let result = match message {\n+ Ok(proto::SendLogRequest {\n+ data: Some(UserId(user_id)),\n+ }) => handler.handle_user_id(user_id).await,\n+ Ok(proto::SendLogRequest {\n+ data: Some(BackupId(backup_id)),\n+ }) => handler.handle_backup_id(backup_id).await,\n+ Ok(proto::SendLogRequest {\n+ data: Some(LogHash(log_hash)),\n+ }) => handler.handle_log_hash(log_hash).await,\n+ Ok(proto::SendLogRequest {\n+ data: Some(LogData(chunk)),\n+ }) => handler.handle_log_data(chunk).await,\n+ unexpected => {\n+ error!(\"Received an unexpected request: {:?}\", unexpected);\n+ Err(Status::unknown(\"unknown error\"))\n+ }\n+ };\n+\n+ if let Err(err) = result {\n+ error!(\"An error occurred when processing request: {:?}\", err);\n+ return Err(err);\n+ }\n+ if handler.should_close_stream {\n+ trace!(\"Handler requested to close request stream\");\n+ break;\n+ }\n+ }\n+\n+ let response = handler.finish().await;\n+ debug!(\"Finished. Sending response: {:?}\", response);\n+ response.map(|response_body| Response::new(response_body))\n}\ntype RecoverBackupKeyStream = Pin<\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services][backup] SendLog 1/4 - create handler module
Summary:
Created module for SendLog endpoint and added its its invocation in the grpc handler.
Depends on D6207
Test Plan: Service builds and starts. This code has no logic yet.
Reviewers: varun, tomek, jon, max, michal
Reviewed By: tomek
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D6211 |
129,184 | 19.01.2023 19:41:04 | 18,000 | 586bc22f6431a60198edecbe59be4cf49661422e | [web] Add SIWE copy to `siweLoginForm`
Summary: Same copy we use on landing. Includes some styling tweaks to ensure that things look reasonable.
Test Plan:
Here's what it looks like:
{F334195}
Reviewers: tomek, ashoat | [
{
"change_type": "MODIFY",
"old_path": "landing/siwe.css",
"new_path": "landing/siwe.css",
"diff": "@@ -10,8 +10,6 @@ body {\njustify-content: center;\nalign-items: center;\nalign-content: center;\n- padding-top: 20px;\n- padding-bottom: 50px;\ncolor: white;\nfont-family: sans-serif;\npadding: 20px;\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/siwe.react.js",
"new_path": "landing/siwe.react.js",
"diff": "@@ -28,6 +28,7 @@ import type { SIWEWebViewMessage } from 'lib/types/siwe-types';\nimport {\ngetSIWEStatementForPublicKey,\nsiweStatementWithoutPublicKey,\n+ siweMessageSigningExplanationStatements,\n} from 'lib/utils/siwe-utils.js';\nimport { SIWEContext } from './siwe-context.js';\n@@ -173,14 +174,8 @@ function SIWE(): React.Node {\n<span className={css.walletDisplayText}>Wallet Connected:</span>\n<ConnectButton />\n</div>\n- <p>\n- To complete the login process, you'll now be asked to sign a\n- message using your wallet.\n- </p>\n- <p>\n- This signature will attest that your Ethereum identity is represented\n- by your new Comm identity.\n- </p>\n+ <p>{siweMessageSigningExplanationStatements[0]}</p>\n+ <p>{siweMessageSigningExplanationStatements[1]}</p>\n<div className={css.button} onClick={onClick}>\nSign in\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/siwe-utils.js",
"new_path": "lib/utils/siwe-utils.js",
"diff": "@@ -71,6 +71,15 @@ function getPublicKeyFromSIWEStatement(statement: string): string {\nreturn publicKeyMatchArray[0];\n}\n+// These are shown in the `SIWE` components on both `landing` and `web`.\n+const siweMessageSigningExplanationStatements: $ReadOnlyArray<string> = [\n+ `To complete the login process, you'll now be ` +\n+ `asked to sign a message using your wallet.`,\n+\n+ `This signature will attest that your Ethereum ` +\n+ `identity is represented by your new Comm identity.`,\n+];\n+\nexport {\nsiweStatementWithoutPublicKey,\nisValidSIWENonce,\n@@ -80,4 +89,5 @@ export {\ngetSIWEStatementForPublicKey,\nisValidSIWEStatementWithPublicKey,\ngetPublicKeyFromSIWEStatement,\n+ siweMessageSigningExplanationStatements,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -23,6 +23,14 @@ hr:after {\nbackground-color: #1f1f1fff;\n}\n+div.siweLoginFormContainer p {\n+ color: white;\n+ font-family: sans-serif;\n+ text-align: center;\n+ padding-top: 14px;\n+ font-size: 14px;\n+}\n+\ndiv.connectButtonContainer {\nwidth: 100%;\ndisplay: flex;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.react.js",
"new_path": "web/account/siwe.react.js",
"diff": "@@ -31,6 +31,7 @@ import {\nuseDispatchActionPromise,\nuseServerCall,\n} from 'lib/utils/action-utils';\n+import { siweMessageSigningExplanationStatements } from 'lib/utils/siwe-utils.js';\nimport Button from '../components/button.react';\nimport LoadingIndicator from '../loading-indicator.react';\n@@ -102,9 +103,13 @@ function SIWE(): React.Node {\n);\n} else if (signer) {\nsiweLoginForm = (\n+ <div className={css.siweLoginFormContainer}>\n<div className={css.connectButtonContainer}>\n<ConnectButton />\n</div>\n+ <p>{siweMessageSigningExplanationStatements[0]}</p>\n+ <p>{siweMessageSigningExplanationStatements[1]}</p>\n+ </div>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.css",
"new_path": "web/splash/splash.css",
"diff": "@@ -7,4 +7,7 @@ div.splashContainer {\ndiv.loginContainer {\ndisplay: flex;\n+ justify-content: center;\n+ align-items: center;\n+ width: 400px;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Add SIWE copy to `siweLoginForm`
Summary: Same copy we use on landing. Includes some styling tweaks to ensure that things look reasonable.
Test Plan:
Here's what it looks like:
{F334195}
Reviewers: tomek, ashoat
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6304 |
129,184 | 20.01.2023 00:38:19 | 18,000 | 9da7cea9f7044d7edb238b778e930eb58ee71326 | [web] Add "Sign in" button to `siweLoginContainer`
Summary: Just include "Sign in" button and make sure styling/layout is correct. The button is completely nonfunctional for now.
Test Plan:
Here's what it looks like:
{F334197}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -27,15 +27,21 @@ div.siweLoginFormContainer p {\ncolor: white;\nfont-family: sans-serif;\ntext-align: center;\n- padding-top: 14px;\n+ padding-bottom: 20px;\nfont-size: 14px;\n}\n+div.siweLoginFormContainer {\n+ display: flex;\n+ flex-direction: column;\n+}\n+\ndiv.connectButtonContainer {\nwidth: 100%;\ndisplay: flex;\njustify-content: center;\nalign-content: center;\n+ padding-bottom: 20px;\n}\ndiv.siweContainer {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.react.js",
"new_path": "web/account/siwe.react.js",
"diff": "@@ -109,6 +109,9 @@ function SIWE(): React.Node {\n</div>\n<p>{siweMessageSigningExplanationStatements[0]}</p>\n<p>{siweMessageSigningExplanationStatements[1]}</p>\n+ <Button variant=\"filled\" type=\"submit\" onClick={undefined}>\n+ Sign in\n+ </Button>\n</div>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Add "Sign in" button to `siweLoginContainer`
Summary: Just include "Sign in" button and make sure styling/layout is correct. The button is completely nonfunctional for now.
Test Plan:
Here's what it looks like:
{F334197}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6305 |
129,187 | 20.01.2023 10:01:51 | 18,000 | 9cc88331d4c30d3c825cccd72b07595b1f90eaab | [lib] Add getAddressForName to ENSCache
Summary:
This is the second step to this Linear task: [ENG-2588](https://linear.app/comm/issue/ENG-2588/vanilla-js-object-for-querying-caching-ens-names)
Depends on D6264
Test Plan:
```
ALCHEMY_API_KEY=alchemykeygoeshere yarn test utils/ens-cache.test.js
```
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/ens-cache.js",
"new_path": "lib/utils/ens-cache.js",
"diff": "@@ -6,6 +6,7 @@ const cacheTimeout = 24 * 60 * 60 * 1000; // one day\ntype EthersProvider = {\n+lookupAddress: (address: string) => Promise<?string>,\n+ +resolveName: (name: string) => Promise<?string>,\n...\n};\ntype ENSNameQueryCacheEntry = {\n@@ -15,6 +16,11 @@ type ENSNameQueryCacheEntry = {\n// We normalize ENS names using eth-ens-namehash\n+normalizedENSName: ?string,\n};\n+type ENSAddressQueryCacheEntry = {\n+ +normalizedENSName: string,\n+ +cacheInsertionTime: number,\n+ +normalizedETHAddress: ?string,\n+};\n// We have a need for querying ENS names from both clients as well as from\n// keyserver code. On the client side, we could use wagmi's caching behavior,\n@@ -25,6 +31,8 @@ class ENSCache {\nprovider: EthersProvider;\n// Maps from normalized ETH address to a cache entry for that address\nnameQueryCache: Map<string, ENSNameQueryCacheEntry> = new Map();\n+ // Maps from normalized ETH name to a cache entry for that name\n+ addressQueryCache: Map<string, ENSAddressQueryCacheEntry> = new Map();\nconstructor(provider: EthersProvider) {\nthis.provider = provider;\n@@ -76,6 +84,38 @@ class ENSCache {\nreturn cacheAndReturnResult(normalizedENSName);\n}\n+\n+ async getAddressForName(ensName: string): Promise<?string> {\n+ const normalizedENSName = namehash.normalize(ensName);\n+ if (normalizedENSName !== ensName) {\n+ return undefined;\n+ }\n+\n+ const cacheResult = this.addressQueryCache.get(normalizedENSName);\n+ if (cacheResult) {\n+ const { cacheInsertionTime, normalizedETHAddress } = cacheResult;\n+ if (cacheInsertionTime + cacheTimeout > Date.now()) {\n+ return normalizedETHAddress;\n+ } else {\n+ this.addressQueryCache.delete(normalizedENSName);\n+ }\n+ }\n+\n+ const cacheAndReturnResult = (result: ?string) => {\n+ this.addressQueryCache.set(normalizedENSName, {\n+ normalizedENSName,\n+ cacheInsertionTime: Date.now(),\n+ normalizedETHAddress: result,\n+ });\n+ return result;\n+ };\n+\n+ const ethAddress = await this.provider.resolveName(normalizedENSName);\n+ if (!ethAddress) {\n+ return cacheAndReturnResult(undefined);\n+ }\n+ return cacheAndReturnResult(ethAddress.toLowerCase());\n+ }\n}\nexport { ENSCache };\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/ens-cache.test.js",
"new_path": "lib/utils/ens-cache.test.js",
"diff": "@@ -17,6 +17,13 @@ provider.lookupAddress = (ethAddress: string) => {\nreturn baseLookupAddress(ethAddress);\n};\n+const baseResolveName = provider.resolveName.bind(provider);\n+let timesResolveNameCalled = 0;\n+provider.resolveName = (ensName: string) => {\n+ timesResolveNameCalled++;\n+ return baseResolveName(ensName);\n+};\n+\nif (!process.env.ALCHEMY_API_KEY) {\n// Test only works if we can query blockchain\nconsole.log(\n@@ -47,3 +54,22 @@ describe('getNameForAddress', () => {\nexpect(timesLookupAddressCalled).toBe(timesLookupAddressCalledBefore);\n});\n});\n+\n+describe('getAddressForName', () => {\n+ it(\"should return ashoat.eth's address\", async () => {\n+ if (!process.env.ALCHEMY_API_KEY) {\n+ return;\n+ }\n+ const ashoatAddr = await ensCache.getAddressForName('ashoat.eth');\n+ expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9');\n+ });\n+ it(\"should have ashoat.eth's address cached\", async () => {\n+ if (!process.env.ALCHEMY_API_KEY) {\n+ return;\n+ }\n+ const timesResolveNameCalledBefore = timesResolveNameCalled;\n+ const ashoatAddr = await ensCache.getAddressForName('ashoat.eth');\n+ expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9');\n+ expect(timesResolveNameCalled).toBe(timesResolveNameCalledBefore);\n+ });\n+});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Add getAddressForName to ENSCache
Summary:
This is the second step to this Linear task: [ENG-2588](https://linear.app/comm/issue/ENG-2588/vanilla-js-object-for-querying-caching-ens-names)
Depends on D6264
Test Plan:
```
ALCHEMY_API_KEY=alchemykeygoeshere yarn test utils/ens-cache.test.js
```
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6265 |
129,187 | 21.01.2023 16:59:54 | 18,000 | 412c2a1ab302e9a38997ce38848a599e8b8b74ef | [web] Factor out prettyDateWithoutDay
Summary: I'll use this in the next diff.
Test Plan: Flow
Reviewers: atul, ginsu
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/date-utils.js",
"new_path": "lib/utils/date-utils.js",
"diff": "@@ -69,6 +69,10 @@ function prettyDate(dayString: string): string {\nreturn dateFormat(dateFromString(dayString), 'dddd, mmmm dS, yyyy');\n}\n+function prettyDateWithoutDay(dayString: string): string {\n+ return dateFormat(dateFromString(dayString), 'mmmm dS, yyyy');\n+}\n+\nfunction dateFromString(dayString: string): Date {\nconst matches = dayString.match(/^([0-9]+)-([0-1][0-9])-([0-3][0-9])$/);\ninvariant(matches && matches.length === 4, `invalid dayString ${dayString}`);\n@@ -155,6 +159,7 @@ export {\nfifteenDaysEarlier,\nfifteenDaysLater,\nprettyDate,\n+ prettyDateWithoutDay,\ndateFromString,\nshortAbsoluteDate,\nlongAbsoluteDate,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/history/history-modal.react.js",
"new_path": "web/modals/history/history-modal.react.js",
"diff": "// @flow\nimport classNames from 'classnames';\n-import dateFormat from 'dateformat';\nimport invariant from 'invariant';\nimport _filter from 'lodash/fp/filter';\nimport _flow from 'lodash/fp/flow';\n@@ -31,7 +30,7 @@ import {\nuseServerCall,\nuseDispatchActionPromise,\n} from 'lib/utils/action-utils';\n-import { dateFromString } from 'lib/utils/date-utils';\n+import { prettyDateWithoutDay } from 'lib/utils/date-utils';\nimport LoadingIndicator from '../../loading-indicator.react';\nimport { useSelector } from '../../redux/redux-utils';\n@@ -101,8 +100,7 @@ class HistoryModal extends React.PureComponent<Props, State> {\n</a>\n);\n}\n- const historyDate = dateFromString(this.props.dayString);\n- const prettyDate = dateFormat(historyDate, 'mmmm dS, yyyy');\n+ const prettyDate = prettyDateWithoutDay(this.props.dayString);\nconst loadingStatus =\nthis.state.mode === 'day'\n? this.props.dayLoadingStatus\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Factor out prettyDateWithoutDay
Summary: I'll use this in the next diff.
Test Plan: Flow
Reviewers: atul, ginsu
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6333 |
129,184 | 23.01.2023 15:20:52 | 18,000 | c21d834bd1cf22ecd80948d53d7116ae4bfaaa38 | [web] Proactively fetch `siweNonce` once user has indicated they intend to SIWE
Summary: Context: https://linear.app/comm/issue/ENG-2741/[web]-proactively-fetch-nonce-once-user-has-indicated-they-intend-to
Test Plan: Works as expected:
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.react.js",
"new_path": "web/account/siwe.react.js",
"diff": "@@ -84,10 +84,18 @@ function SIWE(): React.Node {\nconst logInExtraInfo = useSelector(webLogInExtraInfoSelector);\nconst [siweNonce, setSIWENonce] = React.useState<?string>(null);\n+ const [\n+ hasSIWEButtonBeenClicked,\n+ setHasSIWEButtonBeenClicked,\n+ ] = React.useState<boolean>(false);\n+\n+ const siweNonceShouldBeFetched =\n+ !siweNonce &&\n+ getSIWENonceCallLoadingStatus !== 'loading' &&\n+ (signer || hasSIWEButtonBeenClicked);\nReact.useEffect(() => {\n- if (!signer) {\n- setSIWENonce(null);\n+ if (!siweNonceShouldBeFetched) {\nreturn;\n}\ndispatchActionPromise(\n@@ -97,7 +105,7 @@ function SIWE(): React.Node {\nsetSIWENonce(response);\n})(),\n);\n- }, [dispatchActionPromise, getSIWENonceCall, signer]);\n+ }, [dispatchActionPromise, getSIWENonceCall, siweNonceShouldBeFetched]);\nconst siweButtonColor = React.useMemo(\n() => ({ backgroundColor: 'white', color: 'black' }),\n@@ -164,6 +172,7 @@ function SIWE(): React.Node {\n}\nconst onSIWEButtonClick = React.useCallback(() => {\n+ setHasSIWEButtonBeenClicked(true);\nopenConnectModal && openConnectModal();\n}, [openConnectModal]);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Proactively fetch `siweNonce` once user has indicated they intend to SIWE
Summary: Context: https://linear.app/comm/issue/ENG-2741/[web]-proactively-fetch-nonce-once-user-has-indicated-they-intend-to
Test Plan: Works as expected:
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6340 |
129,187 | 21.01.2023 14:55:52 | 18,000 | 9d065d8cdf770e235cd22eaa56250e59e165a9b4 | [native] Fix typo in CommunityDrawerItemCommunity
Test Plan: Flow
Reviewers: inka
Subscribers: tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "native/navigation/community-drawer-content.react.js",
"new_path": "native/navigation/community-drawer-content.react.js",
"diff": "@@ -15,7 +15,7 @@ import { type ThreadInfo, communitySubthreads } from 'lib/types/thread-types';\nimport { useNavigateToThread } from '../chat/message-list-types';\nimport { useStyles } from '../themes/colors';\nimport type { TextStyle } from '../types/styles';\n-import CommunityDrawerItemCommunity from './community-drawer-item-cummunity.react';\n+import CommunityDrawerItemCommunity from './community-drawer-item-community.react';\nconst maxDepth = 2;\nconst safeAreaEdges = Platform.select({\n"
},
{
"change_type": "RENAME",
"old_path": "native/navigation/community-drawer-item-cummunity.react.js",
"new_path": "native/navigation/community-drawer-item-community.react.js",
"diff": ""
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix typo in CommunityDrawerItemCommunity
Test Plan: Flow
Reviewers: inka
Reviewed By: inka
Subscribers: tomek, atul
Differential Revision: https://phab.comm.dev/D6329 |
129,184 | 24.01.2023 12:51:06 | 18,000 | cb1fb3254d8740b3b3f5161092594c65ed0b6386 | [web] Allow account deletion for SIWE accounts
Summary:
Context:
Basically D6099, but for `web` instead of `native`.
Test Plan:
1. Able to successfully delete SIWE account:
{F340077}
{F340265}
{F340075}
2. "Traditional" account deletion continues to work as expected:
Reviewers: ashoat, tomek, marcin | [
{
"change_type": "MODIFY",
"old_path": "web/settings/account-delete-modal.react.js",
"new_path": "web/settings/account-delete-modal.react.js",
"diff": "@@ -10,6 +10,7 @@ import {\nimport { useModalContext } from 'lib/components/modal-provider.react';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n+import { accountHasPassword } from 'lib/shared/account-utils.js';\nimport type { LogOutResult } from 'lib/types/account-types';\nimport type { PreRequestUserState } from 'lib/types/session-types';\nimport type { DispatchActionPromise } from 'lib/utils/action-utils';\n@@ -26,17 +27,18 @@ import SWMansionIcon from '../SWMansionIcon.react.js';\nimport css from './account-delete-modal.css';\ntype Props = {\n+ +isAccountWithPassword: boolean,\n+preRequestUserState: PreRequestUserState,\n+inputDisabled: boolean,\n+dispatchActionPromise: DispatchActionPromise,\n+deleteAccount: (\n- password: string,\n+ password: ?string,\npreRequestUserState: PreRequestUserState,\n) => Promise<LogOutResult>,\n+popModal: () => void,\n};\ntype State = {\n- +currentPassword: string,\n+ +currentPassword: ?string,\n+errorMessage: string,\n};\n@@ -46,14 +48,17 @@ class AccountDeleteModal extends React.PureComponent<Props, State> {\nconstructor(props: Props) {\nsuper(props);\nthis.state = {\n- currentPassword: '',\n+ currentPassword: props.isAccountWithPassword ? '' : null,\nerrorMessage: '',\n};\n}\ncomponentDidMount() {\n- invariant(this.currentPasswordInput, 'newPasswordInput ref unset');\n- this.currentPasswordInput.focus();\n+ invariant(\n+ !this.props.isAccountWithPassword || this.currentPasswordInput,\n+ 'newPasswordInput ref unset',\n+ );\n+ this.currentPasswordInput?.focus();\n}\nrender() {\n@@ -66,15 +71,15 @@ class AccountDeleteModal extends React.PureComponent<Props, State> {\n);\n}\n- return (\n- <Modal name=\"Delete Account\" onClose={this.props.popModal} size=\"large\">\n- <div className={css.modal_body}>\n- <form method=\"POST\">\n- <SWMansionIcon icon=\"warning-circle\" size={22} />\n- <p className={css.deletion_warning}>\n- Your account will be permanently deleted. There is no way to\n- reverse this.\n- </p>\n+ let passwordConfirmation;\n+ if (this.props.isAccountWithPassword) {\n+ invariant(\n+ this.state.currentPassword !== null &&\n+ this.state.currentPassword !== undefined,\n+ 'currentPassword must be set if isAccountWithPassword',\n+ );\n+ passwordConfirmation = (\n+ <>\n<p className={css.confirm_password}>\nPlease enter your account password to confirm your identity.\n</p>\n@@ -87,6 +92,22 @@ class AccountDeleteModal extends React.PureComponent<Props, State> {\ndisabled={inputDisabled}\nref={this.currentPasswordInputRef}\n/>\n+ </>\n+ );\n+ }\n+\n+ return (\n+ <Modal name=\"Delete Account\" onClose={this.props.popModal} size=\"large\">\n+ <div className={css.modal_body}>\n+ <form method=\"POST\">\n+ <SWMansionIcon icon=\"warning-circle\" size={22} />\n+ <p className={css.deletion_warning}>\n+ Your account will be permanently deleted. There is no way to\n+ reverse this.\n+ </p>\n+\n+ {passwordConfirmation}\n+\n<div className={css.form_footer}>\n<Button\nvariant=\"filled\"\n@@ -94,7 +115,9 @@ class AccountDeleteModal extends React.PureComponent<Props, State> {\ntype=\"submit\"\nonClick={this.onDelete}\ndisabled={\n- inputDisabled || this.state.currentPassword.length === 0\n+ inputDisabled ||\n+ (this.props.isAccountWithPassword &&\n+ this.state.currentPassword?.length === 0)\n}\n>\nDelete Account\n@@ -140,15 +163,15 @@ class AccountDeleteModal extends React.PureComponent<Props, State> {\n: 'unknown error';\nthis.setState(\n{\n- currentPassword: '',\n+ currentPassword: this.props.isAccountWithPassword ? '' : null,\nerrorMessage: errorMessage,\n},\n() => {\ninvariant(\n- this.currentPasswordInput,\n+ !this.props.isAccountWithPassword || this.currentPasswordInput,\n'currentPasswordInput ref unset',\n);\n- this.currentPasswordInput.focus();\n+ this.currentPasswordInput?.focus();\n},\n);\nthrow e;\n@@ -162,6 +185,9 @@ const deleteAccountLoadingStatusSelector = createLoadingStatusSelector(\nconst ConnectedAccountDeleteModal: React.ComponentType<{}> = React.memo<{}>(\nfunction ConnectedAccountDeleteModal(): React.Node {\n+ const isAccountWithPassword = useSelector(state =>\n+ accountHasPassword(state.currentUserInfo),\n+ );\nconst preRequestUserState = useSelector(preRequestUserStateSelector);\nconst inputDisabled = useSelector(\nstate => deleteAccountLoadingStatusSelector(state) === 'loading',\n@@ -173,6 +199,7 @@ const ConnectedAccountDeleteModal: React.ComponentType<{}> = React.memo<{}>(\nreturn (\n<AccountDeleteModal\n+ isAccountWithPassword={isAccountWithPassword}\npreRequestUserState={preRequestUserState}\ninputDisabled={inputDisabled}\ndeleteAccount={callDeleteAccount}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Allow account deletion for SIWE accounts
Summary:
Context: https://linear.app/comm/issue/ENG-2586/do-not-require-password-when-deleting-siwe-account-on-web
Basically D6099, but for `web` instead of `native`.
Test Plan:
1. Able to successfully delete SIWE account:
{F340077}
{F340265}
{F340075}
2. "Traditional" account deletion continues to work as expected:
Reviewers: ashoat, tomek, marcin
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6349 |
129,205 | 30.11.2022 12:01:48 | -3,600 | 78858e96cb8d88c05c2668ffcffe9e7f59f64b34 | [services][blob] Add derive_more dependency
Summary:
Add new dependency to make further error handling much easier.
This dependency is used the same way in identity and backup services.
Test Plan: Cargo project builds.
Reviewers: ashoat, varun, jon
Subscribers: tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "services/blob/Cargo.lock",
"new_path": "services/blob/Cargo.lock",
"diff": "@@ -481,6 +481,7 @@ dependencies = [\n\"aws-sdk-s3\",\n\"aws-types\",\n\"chrono\",\n+ \"derive_more\",\n\"prost\",\n\"tokio\",\n\"tokio-stream\",\n@@ -558,6 +559,12 @@ dependencies = [\n\"unicode-width\",\n]\n+[[package]]\n+name = \"convert_case\"\n+version = \"0.4.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e\"\n+\n[[package]]\nname = \"core-foundation\"\nversion = \"0.9.3\"\n@@ -655,6 +662,19 @@ dependencies = [\n\"syn\",\n]\n+[[package]]\n+name = \"derive_more\"\n+version = \"0.99.17\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321\"\n+dependencies = [\n+ \"convert_case\",\n+ \"proc-macro2\",\n+ \"quote\",\n+ \"rustc_version\",\n+ \"syn\",\n+]\n+\n[[package]]\nname = \"digest\"\nversion = \"0.10.6\"\n"
},
{
"change_type": "MODIFY",
"old_path": "services/blob/Cargo.toml",
"new_path": "services/blob/Cargo.toml",
"diff": "@@ -13,6 +13,7 @@ aws-sdk-dynamodb = \"0.21.0\"\naws-sdk-s3 = \"0.21.0\"\naws-types = \"0.51.0\"\nchrono = \"0.4\"\n+derive_more = \"0.99\"\nprost = \"0.11\"\ntokio = { version = \"1.23\", features = [\"rt-multi-thread\"]}\ntokio-stream = \"0.1\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services][blob] Add derive_more dependency
Summary:
Add new dependency to make further error handling much easier.
This dependency is used the same way in identity and backup services.
Test Plan: Cargo project builds.
Reviewers: ashoat, varun, jon
Reviewed By: ashoat
Subscribers: tomek, atul
Differential Revision: https://phab.comm.dev/D5855 |
129,205 | 30.11.2022 12:22:00 | -3,600 | ad69b4faf480b233d47e2427b88fd296b3bbd720 | [services][blob] Define database error types
Summary:
Defined error enums and structures to be used in `DatabaseClient`.
This code is very similar to the identity and backup service approach.
Depends on D5855
Test Plan: Cargo check doesn't complain.
Reviewers: varun, jon, tomek, michal
Subscribers: ashoat, atul | [
{
"change_type": "MODIFY",
"old_path": "services/blob/src/database.rs",
"new_path": "services/blob/src/database.rs",
"diff": "use anyhow::{anyhow, Context, Result};\n-use aws_sdk_dynamodb::{model::AttributeValue, output::GetItemOutput};\n+use aws_sdk_dynamodb::{\n+ model::AttributeValue, output::GetItemOutput, Error as DynamoDBError,\n+};\nuse chrono::{DateTime, Utc};\n-use std::{collections::HashMap, sync::Arc};\n+use std::{\n+ collections::HashMap,\n+ fmt::{Display, Formatter},\n+ sync::Arc,\n+};\nuse crate::{\nconstants::{\n@@ -263,6 +269,53 @@ impl DatabaseClient {\n}\n}\n+#[derive(\n+ Debug, derive_more::Display, derive_more::From, derive_more::Error,\n+)]\n+pub enum Error {\n+ #[display(...)]\n+ AwsSdk(DynamoDBError),\n+ #[display(...)]\n+ Attribute(DBItemError),\n+}\n+\n+#[derive(Debug, derive_more::Error, derive_more::Constructor)]\n+pub struct DBItemError {\n+ attribute_name: &'static str,\n+ attribute_value: Option<AttributeValue>,\n+ attribute_error: DBItemAttributeError,\n+}\n+\n+impl Display for DBItemError {\n+ fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {\n+ match &self.attribute_error {\n+ DBItemAttributeError::Missing => {\n+ write!(f, \"Attribute {} is missing\", self.attribute_name)\n+ }\n+ DBItemAttributeError::IncorrectType => write!(\n+ f,\n+ \"Value for attribute {} has incorrect type: {:?}\",\n+ self.attribute_name, self.attribute_value\n+ ),\n+ error => write!(\n+ f,\n+ \"Error regarding attribute {} with value {:?}: {}\",\n+ self.attribute_name, self.attribute_value, error\n+ ),\n+ }\n+ }\n+}\n+\n+#[derive(Debug, derive_more::Display, derive_more::Error)]\n+pub enum DBItemAttributeError {\n+ #[display(...)]\n+ Missing,\n+ #[display(...)]\n+ IncorrectType,\n+ #[display(...)]\n+ InvalidTimestamp(chrono::ParseError),\n+}\n+\nfn parse_string_attribute(attribute: Option<AttributeValue>) -> Result<String> {\nmatch attribute {\nSome(AttributeValue::S(str_value)) => Ok(str_value),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services][blob] Define database error types
Summary:
Defined error enums and structures to be used in `DatabaseClient`.
This code is very similar to the identity and backup service approach.
Depends on D5855
Test Plan: Cargo check doesn't complain.
Reviewers: varun, jon, tomek, michal
Reviewed By: varun, jon, tomek
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D5856 |
129,184 | 24.01.2023 15:22:39 | 18,000 | 8c7b9c52690849387427e3e5b2947a28308b7d25 | [web] Don't show option to change password for SIWE accounts
Summary: Pretty straightforward, we just hide this setting for accounts that have signed in with Ethereum (based solely on `accountHasPassword` check).
Test Plan:
SIWE Account:
{F342071}
"Traditional" account:
{F342072}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/settings/account-settings.react.js",
"new_path": "web/settings/account-settings.react.js",
"diff": "@@ -5,6 +5,7 @@ import * as React from 'react';\nimport { logOut, logOutActionTypes } from 'lib/actions/user-actions';\nimport { useModalContext } from 'lib/components/modal-provider.react';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\n+import { accountHasPassword } from 'lib/shared/account-utils.js';\nimport {\nuseDispatchActionPromise,\nuseServerCall,\n@@ -47,12 +48,31 @@ function AccountSettings(): React.Node {\n[popModal, pushModal],\n);\n+ const isAccountWithPassword = useSelector(state =>\n+ accountHasPassword(state.currentUserInfo),\n+ );\n+\nconst currentUserInfo = useSelector(state => state.currentUserInfo);\nif (!currentUserInfo || currentUserInfo.anonymous) {\nreturn null;\n}\nconst { username } = currentUserInfo;\n+ let changePasswordSection;\n+ if (isAccountWithPassword) {\n+ changePasswordSection = (\n+ <li>\n+ <span>Password</span>\n+ <span className={css.passwordContainer}>\n+ <span className={css.password}>******</span>\n+ <a className={css.editPasswordLink} onClick={showPasswordChangeModal}>\n+ <SWMansionIcon icon=\"edit-1\" size={22} />\n+ </a>\n+ </span>\n+ </li>\n+ );\n+ }\n+\nreturn (\n<div className={css.container}>\n<h4 className={css.header}>My Account</h4>\n@@ -67,18 +87,7 @@ function AccountSettings(): React.Node {\n<p className={css.buttonText}>Log out</p>\n</Button>\n</li>\n- <li>\n- <span>Password</span>\n- <span className={css.passwordContainer}>\n- <span className={css.password}>******</span>\n- <a\n- className={css.editPasswordLink}\n- onClick={showPasswordChangeModal}\n- >\n- <SWMansionIcon icon=\"edit-1\" size={22} />\n- </a>\n- </span>\n- </li>\n+ {changePasswordSection}\n<li>\n<span>Friend List</span>\n<Button variant=\"text\" onClick={openFriendList}>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Don't show option to change password for SIWE accounts
Summary: Pretty straightforward, we just hide this setting for accounts that have signed in with Ethereum (based solely on `accountHasPassword` check).
Test Plan:
SIWE Account:
{F342071}
"Traditional" account:
{F342072}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6364 |
129,187 | 16.01.2023 20:35:40 | 25,200 | c92105f7272c5402b8eca75103b0072a207f488a | [lib] Introduce ENSCacheProvider
Summary: Depends on D6371
Test Plan: Tested together with following diffs
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/components/ens-cache-provider.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+\n+import { ENSCache, type EthersProvider } from '../utils/ens-cache';\n+\n+type ENSCacheContextType = {\n+ +ensCache: ?ENSCache,\n+};\n+const ENSCacheContext: React.Context<ENSCacheContextType> = React.createContext<ENSCacheContextType>(\n+ {\n+ ensCache: undefined,\n+ },\n+);\n+\n+type Props = {\n+ +provider: EthersProvider,\n+ +children: React.Node,\n+};\n+function ENSCacheProvider(props: Props): React.Node {\n+ const { provider, children } = props;\n+ const context = React.useMemo(\n+ () => ({\n+ ensCache: new ENSCache(provider),\n+ }),\n+ [provider],\n+ );\n+ return (\n+ <ENSCacheContext.Provider value={context}>\n+ {children}\n+ </ENSCacheContext.Provider>\n+ );\n+}\n+\n+export { ENSCacheContext, ENSCacheProvider };\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/ens-cache.js",
"new_path": "lib/utils/ens-cache.js",
"diff": "@@ -4,7 +4,7 @@ import namehash from 'eth-ens-namehash';\nconst cacheTimeout = 24 * 60 * 60 * 1000; // one day\n-type EthersProvider = {\n+export type EthersProvider = {\n+lookupAddress: (address: string) => Promise<?string>,\n+resolveName: (name: string) => Promise<?string>,\n...\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce ENSCacheProvider
Summary: Depends on D6371
Test Plan: Tested together with following diffs
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6372 |
129,187 | 23.01.2023 22:07:31 | 18,000 | 46391562f7fd3a08fa5312088e62e4d5c17b5823 | [native] Configure ENSCacheProvider
Summary: Depends on D6372
Test Plan: Tested together with following diffs
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/.gitignore",
"new_path": "native/.gitignore",
"diff": "@@ -59,6 +59,7 @@ android/app/.cxx/\ncodegen/dist\nfacts/network.json\n+facts/alchemy.json\n# Expo\n.expo\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"dependencies\": {\n\"@commapp/android-lifecycle\": \"0.0.1\",\n\"@commapp/sqlcipher-amalgamation\": \"^4.4.3-a\",\n+ \"@ethersproject/shims\": \"^5.7.0\",\n\"@expo/react-native-action-sheet\": \"^3.14.0\",\n\"@expo/vector-icons\": \"^13.0.0\",\n\"@gorhom/bottom-sheet\": \"^4.4.5\",\n\"@react-navigation/native\": \"^6.0.13\",\n\"@react-navigation/stack\": \"^6.3.2\",\n\"base-64\": \"^0.1.0\",\n+ \"ethers\": \"^5.7.2\",\n\"expo\": \"47.0.8\",\n\"expo-dev-client\": \"~2.0.1\",\n\"expo-font\": \"~11.0.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "native/root.react.js",
"new_path": "native/root.react.js",
"diff": "@@ -18,6 +18,7 @@ import {\nimport { Provider } from 'react-redux';\nimport { PersistGate as ReduxPersistGate } from 'redux-persist/integration/react';\n+import { ENSCacheProvider } from 'lib/components/ens-cache-provider.react';\nimport { actionLogger } from 'lib/utils/action-logger';\nimport ChatContextProvider from './chat/chat-context-provider.react';\n@@ -48,6 +49,7 @@ import { StaffContextProvider } from './staff/staff-context.provider.react';\nimport { useLoadCommFonts } from './themes/fonts';\nimport { DarkTheme, LightTheme } from './themes/navigation';\nimport ThemeHandler from './themes/theme-handler.react';\n+import { provider } from './utils/ethers-utils';\nif (Platform.OS === 'android') {\nUIManager.setLayoutAnimationEnabledExperimental &&\n@@ -248,6 +250,7 @@ function Root() {\n<InputStateContainer>\n<SafeAreaProvider initialMetrics={initialWindowMetrics}>\n<ActionSheetProvider>\n+ <ENSCacheProvider provider={provider}>\n<MarkdownContextProvider>\n<ChatContextProvider>\n<SQLiteDataHandler />\n@@ -265,6 +268,7 @@ function Root() {\n{navigation}\n</ChatContextProvider>\n</MarkdownContextProvider>\n+ </ENSCacheProvider>\n</ActionSheetProvider>\n</SafeAreaProvider>\n</InputStateContainer>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/utils/ethers-utils.js",
"diff": "+// @flow\n+\n+import '@ethersproject/shims';\n+\n+import { ethers } from 'ethers';\n+\n+import type { EthersProvider } from 'lib/utils/ens-cache';\n+\n+let alchemyKey;\n+try {\n+ // $FlowExpectedError: file might not exist\n+ const { key } = require('../facts/alchemy.json');\n+ alchemyKey = key;\n+} catch {}\n+\n+const provider: EthersProvider = new ethers.providers.AlchemyProvider(\n+ 'mainnet',\n+ alchemyKey,\n+);\n+\n+export { provider };\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "\"@ethersproject/logger\" \"^5.7.0\"\nhash.js \"1.1.7\"\n+\"@ethersproject/shims@^5.7.0\":\n+ version \"5.7.0\"\n+ resolved \"https://registry.yarnpkg.com/@ethersproject/shims/-/shims-5.7.0.tgz#ee32e543418595774029c5ea6123ea8995e7e154\"\n+ integrity sha512-WeDptc6oAprov5CCN2LJ/6/+dC9gTonnkdAtLepm/7P5Z+3PRxS5NpfVWmOMs1yE4Vitl2cU8bOPWC0GvGSbVg==\n+\n\"@ethersproject/signing-key@5.7.0\", \"@ethersproject/signing-key@^5.7.0\":\nversion \"5.7.0\"\nresolved \"https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3\"\n@@ -18923,7 +18928,6 @@ react-native-firebase@^5.6.0:\nreact-native-flipper@^0.164.0, \"react-native-flipper@https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz\":\nversion \"1.1.1\"\n- uid f8cae15d883ffc0abc663b5eaaa711fcc64bb5c2\nresolved \"https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz#f8cae15d883ffc0abc663b5eaaa711fcc64bb5c2\"\nreact-native-floating-action@^1.22.0:\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Configure ENSCacheProvider
Summary: Depends on D6372
Test Plan: Tested together with following diffs
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6373 |
129,187 | 23.01.2023 22:09:32 | 18,000 | d46caaa12dc9edc1d22c653b36dd5aedad868c34 | [web] Configure ENSCacheProvider
Summary: Depends on D6373
Test Plan: Tested together with following diffs
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.react.js",
"new_path": "web/account/siwe.react.js",
"diff": "@@ -5,7 +5,6 @@ import '@rainbow-me/rainbowkit/dist/index.css';\nimport {\nConnectButton,\ndarkTheme,\n- getDefaultWallets,\nRainbowKitProvider,\nuseConnectModal,\n} from '@rainbow-me/rainbowkit';\n@@ -13,7 +12,7 @@ import invariant from 'invariant';\nimport _merge from 'lodash/fp/merge';\nimport * as React from 'react';\nimport { FaEthereum } from 'react-icons/fa';\n-import { useAccount, useSigner, WagmiConfig } from 'wagmi';\n+import { useAccount, useSigner } from 'wagmi';\nimport {\ngetSIWENonce,\n@@ -32,18 +31,14 @@ import {\nsiweMessageSigningExplanationStatements,\nsiweStatementWithoutPublicKey,\n} from 'lib/utils/siwe-utils.js';\n-import { configureWagmiChains, createWagmiClient } from 'lib/utils/wagmi-utils';\nimport Button from '../components/button.react';\nimport LoadingIndicator from '../loading-indicator.react';\nimport { useSelector } from '../redux/redux-utils';\nimport { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';\n+import { wagmiChains } from '../utils/wagmi-utils';\nimport css from './siwe.css';\n-const { chains, provider } = configureWagmiChains(process.env.COMM_ALCHEMY_KEY);\n-const { connectors } = getDefaultWallets({ appName: 'comm', chains });\n-const wagmiClient = createWagmiClient({ connectors, provider });\n-\nconst getSIWENonceLoadingStatusSelector = createLoadingStatusSelector(\ngetSIWENonceActionTypes,\n);\n@@ -191,11 +186,9 @@ function SIWEWrapper(): React.Node {\n});\n}, []);\nreturn (\n- <WagmiConfig client={wagmiClient}>\n- <RainbowKitProvider chains={chains} theme={theme} modalSize=\"compact\">\n+ <RainbowKitProvider chains={wagmiChains} theme={theme} modalSize=\"compact\">\n<SIWE />\n</RainbowKitProvider>\n- </WagmiConfig>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/app.react.js",
"new_path": "web/app.react.js",
"diff": "@@ -9,6 +9,7 @@ import * as React from 'react';\nimport { DndProvider } from 'react-dnd';\nimport { HTML5Backend } from 'react-dnd-html5-backend';\nimport { useDispatch } from 'react-redux';\n+import { WagmiConfig } from 'wagmi';\nimport {\nfetchEntriesActionTypes,\n@@ -55,6 +56,7 @@ import css from './style.css';\nimport getTitle from './title/getTitle';\nimport { type NavInfo } from './types/nav-types';\nimport { canonicalURLFromReduxState, navInfoFromURL } from './url-utils';\n+import { WagmiENSCacheProvider, wagmiClient } from './utils/wagmi-utils';\n// We want Webpack's css-loader and style-loader to handle the Fontawesome CSS,\n// so we disable the autoAddCss logic and import the CSS file. Otherwise every\n@@ -153,12 +155,16 @@ class App extends React.PureComponent<Props> {\n<DndProvider backend={HTML5Backend}>\n<TooltipProvider>\n<MenuProvider>\n+ <WagmiConfig client={wagmiClient}>\n+ <WagmiENSCacheProvider>\n<FocusHandler />\n<VisibilityHandler />\n<DeviceIDUpdater />\n<PolicyAcknowledgmentHandler />\n{content}\n{this.props.modals}\n+ </WagmiENSCacheProvider>\n+ </WagmiConfig>\n</MenuProvider>\n</TooltipProvider>\n</DndProvider>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/utils/wagmi-utils.js",
"diff": "+// @flow\n+\n+import { getDefaultWallets } from '@rainbow-me/rainbowkit';\n+import * as React from 'react';\n+import { useProvider } from 'wagmi';\n+\n+import { ENSCacheProvider } from 'lib/components/ens-cache-provider.react';\n+import { configureWagmiChains, createWagmiClient } from 'lib/utils/wagmi-utils';\n+\n+const { chains, provider } = configureWagmiChains(process.env.COMM_ALCHEMY_KEY);\n+const { connectors } = getDefaultWallets({ appName: 'comm', chains });\n+const wagmiClient: mixed = createWagmiClient({ connectors, provider });\n+const wagmiChains: mixed = chains;\n+\n+type Props = {\n+ +children: React.Node,\n+};\n+function WagmiENSCacheProvider(props: Props): React.Node {\n+ const { children } = props;\n+ const wagmiProvider = useProvider();\n+ return (\n+ <ENSCacheProvider provider={wagmiProvider}>{children}</ENSCacheProvider>\n+ );\n+}\n+\n+export { wagmiClient, wagmiChains, WagmiENSCacheProvider };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Configure ENSCacheProvider
Summary: Depends on D6373
Test Plan: Tested together with following diffs
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6374 |
129,178 | 24.01.2023 16:35:43 | 18,000 | 6fff0861a75ec5778e0cc285bbc26fbd81eae126 | [web] add emoji-mart dependency
Summary:
Add `emoji-mart` dependency.
Linear Task: [[ | ]]
Test Plan: N/A
Reviewers: atul, ashoat
Subscribers: ashoat, tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "web/package.json",
"new_path": "web/package.json",
"diff": "},\n\"dependencies\": {\n\"@babel/runtime\": \"^7.13.10\",\n+ \"@emoji-mart/data\": \"^1.1.2\",\n+ \"@emoji-mart/react\": \"^1.1.1\",\n\"@fortawesome/fontawesome-svg-core\": \"1.2.25\",\n\"@fortawesome/free-regular-svg-icons\": \"5.11.2\",\n\"@fortawesome/free-solid-svg-icons\": \"5.11.2\",\n\"core-js\": \"^3.6.5\",\n\"dateformat\": \"^3.0.3\",\n\"detect-browser\": \"^4.0.4\",\n+ \"emoji-mart\": \"^5.5.2\",\n\"exif-js\": \"^2.3.0\",\n\"history\": \"^4.6.3\",\n\"ethers\": \"^5.7.2\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "minimatch \"^3.0.4\"\nplist \"^3.0.4\"\n+\"@emoji-mart/data@^1.1.2\":\n+ version \"1.1.2\"\n+ resolved \"https://registry.yarnpkg.com/@emoji-mart/data/-/data-1.1.2.tgz#777c976f8f143df47cbb23a7077c9ca9fe5fc513\"\n+ integrity sha512-1HP8BxD2azjqWJvxIaWAMyTySeZY0Osr83ukYjltPVkNXeJvTz7yDrPLBtnrD5uqJ3tg4CcLuuBW09wahqL/fg==\n+\n+\"@emoji-mart/react@^1.1.1\":\n+ version \"1.1.1\"\n+ resolved \"https://registry.yarnpkg.com/@emoji-mart/react/-/react-1.1.1.tgz#ddad52f93a25baf31c5383c3e7e4c6e05554312a\"\n+ integrity sha512-NMlFNeWgv1//uPsvLxvGQoIerPuVdXwK/EUek8OOkJ6wVOWPUizRBJU0hDqWZCOROVpfBgCemaC3m6jDOXi03g==\n+\n\"@emotion/babel-plugin@^11.10.5\":\nversion \"11.10.5\"\nresolved \"https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.10.5.tgz#65fa6e1790ddc9e23cc22658a4c5dea423c55c3c\"\n@@ -9703,6 +9713,11 @@ emittery@^0.7.1:\nresolved \"https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82\"\nintegrity sha512-A8OG5SR/ij3SsJdWDJdkkSYUjQdCUx6APQXem0SaEePBSRg4eymGYwBkKo1Y6DU+af/Jn2dBQqDBvjnr9Vi8nQ==\n+emoji-mart@^5.5.2:\n+ version \"5.5.2\"\n+ resolved \"https://registry.yarnpkg.com/emoji-mart/-/emoji-mart-5.5.2.tgz#3ddbaf053139cf4aa217650078bc1c50ca8381af\"\n+ integrity sha512-Sqc/nso4cjxhOwWJsp9xkVm8OF5c+mJLZJFoFfzRuKO+yWiN7K8c96xmtughYb0d/fZ8UC6cLIQ/p4BR6Pv3/A==\n+\nemoji-regex@^7.0.1:\nversion \"7.0.3\"\nresolved \"https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] add emoji-mart dependency
Summary:
Add `emoji-mart` dependency. https://github.com/missive/emoji-mart#-data
---
Linear Task: [[ https://linear.app/comm/issue/ENG-2776/implement-web-emoji-keyboard-library | ENG-2776 ]]
Test Plan: N/A
Reviewers: atul, ashoat
Reviewed By: atul, ashoat
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D6362 |
129,196 | 02.01.2023 15:41:00 | -3,600 | c3a74431925b77c3bf0da37923e604898de62ad5 | Remove all react-native-notifications usages on iOS
Summary: This differential replaces all remaining usages of NotificationsIOS with CommIOSNotifications.
Test Plan: Ensure that updating badge count, removing and getting all delivered notifications work in JavaScript.
Reviewers: tomek, atul
Subscribers: ashoat | [
{
"change_type": "MODIFY",
"old_path": "native/push/push-handler.react.js",
"new_path": "native/push/push-handler.react.js",
"diff": "@@ -5,7 +5,6 @@ import * as React from 'react';\nimport { AppRegistry, Platform, Alert, LogBox } from 'react-native';\nimport type { RemoteMessage, NotificationOpen } from 'react-native-firebase';\nimport { Notification as InAppNotification } from 'react-native-in-app-message';\n-import NotificationsIOS from 'react-native-notifications';\nimport { useDispatch } from 'react-redux';\nimport {\n@@ -58,12 +57,14 @@ import {\nimport {\nCommIOSNotification,\ntype CoreIOSNotificationData,\n+ type CoreIOSNotificationDataWithRequestIdentifier,\n} from './comm-ios-notification';\nimport { getFirebase } from './firebase';\nimport InAppNotif from './in-app-notif.react';\nimport {\nrequestIOSPushPermissions,\niosPushPermissionResponseReceived,\n+ CommIOSNotifications,\ngetCommIOSNotificationsEventEmitter,\n} from './ios';\n@@ -266,7 +267,7 @@ class PushHandler extends React.PureComponent<Props, State> {\nupdateBadgeCount() {\nconst curUnreadCount = this.props.unreadCount;\nif (Platform.OS === 'ios') {\n- NotificationsIOS.setBadgesCount(curUnreadCount);\n+ CommIOSNotifications.setBadgesCount(curUnreadCount);\n} else if (Platform.OS === 'android') {\ngetFirebase().notifications().setBadge(curUnreadCount);\n}\n@@ -274,7 +275,7 @@ class PushHandler extends React.PureComponent<Props, State> {\nclearAllNotifs() {\nif (Platform.OS === 'ios') {\n- NotificationsIOS.removeAllDeliveredNotifications();\n+ CommIOSNotifications.removeAllDeliveredNotifications();\n} else if (Platform.OS === 'android') {\ngetFirebase().notifications().removeAllDeliveredNotifications();\n}\n@@ -286,7 +287,7 @@ class PushHandler extends React.PureComponent<Props, State> {\nreturn;\n}\nif (Platform.OS === 'ios') {\n- NotificationsIOS.getDeliveredNotifications(notifications =>\n+ CommIOSNotifications.getDeliveredNotifications(notifications =>\nPushHandler.clearDeliveredIOSNotificationsForThread(\nactiveThread,\nnotifications,\n@@ -302,16 +303,16 @@ class PushHandler extends React.PureComponent<Props, State> {\nstatic clearDeliveredIOSNotificationsForThread(\nthreadID: string,\n- notifications: Object[],\n+ notifications: $ReadOnlyArray<CoreIOSNotificationDataWithRequestIdentifier>,\n) {\nconst identifiersToClear = [];\nfor (const notification of notifications) {\n- if (notification['thread-id'] === threadID) {\n+ if (notification.threadID === threadID) {\nidentifiersToClear.push(notification.identifier);\n}\n}\nif (identifiersToClear) {\n- NotificationsIOS.removeDeliveredNotifications(identifiersToClear);\n+ CommIOSNotifications.removeDeliveredNotifications(identifiersToClear);\n}\n}\n@@ -466,7 +467,9 @@ class PushHandler extends React.PureComponent<Props, State> {\n// callback shouldn't be triggered at all. To avoid weirdness we are\n// ignoring any foreground notification received within the first second\n// of the app being started, since they are most likely to be erroneous.\n- notification.finish(NotificationsIOS.FetchResult.NoData);\n+ notification.finish(\n+ CommIOSNotifications.getConstants().FETCH_RESULT_NO_DATA,\n+ );\nreturn;\n}\nconst threadID = notification.getData().threadID;\n@@ -489,7 +492,9 @@ class PushHandler extends React.PureComponent<Props, State> {\n'Non-rescind foreground notification without alert received!',\n);\n}\n- notification.finish(NotificationsIOS.FetchResult.NewData);\n+ notification.finish(\n+ CommIOSNotifications.getConstants().FETCH_RESULT_NEW_DATA,\n+ );\n};\nonPushNotifBootsApp() {\n@@ -508,7 +513,9 @@ class PushHandler extends React.PureComponent<Props, State> {\nconst messageInfos = notification.getData().messageInfos;\nthis.saveMessageInfos(messageInfos);\nthis.onPressNotificationForThread(threadID, true);\n- notification.finish(NotificationsIOS.FetchResult.NewData);\n+ notification.finish(\n+ CommIOSNotifications.getConstants().FETCH_RESULT_NEW_DATA,\n+ );\n};\nshowInAppNotification(threadID: string, message: string, title?: ?string) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Remove all react-native-notifications usages on iOS
Summary: This differential replaces all remaining usages of NotificationsIOS with CommIOSNotifications.
Test Plan: Ensure that updating badge count, removing and getting all delivered notifications work in JavaScript.
Reviewers: tomek, atul
Reviewed By: tomek
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D6140 |
129,178 | 27.01.2023 13:46:58 | 18,000 | 1e4d2f13f1389fae9df58cfe1415010d5e70d179 | [native] add rn-emoji-keyboard dependency
Summary:
Add `rn-emoji-keyboard` dependency.
Test Plan: N/A
Reviewers: atul, tomek, ashoat
Subscribers: ashoat, tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"redux-persist\": \"^6.0.0\",\n\"redux-thunk\": \"^2.2.0\",\n\"reselect\": \"^4.0.0\",\n+ \"rn-emoji-keyboard\": \"^1.2.0\",\n\"shallowequal\": \"^1.0.2\",\n\"simple-markdown\": \"^0.7.2\",\n\"tinycolor2\": \"^1.4.1\"\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -20046,6 +20046,11 @@ rlp@^2.0.0, rlp@^2.2.3:\ndependencies:\nbn.js \"^5.2.0\"\n+rn-emoji-keyboard@^1.2.0:\n+ version \"1.2.0\"\n+ resolved \"https://registry.yarnpkg.com/rn-emoji-keyboard/-/rn-emoji-keyboard-1.2.0.tgz#a8fe18230624855b483cdbff139cb1f2ac8d8c6d\"\n+ integrity sha512-OyfMOxH6Op+SH6fq1bJBl1Wp6ukC/0VbRmnyo2GaQoYkv46g3Xjw3Io9N8j7Mhk60DSSORig+Jjpf+oa8bZOEA==\n+\nrn-host-detect@1.2.0, rn-host-detect@^1.0.1, rn-host-detect@^1.1.5:\nversion \"1.2.0\"\nresolved \"https://registry.yarnpkg.com/rn-host-detect/-/rn-host-detect-1.2.0.tgz#8b0396fc05631ec60c1cb8789e5070cdb04d0da0\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] add rn-emoji-keyboard dependency
Summary:
Add `rn-emoji-keyboard` dependency.
https://github.com/TheWidlarzGroup/rn-emoji-keyboard
Test Plan: N/A
Reviewers: atul, tomek, ashoat
Reviewed By: ashoat
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D6413 |
129,184 | 27.01.2023 15:33:54 | 18,000 | 7ec720ec655e5f1ff1d75104d62294284ee29988 | [web][landing] Add legal acknowledgements to SIWE flow
Summary:
Context:
Add Terms of Use and Privacy Policy acknowledment to SIWE flow.
Test Plan:
Looks as expected:
{F346323}
{F346324}
Reviewers: ashoat, tomek, kamil | [
{
"change_type": "MODIFY",
"old_path": "landing/siwe.react.js",
"new_path": "landing/siwe.react.js",
"diff": "@@ -136,6 +136,11 @@ function SIWE(): React.Node {\n</div>\n<p>{siweMessageSigningExplanationStatements[0]}</p>\n<p>{siweMessageSigningExplanationStatements[1]}</p>\n+ <p>\n+ By signing up, you agree to our{' '}\n+ <a href=\"https://comm.app/terms\">Terms of Use</a> &{' '}\n+ <a href=\"https://comm.app/privacy\">Privacy Policy</a>.\n+ </p>\n<div className={css.button} onClick={onClick}>\nSign in\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.react.js",
"new_path": "web/account/siwe.react.js",
"diff": "@@ -135,6 +135,11 @@ function SIWE(): React.Node {\n</div>\n<p>{siweMessageSigningExplanationStatements[0]}</p>\n<p>{siweMessageSigningExplanationStatements[1]}</p>\n+ <p>\n+ By signing up, you agree to our{' '}\n+ <a href=\"https://comm.app/terms\">Terms of Use</a> &{' '}\n+ <a href=\"https://comm.app/privacy\">Privacy Policy</a>.\n+ </p>\n<Button variant=\"filled\" onClick={onSignInButtonClick}>\nSign in\n</Button>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web][landing] Add legal acknowledgements to SIWE flow
Summary:
Context: https://linear.app/comm/issue/ENG-2835/disable-auto-accepting-policies-after-siwe
Add Terms of Use and Privacy Policy acknowledment to SIWE flow.
Test Plan:
Looks as expected:
{F346323}
{F346324}
Reviewers: ashoat, tomek, kamil
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6406 |
129,187 | 27.01.2023 15:15:27 | 18,000 | 1518d021a5522f637f48b2415176ecf992fd298c | [native] Show your ENS name in ProfileScreen
Summary: Depends on D6420
Test Plan: {F348006}
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/profile/profile-screen.react.js",
"new_path": "native/profile/profile-screen.react.js",
"diff": "@@ -4,6 +4,7 @@ import * as React from 'react';\nimport { View, Text, Alert, Platform, ScrollView } from 'react-native';\nimport { logOutActionTypes, logOut } from 'lib/actions/user-actions';\n+import { useStringForUser } from 'lib/hooks/ens-cache';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { accountHasPassword } from 'lib/shared/account-utils';\n@@ -68,15 +69,10 @@ type Props = {\n+dispatchActionPromise: DispatchActionPromise,\n+logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>,\n+staffCanSee: boolean,\n+ +stringForUser: ?string,\n};\nclass ProfileScreen extends React.PureComponent<Props> {\n- get username() {\n- return this.props.currentUserInfo && !this.props.currentUserInfo.anonymous\n- ? this.props.currentUserInfo.username\n- : undefined;\n- }\n-\nget loggedOutOrLoggingOut() {\nreturn (\n!this.props.currentUserInfo ||\n@@ -134,7 +130,7 @@ class ProfileScreen extends React.PureComponent<Props> {\n<SingleLine\nstyle={[this.props.styles.label, this.props.styles.username]}\n>\n- {this.username}\n+ {this.props.stringForUser}\n</SingleLine>\n<Button\nonPress={this.onPressLogOut}\n@@ -360,6 +356,7 @@ const ConnectedProfileScreen: React.ComponentType<BaseProps> = React.memo<BasePr\nconst callLogOut = useServerCall(logOut);\nconst dispatchActionPromise = useDispatchActionPromise();\nconst staffCanSee = useStaffCanSee();\n+ const stringForUser = useStringForUser(currentUserInfo);\nreturn (\n<ProfileScreen\n@@ -372,6 +369,7 @@ const ConnectedProfileScreen: React.ComponentType<BaseProps> = React.memo<BasePr\nlogOut={callLogOut}\ndispatchActionPromise={dispatchActionPromise}\nstaffCanSee={staffCanSee}\n+ stringForUser={stringForUser}\n/>\n);\n},\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Show your ENS name in ProfileScreen
Summary: Depends on D6420
Test Plan: {F348006}
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6421 |
129,187 | 27.01.2023 15:29:53 | 18,000 | 61873cfc55a481c535951af9a0c262afe45d5794 | [web] Show your ENS name in AccountSettings
Summary: Depends on D6421
Test Plan: {F348035}
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/settings/account-settings.react.js",
"new_path": "web/settings/account-settings.react.js",
"diff": "@@ -4,6 +4,7 @@ import * as React from 'react';\nimport { logOut, logOutActionTypes } from 'lib/actions/user-actions';\nimport { useModalContext } from 'lib/components/modal-provider.react';\n+import { useStringForUser } from 'lib/hooks/ens-cache';\nimport { preRequestUserStateSelector } from 'lib/selectors/account-selectors';\nimport { accountHasPassword } from 'lib/shared/account-utils.js';\nimport {\n@@ -53,10 +54,10 @@ function AccountSettings(): React.Node {\n);\nconst currentUserInfo = useSelector(state => state.currentUserInfo);\n+ const stringForUser = useStringForUser(currentUserInfo);\nif (!currentUserInfo || currentUserInfo.anonymous) {\nreturn null;\n}\n- const { username } = currentUserInfo;\nlet changePasswordSection;\nif (isAccountWithPassword) {\n@@ -81,7 +82,7 @@ function AccountSettings(): React.Node {\n<li>\n<p className={css.logoutContainer}>\n<span className={css.logoutLabel}>{'Logged in as '}</span>\n- <span className={css.username}>{username}</span>\n+ <span className={css.username}>{stringForUser}</span>\n</p>\n<Button variant=\"text\" onClick={logOutUser}>\n<p className={css.buttonText}>Log out</p>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Show your ENS name in AccountSettings
Summary: Depends on D6421
Test Plan: {F348035}
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6422 |
129,187 | 27.01.2023 17:39:18 | 18,000 | c78db73720dacdf15b0a5247efa08c052a83ec7d | [lib] Introduce useENSNames to fetch more than one ENS name at a time
Summary: Also rewrite `useStringForUser` to call into `useENSNames`.
Test Plan: Tested existing calls of `useStringForUser`, both when logged in as an ENS user and when not
Reviewers: atul, tomek
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/hooks/ens-cache.js",
"new_path": "lib/hooks/ens-cache.js",
"diff": "// @flow\n+import invariant from 'invariant';\nimport * as React from 'react';\nimport { ENSCacheContext } from '../components/ens-cache-provider.react';\nimport { userIdentifiedByETHAddress } from '../shared/account-utils';\nimport { stringForUser } from '../shared/user-utils';\n-function useStringForUser(\n- user: ?{ +username?: ?string, +isViewer?: ?boolean, ... },\n-): ?string {\n- const ethAddress = React.useMemo(() => {\n- if (\n- !user ||\n- user.isViewer ||\n- !user.username ||\n- !userIdentifiedByETHAddress(user)\n- ) {\n- return null;\n- }\n- return user.username;\n- }, [user]);\n-\n+type BaseUserInfo = { +username?: ?string, ... };\n+function useENSNames<T: ?BaseUserInfo>(users: $ReadOnlyArray<T>): T[] {\nconst cacheContext = React.useContext(ENSCacheContext);\nconst { ensCache } = cacheContext;\n+\n+ const cachedInfo = React.useMemo(\n+ () =>\n+ users.map(user => {\n+ if (!user) {\n+ return user;\n+ }\n+ const { username } = user;\n+ const ethAddress =\n+ username && userIdentifiedByETHAddress(user) ? username : null;\nconst cachedResult =\nethAddress && ensCache\n? ensCache.getCachedNameForAddress(ethAddress)\n: null;\n+ return {\n+ input: user,\n+ ethAddress,\n+ cachedResult,\n+ };\n+ }),\n+ [users, ensCache],\n+ );\n- const [ensName, setENSName] = React.useState<?string>(null);\n-\n- React.useEffect(() => {\n- // Whenever the ETH address changes, clear out ENS name before requery below\n- setENSName(null);\n- }, [ethAddress]);\n+ const [fetchedAddresses, setFetchedAddresses] = React.useState<\n+ $ReadOnlySet<string>,\n+ >(new Set());\n+ const [ensNames, setENSNames] = React.useState<$ReadOnlyMap<string, string>>(\n+ new Map(),\n+ );\nReact.useEffect(() => {\n- if (cachedResult || !ethAddress || !ensCache) {\n+ if (!ensCache) {\n+ return;\n+ }\n+ const needFetch = cachedInfo\n+ .map(user => {\n+ if (!user) {\n+ return null;\n+ }\n+ const { ethAddress, cachedResult } = user;\n+ if (cachedResult || !ethAddress || fetchedAddresses.has(ethAddress)) {\n+ return null;\n+ }\n+ return ethAddress;\n+ })\n+ .filter(Boolean);\n+ if (needFetch.length === 0) {\nreturn;\n}\n- let cancelled = false;\n+ setFetchedAddresses(oldFetchedAddresses => {\n+ const newFetchedAddresses = new Set(oldFetchedAddresses);\n+ for (const ethAddress of needFetch) {\n+ newFetchedAddresses.add(ethAddress);\n+ }\n+ return newFetchedAddresses;\n+ });\n+ for (const ethAddress of needFetch) {\n(async () => {\nconst result = await ensCache.getNameForAddress(ethAddress);\n- if (result && !cancelled) {\n- setENSName(result);\n+ if (!result) {\n+ return;\n}\n+ setENSNames(oldENSNames => {\n+ const newENSNames = new Map(oldENSNames);\n+ newENSNames.set(ethAddress, result);\n+ return newENSNames;\n+ });\n})();\n- return () => {\n- cancelled = true;\n- };\n- }, [cachedResult, ethAddress, ensCache]);\n+ }\n+ }, [cachedInfo, fetchedAddresses, ensCache]);\n+ return cachedInfo.map(user => {\n+ if (!user) {\n+ return user;\n+ }\n+ const { input, ethAddress, cachedResult } = user;\n+ if (cachedResult) {\n+ return { ...input, username: cachedResult };\n+ } else if (!ethAddress) {\n+ return input;\n+ }\n+ const ensName = ensNames.get(ethAddress);\nif (ensName) {\n- return ensName;\n- } else if (cachedResult) {\n- return cachedResult;\n- } else if (user) {\n+ return { ...input, username: ensName };\n+ }\n+ return input;\n+ });\n+}\n+\n+function useStringForUser(\n+ user: ?{ +username?: ?string, +isViewer?: ?boolean, ... },\n+): ?string {\n+ const toFetch = user?.isViewer ? null : user;\n+ // stringForUser ignores username is isViewer, so we skip the ENS fetch\n+ const [result] = useENSNames([toFetch]);\n+ if (user?.isViewer) {\nreturn stringForUser(user);\n+ } else if (result) {\n+ return stringForUser(result);\n} else {\n- return null;\n+ invariant(\n+ !user,\n+ 'the only way result can be falsey is if useENSNames is passed a ' +\n+ 'falsey input, and that can only happen if useStringForUser input is ' +\n+ 'falsey or isViewer is set',\n+ );\n+ return user;\n}\n}\n-export { useStringForUser };\n+export { useENSNames, useStringForUser };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce useENSNames to fetch more than one ENS name at a time
Summary: Also rewrite `useStringForUser` to call into `useENSNames`.
Test Plan: Tested existing calls of `useStringForUser`, both when logged in as an ENS user and when not
Reviewers: atul, tomek
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6423 |
129,187 | 27.01.2023 21:15:36 | 18,000 | 7c1472dcc4293a66ec05a466059794b6e18166a0 | [lib] createMessageReactionsList -> useMessageReactionsList for ENS fetching
Summary: Depends on D6423
Test Plan:
| `native` | `web` |
| {F348467} | {F348468} |
Reviewers: atul, ginsu
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/reaction-utils.js",
"new_path": "lib/shared/reaction-utils.js",
"diff": "import invariant from 'invariant';\nimport _sortBy from 'lodash/fp/sortBy';\n+import * as React from 'react';\n+import { useENSNames } from '../hooks/ens-cache';\nimport type { MessageReactionInfo } from '../selectors/chat-selectors';\nimport type {\nRobotextMessageInfo,\n@@ -41,9 +43,10 @@ type MessageReactionListInfo = {\n+username: string,\n};\n-function createMessageReactionsList(\n+function useMessageReactionsList(\nreactions: $ReadOnlyMap<string, MessageReactionInfo>,\n): $ReadOnlyArray<MessageReactionListInfo> {\n+ const withoutENSNames = React.useMemo(() => {\nconst result = [];\nfor (const [reaction, reactionInfo] of reactions) {\n@@ -66,6 +69,8 @@ function createMessageReactionsList(\n((reactionInfo: MessageReactionListInfo) => mixed) | string,\n>),\n)(result);\n+ }, [reactions]);\n+ return useENSNames<MessageReactionListInfo>(withoutENSNames);\n}\nfunction useCanCreateReactionFromMessage(\n@@ -99,6 +104,6 @@ function useCanCreateReactionFromMessage(\nexport {\nstringForReactionList,\n- createMessageReactionsList,\n+ useMessageReactionsList,\nuseCanCreateReactionFromMessage,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-reactions-modal.react.js",
"new_path": "native/chat/message-reactions-modal.react.js",
"diff": "@@ -6,7 +6,7 @@ import * as React from 'react';\nimport { View, Text, FlatList, TouchableHighlight } from 'react-native';\nimport type { MessageReactionInfo } from 'lib/selectors/chat-selectors';\n-import { createMessageReactionsList } from 'lib/shared/reaction-utils';\n+import { useMessageReactionsList } from 'lib/shared/reaction-utils';\nimport Modal from '../components/modal.react';\nimport type { RootNavigationProp } from '../navigation/root-navigator.react';\n@@ -32,10 +32,7 @@ function MessageReactionsModal(props: Props): React.Node {\nconst close = React.useCallback(() => navigation.goBack(), [navigation]);\n- const reactionsListData = React.useMemo(\n- () => createMessageReactionsList(reactions),\n- [reactions],\n- );\n+ const reactionsListData = useMessageReactionsList(reactions);\nconst renderItem = React.useCallback(\n({ item }) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/chat/message-reactions-modal.react.js",
"new_path": "web/modals/chat/message-reactions-modal.react.js",
"diff": "import * as React from 'react';\nimport type { MessageReactionInfo } from 'lib/selectors/chat-selectors';\n-import { createMessageReactionsList } from 'lib/shared/reaction-utils';\n+import { useMessageReactionsList } from 'lib/shared/reaction-utils';\nimport Modal from '../modal.react';\nimport css from './message-reactions-modal.css';\n@@ -16,16 +16,18 @@ type Props = {\nfunction MessageReactionsModal(props: Props): React.Node {\nconst { onClose, reactions } = props;\n- const reactionsList = React.useMemo(() => {\n- const messageReactionsList = createMessageReactionsList(reactions);\n+ const messageReactionsList = useMessageReactionsList(reactions);\n- return messageReactionsList.map(messageReactionUser => (\n+ const reactionsList = React.useMemo(\n+ () =>\n+ messageReactionsList.map(messageReactionUser => (\n<div key={messageReactionUser.id} className={css.userRowContainer}>\n<div>{messageReactionUser.username}</div>\n<div>{messageReactionUser.reaction}</div>\n</div>\n- ));\n- }, [reactions]);\n+ )),\n+ [messageReactionsList],\n+ );\nreturn (\n<Modal size=\"large\" name=\"Reactions\" onClose={onClose}>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] createMessageReactionsList -> useMessageReactionsList for ENS fetching
Summary: Depends on D6423
Test Plan:
| `native` | `web` |
| {F348467} | {F348468} |
Reviewers: atul, ginsu
Reviewed By: ginsu
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6424 |
129,187 | 28.01.2023 07:21:06 | 18,000 | 85afa94f1918f4bce56a7a4929f9d6cbbb1018e9 | [native][web] Show ENS name for message author
Test Plan:
| `web` | `native` |
| {F348672} | {F348673} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/chat/message-header.react.js",
"new_path": "native/chat/message-header.react.js",
"diff": "import * as React from 'react';\nimport { View } from 'react-native';\n-import { stringForUser } from 'lib/shared/user-utils';\n+import { useStringForUser } from 'lib/hooks/ens-cache';\nimport { SingleLine } from '../components/single-line.react';\nimport { useStyles } from '../themes/colors';\n@@ -24,15 +24,16 @@ function MessageHeader(props: Props): React.Node {\nconst { isViewer } = creator;\nconst modalDisplay = display === 'modal';\n+ const shouldShowUsername = !isViewer && (modalDisplay || item.startsCluster);\n+ const stringForUser = useStringForUser(shouldShowUsername ? creator : null);\n+\nlet authorName = null;\n- if (!isViewer && (modalDisplay || item.startsCluster)) {\n+ if (stringForUser) {\nconst style = [styles.authorName];\nif (modalDisplay) {\nstyle.push(styles.modal);\n}\n- authorName = (\n- <SingleLine style={style}>{stringForUser(creator)}</SingleLine>\n- );\n+ authorName = <SingleLine style={style}>{stringForUser}</SingleLine>;\n}\nconst timestamp =\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -8,8 +8,8 @@ import {\nXCircle as XCircleIcon,\n} from 'react-feather';\n+import { useStringForUser } from 'lib/hooks/ens-cache';\nimport { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors';\n-import { stringForUser } from 'lib/shared/user-utils';\nimport { assertComposableMessageType } from 'lib/types/message-types';\nimport { type ThreadInfo } from 'lib/types/thread-types';\n@@ -56,6 +56,7 @@ type Props = {\n+onMouseLeave: ?() => mixed,\n+onMouseEnter: (event: SyntheticEvent<HTMLDivElement>) => mixed,\n+containsInlineEngagement: boolean,\n+ +stringForUser: ?string,\n};\nclass ComposedMessage extends React.PureComponent<Props> {\nstatic defaultProps: { +borderRadius: number } = {\n@@ -90,10 +91,9 @@ class ComposedMessage extends React.PureComponent<Props> {\n};\nlet authorName = null;\n- if (!isViewer && item.startsCluster) {\n- authorName = (\n- <span className={css.authorName}>{stringForUser(creator)}</span>\n- );\n+ const { stringForUser } = this.props;\n+ if (stringForUser) {\n+ authorName = <span className={css.authorName}>{stringForUser}</span>;\n}\nlet deliveryIcon = null;\n@@ -167,7 +167,8 @@ const ConnectedComposedMessage: React.ComponentType<ConnectedConfig> = React.mem\nfunction ConnectedComposedMessage(props) {\nconst { item, threadInfo } = props;\nconst inputState = React.useContext(InputStateContext);\n- const isViewer = props.item.messageInfo.creator.isViewer;\n+ const { creator } = props.item.messageInfo;\n+ const { isViewer } = creator;\nconst availablePositions = isViewer\n? availableTooltipPositionsForViewerMessage\n: availableTooltipPositionsForNonViewerMessage;\n@@ -179,6 +180,9 @@ const ConnectedComposedMessage: React.ComponentType<ConnectedConfig> = React.mem\navailablePositions,\n});\n+ const shouldShowUsername = !isViewer && item.startsCluster;\n+ const stringForUser = useStringForUser(shouldShowUsername ? creator : null);\n+\nreturn (\n<ComposedMessage\n{...props}\n@@ -186,6 +190,7 @@ const ConnectedComposedMessage: React.ComponentType<ConnectedConfig> = React.mem\nonMouseLeave={onMouseLeave}\nonMouseEnter={onMouseEnter}\ncontainsInlineEngagement={containsInlineEngagement}\n+ stringForUser={stringForUser}\n/>\n);\n},\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native][web] Show ENS name for message author
Test Plan:
| `web` | `native` |
| {F348672} | {F348673} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6425 |
129,187 | 28.01.2023 09:43:58 | 18,000 | 6cecac813123478d004b2b610e4a5dd347cbaeb2 | [lib] Factor out normalization functions in ENSCache
Summary: They're already used three times each, and I'm about to introduce new usages. I think it's better for this logic to be in one place.
Test Plan: `cd lib && ALCHEMY_API_KEY=... yarn test utils/ens-cache.test.js`
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/ens-cache.js",
"new_path": "lib/utils/ens-cache.js",
"diff": "@@ -22,6 +22,17 @@ type ENSAddressQueryCacheEntry = {\n+normalizedETHAddress: ?string,\n};\n+const normalizeETHAddress = (ethAddress: string) => ethAddress.toLowerCase();\n+\n+// Note: this normalization is a little different than the ETH address\n+// normalization. The difference is that ETH addresses are\n+// case-insensitive, but a normalized ENS name is not the same as its input.\n+// Whereas we use normalizeETHAddress just to dedup inputs, we use this\n+// function to check if an ENS name matches its normalized ENS name, as a way\n+// to prevent homograph attacks.\n+// See https://docs.ens.domains/dapp-developer-guide/resolving-names#reverse-resolution\n+const normalizeENSName = (ensName: string) => namehash.normalize(ensName);\n+\n// We have a need for querying ENS names from both clients as well as from\n// keyserver code. On the client side, we could use wagmi's caching behavior,\n// but that doesn't work for keyserver since it's React-specific. To keep\n@@ -42,15 +53,15 @@ class ENSCache {\n// 1. Since any address can set a reverse resolution to an arbitrary ENS name\n// (without permission from the owner), this function will also perform a\n// \"forward resolution\" to confirm that the owner of the ENS name has\n- // mapped it to this address.\n+ // mapped it to this address\n// 2. We only consider an ENS name valid if it's equal to its normalized\n// version via eth-ens-namehash. This is to protect against homograph\n- // attacks. See https://docs.ens.domains/dapp-developer-guide/resolving-names#reverse-resolution\n+ // attacks\n// If we fail to find an ENS name for an address, fail to confirm a matching\n// forward resolution, or if the ENS name does not equal its normalized\n// version, we will return undefined.\nasync getNameForAddress(ethAddress: string): Promise<?string> {\n- const normalizedETHAddress = ethAddress.toLowerCase();\n+ const normalizedETHAddress = normalizeETHAddress(ethAddress);\nconst cacheResult = this.getCachedNameForAddress(normalizedETHAddress);\nif (cacheResult) {\n@@ -72,7 +83,7 @@ class ENSCache {\nreturn cacheAndReturnResult(undefined);\n}\n- const normalizedENSName = namehash.normalize(ensName);\n+ const normalizedENSName = normalizeENSName(ensName);\nif (normalizedENSName !== ensName) {\nreturn cacheAndReturnResult(undefined);\n}\n@@ -81,7 +92,7 @@ class ENSCache {\n}\ngetCachedNameForAddress(ethAddress: string): ?string {\n- const normalizedETHAddress = ethAddress.toLowerCase();\n+ const normalizedETHAddress = normalizeETHAddress(ethAddress);\nconst cacheResult = this.nameQueryCache.get(normalizedETHAddress);\nif (!cacheResult) {\n@@ -98,7 +109,7 @@ class ENSCache {\n}\nasync getAddressForName(ensName: string): Promise<?string> {\n- const normalizedENSName = namehash.normalize(ensName);\n+ const normalizedENSName = normalizeENSName(ensName);\nif (normalizedENSName !== ensName) {\nreturn undefined;\n}\n@@ -121,11 +132,11 @@ class ENSCache {\nif (!ethAddress) {\nreturn cacheAndReturnResult(undefined);\n}\n- return cacheAndReturnResult(ethAddress.toLowerCase());\n+ return cacheAndReturnResult(normalizeETHAddress(ethAddress));\n}\ngetCachedAddressForName(ensName: string): ?string {\n- const normalizedENSName = namehash.normalize(ensName);\n+ const normalizedENSName = normalizeENSName(ensName);\nif (normalizedENSName !== ensName) {\nreturn undefined;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Factor out normalization functions in ENSCache
Summary: They're already used three times each, and I'm about to introduce new usages. I think it's better for this logic to be in one place.
Test Plan: `cd lib && ALCHEMY_API_KEY=... yarn test utils/ens-cache.test.js`
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6426 |
129,187 | 28.01.2023 10:00:25 | 18,000 | 161b292056677fbc58e8550897a0f745b1b7b09c | [lib] Factor out constants in ENSCache tests
Summary: Depends on D6426
Test Plan: `cd lib && ALCHEMY_API_KEY=... yarn test utils/ens-cache.test.js`
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/ens-cache.test.js",
"new_path": "lib/utils/ens-cache.test.js",
"diff": "@@ -32,43 +32,38 @@ if (!process.env.ALCHEMY_API_KEY) {\n);\n}\n+const ashoatDotEth = 'ashoat.eth';\n+const ashoatAddr = '0x911413ef4127910d79303483f7470d095f399ca9';\n+\ndescribe('getNameForAddress', () => {\nit('should fail to return ashoat.eth if not in cache', async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\n- const obviouslyAshoatEth = ensCache.getCachedNameForAddress(\n- '0x911413ef4127910d79303483f7470d095f399ca9',\n- );\n- expect(obviouslyAshoatEth).toBe(undefined);\n+ const ashoatEthResult = ensCache.getCachedNameForAddress(ashoatAddr);\n+ expect(ashoatEthResult).toBe(undefined);\n});\nit('should return ashoat.eth', async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\n- const obviouslyAshoatEth = await ensCache.getNameForAddress(\n- '0x911413ef4127910d79303483f7470d095f399ca9',\n- );\n- expect(obviouslyAshoatEth).toBe('ashoat.eth');\n+ const ashoatEthResult = await ensCache.getNameForAddress(ashoatAddr);\n+ expect(ashoatEthResult).toBe(ashoatDotEth);\n});\nit('should return ashoat.eth if in cache', async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\n- const obviouslyAshoatEth = ensCache.getCachedNameForAddress(\n- '0x911413ef4127910d79303483f7470d095f399ca9',\n- );\n- expect(obviouslyAshoatEth).toBe('ashoat.eth');\n+ const ashoatEthResult = ensCache.getCachedNameForAddress(ashoatAddr);\n+ expect(ashoatEthResult).toBe(ashoatDotEth);\n});\nit('should have ashoat.eth cached', async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\nconst timesLookupAddressCalledBefore = timesLookupAddressCalled;\n- const obviouslyAshoatEth = await ensCache.getNameForAddress(\n- '0x911413ef4127910d79303483f7470d095f399ca9',\n- );\n- expect(obviouslyAshoatEth).toBe('ashoat.eth');\n+ const ashoatEthResult = await ensCache.getNameForAddress(ashoatAddr);\n+ expect(ashoatEthResult).toBe(ashoatDotEth);\nexpect(timesLookupAddressCalled).toBe(timesLookupAddressCalledBefore);\n});\n});\n@@ -78,30 +73,30 @@ describe('getAddressForName', () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\n- const ashoatAddr = ensCache.getCachedAddressForName('ashoat.eth');\n- expect(ashoatAddr).toBe(undefined);\n+ const ashoatAddrResult = ensCache.getCachedAddressForName(ashoatDotEth);\n+ expect(ashoatAddrResult).toBe(undefined);\n});\nit(\"should return ashoat.eth's address\", async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\n- const ashoatAddr = await ensCache.getAddressForName('ashoat.eth');\n- expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9');\n+ const ashoatAddrResult = await ensCache.getAddressForName(ashoatDotEth);\n+ expect(ashoatAddrResult).toBe(ashoatAddr);\n});\nit(\"should return ashoat.eth's address if in cache\", async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\n- const ashoatAddr = ensCache.getCachedAddressForName('ashoat.eth');\n- expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9');\n+ const ashoatAddrResult = ensCache.getCachedAddressForName(ashoatDotEth);\n+ expect(ashoatAddrResult).toBe(ashoatAddr);\n});\nit(\"should have ashoat.eth's address cached\", async () => {\nif (!process.env.ALCHEMY_API_KEY) {\nreturn;\n}\nconst timesResolveNameCalledBefore = timesResolveNameCalled;\n- const ashoatAddr = await ensCache.getAddressForName('ashoat.eth');\n- expect(ashoatAddr).toBe('0x911413ef4127910d79303483f7470d095f399ca9');\n+ const ashoatAddrResult = await ensCache.getAddressForName(ashoatDotEth);\n+ expect(ashoatAddrResult).toBe(ashoatAddr);\nexpect(timesResolveNameCalled).toBe(timesResolveNameCalledBefore);\n});\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Factor out constants in ENSCache tests
Summary: Depends on D6426
Test Plan: `cd lib && ALCHEMY_API_KEY=... yarn test utils/ens-cache.test.js`
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6427 |
129,187 | 28.01.2023 10:04:15 | 18,000 | aa4d57b3bdc7def604f9cee60ac1bb9b32397098 | [lib] Modify ENSCache test so ETH address normalization is checked
Summary: Depends on D6427
Test Plan: `cd lib && ALCHEMY_API_KEY=... yarn test utils/ens-cache.test.js`
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/ens-cache.test.js",
"new_path": "lib/utils/ens-cache.test.js",
"diff": "@@ -62,7 +62,9 @@ describe('getNameForAddress', () => {\nreturn;\n}\nconst timesLookupAddressCalledBefore = timesLookupAddressCalled;\n- const ashoatEthResult = await ensCache.getNameForAddress(ashoatAddr);\n+ const ashoatEthResult = await ensCache.getNameForAddress(\n+ ashoatAddr.toUpperCase(),\n+ );\nexpect(ashoatEthResult).toBe(ashoatDotEth);\nexpect(timesLookupAddressCalled).toBe(timesLookupAddressCalledBefore);\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Modify ENSCache test so ETH address normalization is checked
Summary: Depends on D6427
Test Plan: `cd lib && ALCHEMY_API_KEY=... yarn test utils/ens-cache.test.js`
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6428 |
129,187 | 28.01.2023 11:39:58 | 18,000 | d2035f3047a6a0c640853aca1a4bba0f89fa2b06 | [native] Use ENS names inside ThreadSettings
Summary: Note that I'll handle the title of the `ThreadSettings` ReactNav screen in a separate diff, as that will require a new component.
Test Plan: | {F349050} | {F349049} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-edit-relationship.react.js",
"new_path": "native/chat/settings/thread-settings-edit-relationship.react.js",
"diff": "@@ -8,6 +8,7 @@ import {\nupdateRelationships as serverUpdateRelationships,\nupdateRelationshipsActionTypes,\n} from 'lib/actions/relationship-actions';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport {\ngetRelationshipActionText,\ngetRelationshipDispatchAction,\n@@ -36,7 +37,7 @@ type Props = {\nconst ThreadSettingsEditRelationship: React.ComponentType<Props> = React.memo<Props>(\nfunction ThreadSettingsEditRelationship(props: Props) {\n- const otherUserInfo = useSelector(state => {\n+ const otherUserInfoFromRedux = useSelector(state => {\nconst currentUserID = state.currentUserInfo?.id;\nconst otherUserID = getSingleOtherUser(props.threadInfo, currentUserID);\ninvariant(otherUserID, 'Other user should be specified');\n@@ -44,7 +45,9 @@ const ThreadSettingsEditRelationship: React.ComponentType<Props> = React.memo<Pr\nconst { userInfos } = state.userStore;\nreturn userInfos[otherUserID];\n});\n- invariant(otherUserInfo, 'Other user info should be specified');\n+ invariant(otherUserInfoFromRedux, 'Other user info should be specified');\n+\n+ const [otherUserInfo] = useENSNames([otherUserInfoFromRedux]);\nconst callUpdateRelationships = useServerCall(serverUpdateRelationships);\nconst updateRelationship = React.useCallback(\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-member.react.js",
"new_path": "native/chat/settings/thread-settings-member.react.js",
"diff": "@@ -14,6 +14,7 @@ import {\nremoveUsersFromThreadActionTypes,\nchangeThreadMemberRolesActionTypes,\n} from 'lib/actions/thread-actions';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport {\nmemberIsAdmin,\n@@ -264,6 +265,8 @@ const ConnectedThreadSettingsMember: React.ComponentType<BaseProps> = React.memo\n)(state),\n);\n+ const [memberInfo] = useENSNames([props.memberInfo]);\n+\nconst colors = useColors();\nconst styles = useStyles(unboundStyles);\nconst keyboardState = React.useContext(KeyboardContext);\n@@ -271,6 +274,7 @@ const ConnectedThreadSettingsMember: React.ComponentType<BaseProps> = React.memo\nreturn (\n<ThreadSettingsMember\n{...props}\n+ memberInfo={memberInfo}\nremoveUserLoadingStatus={removeUserLoadingStatus}\nchangeRoleLoadingStatus={changeRoleLoadingStatus}\ncolors={colors}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Use ENS names inside ThreadSettings
Summary: Note that I'll handle the title of the `ThreadSettings` ReactNav screen in a separate diff, as that will require a new component.
Test Plan: | {F349050} | {F349049} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6432 |
129,196 | 11.01.2023 14:23:32 | -3,600 | fff47cdc03bc002efda8aff81b06d99c2676cf96 | Remove threadID to notifID mapping from redux and all related usages
Summary: This differential removes threadID to NotifID mapping from redux on native.
Test Plan: Test plan for previous differential + ensure flow does not complain.
Reviewers: tomek, atul, ashoat
Subscribers: ashoat | [
{
"change_type": "MODIFY",
"old_path": "native/push/android.js",
"new_path": "native/push/android.js",
"diff": "@@ -6,11 +6,7 @@ import type { RemoteMessage } from 'react-native-firebase';\nimport { mergePrefixIntoBody } from 'lib/shared/notif-utils';\n-import {\n- recordAndroidNotificationActionType,\n- rescindAndroidNotificationActionType,\n-} from '../redux/action-types';\n-import { store, dispatch } from '../redux/redux-setup';\n+import { store } from '../redux/redux-setup';\nimport { getFirebase } from './firebase';\ntype CommAndroidNotificationsModuleType = {\n@@ -37,10 +33,6 @@ function handleAndroidMessage(\nconst { rescind, rescindID } = data;\nif (rescind) {\ninvariant(rescindID, 'rescind message without notifID');\n- dispatch({\n- type: rescindAndroidNotificationActionType,\n- payload: { notifID: rescindID, threadID: data.threadID },\n- });\nreturn;\n}\n@@ -71,15 +63,6 @@ function handleAndroidMessage(\nnotification.setTitle(title);\n}\nfirebase.notifications().displayNotification(notification);\n-\n- // We keep track of what notifs have been rendered for a given thread so\n- // that we can clear them immediately (without waiting for the rescind)\n- // when the user navigates to that thread. Since we can't do this while\n- // the app is closed, we rely on the rescind notif in that case.\n- dispatch({\n- type: recordAndroidNotificationActionType,\n- payload: { threadID, notifID: id },\n- });\n}\nasync function androidBackgroundMessageTask(message: RemoteMessage) {\n"
},
{
"change_type": "DELETE",
"old_path": "native/push/reducer.js",
"new_path": null,
"diff": "-// @flow\n-\n-import {\n- logOutActionTypes,\n- deleteAccountActionTypes,\n-} from 'lib/actions/user-actions';\n-import { setNewSessionActionType } from 'lib/utils/action-utils';\n-\n-import {\n- recordAndroidNotificationActionType,\n- clearAndroidNotificationsActionType,\n- rescindAndroidNotificationActionType,\n- type Action,\n-} from '../redux/action-types';\n-\n-type RecordAndroidNotificationPayload = {\n- +threadID: string,\n- +notifID: string,\n-};\n-\n-type ClearAndroidNotificationsPayload = {\n- +threadID: string,\n-};\n-\n-type RescindAndroidNotificationPayload = {\n- +notifID: string,\n- +threadID: string,\n-};\n-\n-export type AndroidNotificationActions =\n- | {\n- +type: 'RECORD_ANDROID_NOTIFICATION',\n- +payload: RecordAndroidNotificationPayload,\n- }\n- | {\n- +type: 'CLEAR_ANDROID_NOTIFICATIONS',\n- +payload: ClearAndroidNotificationsPayload,\n- }\n- | {\n- +type: 'RESCIND_ANDROID_NOTIFICATION',\n- +payload: RescindAndroidNotificationPayload,\n- };\n-\n-function reduceThreadIDsToNotifIDs(\n- state: { [threadID: string]: string[] },\n- action: Action,\n-): { [threadID: string]: string[] } {\n- if (action.type === recordAndroidNotificationActionType) {\n- const existingNotifIDs = state[action.payload.threadID];\n- let set;\n- if (existingNotifIDs) {\n- set = new Set([...existingNotifIDs, action.payload.notifID]);\n- } else {\n- set = new Set([action.payload.notifID]);\n- }\n- return {\n- ...state,\n- [action.payload.threadID]: [...set],\n- };\n- } else if (action.type === clearAndroidNotificationsActionType) {\n- if (!state[action.payload.threadID]) {\n- return state;\n- }\n- return {\n- ...state,\n- [action.payload.threadID]: [],\n- };\n- } else if (action.type === rescindAndroidNotificationActionType) {\n- const { threadID, notifID } = action.payload;\n- const existingNotifIDs = state[threadID];\n- if (!existingNotifIDs) {\n- return state;\n- }\n- const filtered = existingNotifIDs.filter(id => id !== notifID);\n- if (filtered.length === existingNotifIDs.length) {\n- return state;\n- }\n- return { ...state, [threadID]: filtered };\n- } else if (\n- action.type === logOutActionTypes.success ||\n- action.type === deleteAccountActionTypes.success ||\n- (action.type === setNewSessionActionType &&\n- action.payload.sessionChange.cookieInvalidated)\n- ) {\n- return {};\n- } else {\n- return state;\n- }\n-}\n-\n-export { reduceThreadIDsToNotifIDs };\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/action-types.js",
"new_path": "native/redux/action-types.js",
"diff": "@@ -6,7 +6,6 @@ import { saveMessagesActionType } from 'lib/actions/message-actions';\nimport type { Shape } from 'lib/types/core';\nimport type { BaseAction } from 'lib/types/redux-types';\n-import type { AndroidNotificationActions } from '../push/reducer';\nimport type { DeviceCameraInfo } from '../types/camera';\nimport type { ConnectivityInfo } from '../types/connectivity';\nimport type { GlobalThemeInfo } from '../types/themes';\n@@ -16,12 +15,6 @@ import type { AppState } from './state-types';\nexport const resetUserStateActionType = 'RESET_USER_STATE';\nexport const recordNotifPermissionAlertActionType =\n'RECORD_NOTIF_PERMISSION_ALERT';\n-export const recordAndroidNotificationActionType =\n- 'RECORD_ANDROID_NOTIFICATION';\n-export const clearAndroidNotificationsActionType =\n- 'CLEAR_ANDROID_NOTIFICATIONS';\n-export const rescindAndroidNotificationActionType =\n- 'RESCIND_ANDROID_NOTIFICATION';\nexport const updateDimensionsActiveType = 'UPDATE_DIMENSIONS';\nexport const updateConnectivityActiveType = 'UPDATE_CONNECTIVITY';\nexport const updateThemeInfoActionType = 'UPDATE_THEME_INFO';\n@@ -34,13 +27,10 @@ export const setReduxStateActionType = 'SET_REDUX_STATE';\nexport const backgroundActionTypes: Set<string> = new Set([\nsaveMessagesActionType,\n- recordAndroidNotificationActionType,\n- rescindAndroidNotificationActionType,\n]);\nexport type Action =\n| BaseAction\n- | AndroidNotificationActions\n| {\n+type: 'SET_REDUX_STATE',\n+payload: { +state: AppState, +hideFromMonitor: boolean },\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/persist.js",
"new_path": "native/redux/persist.js",
"diff": "@@ -58,7 +58,6 @@ const migrations = {\ndeviceToken: state.deviceToken,\nurlPrefix: state.urlPrefix,\ncustomServer: state.customServer,\n- threadIDsToNotifIDs: state.threadIDsToNotifIDs,\nnotifPermissionAlertInfo: state.notifPermissionAlertInfo,\nmessageSentFromRoute: state.messageSentFromRoute,\n_persist: state._persist,\n@@ -467,6 +466,10 @@ const migrations = {\nreturn state;\n},\n+ [34]: state => {\n+ const { threadIDsToNotifIDs, ...stateSansThreadIDsToNotifIDs } = state;\n+ return stateSansThreadIDsToNotifIDs;\n+ },\n};\n// After migration 31, we'll no longer want to persist `messageStore.messages`\n@@ -547,7 +550,7 @@ const persistConfig = {\n'storeLoaded',\n],\ndebug: __DEV__,\n- version: 33,\n+ version: 34,\ntransforms: [messageStoreMessagesBlocklistTransform],\nmigrate: (createMigrate(migrations, { debug: __DEV__ }): any),\ntimeout: ((__DEV__ ? 0 : undefined): number | void),\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/redux-setup.js",
"new_path": "native/redux/redux-setup.js",
"diff": "@@ -43,7 +43,6 @@ import { defaultNavInfo } from '../navigation/default-state';\nimport { getGlobalNavContext } from '../navigation/icky-global';\nimport { activeMessageListSelector } from '../navigation/nav-selectors';\nimport { defaultNotifPermissionAlertInfo } from '../push/alerts';\n-import { reduceThreadIDsToNotifIDs } from '../push/reducer';\nimport reactotron from '../reactotron';\nimport { defaultDeviceCameraInfo } from '../types/camera';\nimport { defaultConnectivityInfo } from '../types/connectivity';\n@@ -59,9 +58,6 @@ import {\nimport {\nresetUserStateActionType,\nrecordNotifPermissionAlertActionType,\n- recordAndroidNotificationActionType,\n- clearAndroidNotificationsActionType,\n- rescindAndroidNotificationActionType,\nupdateDimensionsActiveType,\nupdateConnectivityActiveType,\nupdateThemeInfoActionType,\n@@ -109,7 +105,6 @@ const defaultState = ({\ndataLoaded: false,\nurlPrefix: defaultURLPrefix,\ncustomServer: natNodeServer,\n- threadIDsToNotifIDs: {},\nnotifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\nconnection: defaultConnectionInfo(Platform.OS),\nwatchedThreadIDs: [],\n@@ -227,19 +222,6 @@ function reducer(state: AppState = defaultState, action: Action) {\nreturn state;\n}\n- const threadIDsToNotifIDs = reduceThreadIDsToNotifIDs(\n- state.threadIDsToNotifIDs,\n- action,\n- );\n- state = { ...state, threadIDsToNotifIDs };\n- if (\n- action.type === recordAndroidNotificationActionType ||\n- action.type === clearAndroidNotificationsActionType ||\n- action.type === rescindAndroidNotificationActionType\n- ) {\n- return state;\n- }\n-\nif (action.type === setCustomServer) {\nreturn {\n...state,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/state-types.js",
"new_path": "native/redux/state-types.js",
"diff": "@@ -40,7 +40,6 @@ export type AppState = {\ndataLoaded: boolean,\nurlPrefix: string,\ncustomServer: ?string,\n- threadIDsToNotifIDs: { [threadID: string]: string[] },\nnotifPermissionAlertInfo: NotifPermissionAlertInfo,\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Remove threadID to notifID mapping from redux and all related usages
Summary: This differential removes threadID to NotifID mapping from redux on native.
Test Plan: Test plan for previous differential + ensure flow does not complain.
Reviewers: tomek, atul, ashoat
Reviewed By: tomek, ashoat
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D6229 |
129,187 | 28.01.2023 20:53:37 | 18,000 | f48a3d5afa1187f40191b2d37e3d3d05533bd898 | [web] Fetch ENS names in SubchannelMembersList
Test Plan: | {F349437} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/create/steps/subchannel-members-list.react.js",
"new_path": "web/modals/threads/create/steps/subchannel-members-list.react.js",
"diff": "import * as React from 'react';\nimport { useSelector } from 'react-redux';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { stringForUser } from 'lib/shared/user-utils';\nimport type { ThreadInfo } from 'lib/types/thread-types';\n+import type { UserListItem } from 'lib/types/user-types';\nimport AddMembersList from '../../../components/add-members-list.react';\n@@ -17,7 +19,7 @@ type Props = {\n+toggleUserSelection: (userID: string) => void,\n};\n-function Memberlist(props: Props): React.Node {\n+function SubchannelMembersList(props: Props): React.Node {\nconst {\nsearchText,\nsearchResult,\n@@ -41,7 +43,7 @@ function Memberlist(props: Props): React.Node {\n[parentThreadInfo],\n);\n- const parentMemberList = React.useMemo(\n+ const parentMemberListWithoutENSNames = React.useMemo(\n() =>\nparentMembers\n.filter(\n@@ -53,8 +55,11 @@ function Memberlist(props: Props): React.Node {\n[parentMembers, currentUserId, searchResult, searchText],\n);\n+ const parentMemberList = useENSNames<UserListItem>(\n+ parentMemberListWithoutENSNames,\n+ );\n- const otherMemberList = React.useMemo(\n+ const otherMemberListWithoutENSNames = React.useMemo(\n() =>\ncommunityMembers\n.filter(\n@@ -72,6 +77,9 @@ function Memberlist(props: Props): React.Node {\nsearchText,\n],\n);\n+ const otherMemberList = useENSNames<UserListItem>(\n+ otherMemberListWithoutENSNames,\n+ );\nconst sortedGroupedUserList = React.useMemo(\n() =>\n@@ -94,4 +102,4 @@ function Memberlist(props: Props): React.Node {\n);\n}\n-export default Memberlist;\n+export default SubchannelMembersList;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fetch ENS names in SubchannelMembersList
Test Plan: | {F349437} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6437 |
129,187 | 29.01.2023 11:12:31 | 18,000 | 98bd8e9cd0c47e022382341716572fb3bd1351ff | [web] Fetch ENS names in MembersList
Test Plan: | {F349808} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/members/members-list.react.js",
"new_path": "web/modals/threads/members/members-list.react.js",
"diff": "@@ -5,6 +5,7 @@ import _groupBy from 'lodash/fp/groupBy';\nimport _toPairs from 'lodash/fp/toPairs';\nimport * as React from 'react';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { stringForUser } from 'lib/shared/user-utils';\nimport {\ntype ThreadInfo,\n@@ -24,10 +25,14 @@ function ThreadMembersList(props: Props): React.Node {\nconst [openMenu, setOpenMenu] = React.useState(null);\nconst hasMembers = threadMembers.length > 0;\n+ const threadMembersWithENSNames = useENSNames(threadMembers);\n+\nconst groupedByFirstLetterMembers = React.useMemo(\n() =>\n- _groupBy(member => stringForUser(member)[0].toLowerCase())(threadMembers),\n- [threadMembers],\n+ _groupBy(member => stringForUser(member)[0].toLowerCase())(\n+ threadMembersWithENSNames,\n+ ),\n+ [threadMembersWithENSNames],\n);\nconst groupedMembersList = React.useMemo(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fetch ENS names in MembersList
Test Plan: | {F349808} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6438 |
129,187 | 29.01.2023 12:35:39 | 18,000 | 38fbf5bf57adb712957a4432a20b90b95b7f6b3f | [native] Show ENS names in ComposeSubchannel
Summary: Depends on D6439
Test Plan: | {F349896} | {F349897} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/chat/compose-subchannel.react.js",
"new_path": "native/chat/compose-subchannel.react.js",
"diff": "@@ -8,6 +8,7 @@ import * as React from 'react';\nimport { View, Text, Alert } from 'react-native';\nimport { newThreadActionTypes, newThread } from 'lib/actions/thread-actions';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport {\nuserInfoSelectorForPotentialMembers,\n@@ -292,6 +293,8 @@ function ComposeSubchannel(props: Props): React.Node {\n}),\n[onPressCreateThread],\n);\n+ const userSearchResultWithENSNames = useENSNames(userSearchResults);\n+ const userInfoInputArrayWithENSNames = useENSNames(userInfoInputArray);\nreturn (\n<View style={styles.container}>\n<ParentThreadHeader\n@@ -302,7 +305,7 @@ function ComposeSubchannel(props: Props): React.Node {\n<Text style={styles.tagInputLabel}>To: </Text>\n<View style={styles.tagInputContainer}>\n<TagInput\n- value={userInfoInputArray}\n+ value={userInfoInputArrayWithENSNames}\nonChange={setUserInfoInputArray}\ntext={usernameInputText}\nonChangeText={setUsernameInputText}\n@@ -314,7 +317,7 @@ function ComposeSubchannel(props: Props): React.Node {\n</View>\n<View style={styles.userList}>\n<UserList\n- userInfos={userSearchResults}\n+ userInfos={userSearchResultWithENSNames}\nonSelect={onUserSelect}\nitemTextStyle={styles.listItem}\n/>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Show ENS names in ComposeSubchannel
Summary: Depends on D6439
Test Plan: | {F349896} | {F349897} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6440 |
129,187 | 29.01.2023 17:10:47 | 18,000 | 6d88dac34ec7903f88eeaa1d0a5dd358ac2f0618 | [native] Show ENS names in AddUsersModal
Summary: Depends on D6441
Test Plan: | {F350110} | {F350111} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/add-users-modal.react.js",
"new_path": "native/chat/settings/add-users-modal.react.js",
"diff": "@@ -8,6 +8,7 @@ import {\nchangeThreadSettingsActionTypes,\nchangeThreadSettings,\n} from 'lib/actions/thread-actions';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport {\n@@ -234,10 +235,12 @@ function AddUsersModal(props: Props): React.Node {\n}),\n[onPressAdd],\n);\n+ const userSearchResultWithENSNames = useENSNames(userSearchResults);\n+ const userInfoInputArrayWithENSNames = useENSNames(userInfoInputArray);\nreturn (\n<Modal>\n<TagInput\n- value={userInfoInputArray}\n+ value={userInfoInputArrayWithENSNames}\nonChange={onChangeTagInput}\ntext={usernameInputText}\nonChangeText={onChangeTagInputText}\n@@ -247,7 +250,10 @@ function AddUsersModal(props: Props): React.Node {\ninputProps={inputProps}\nref={tagInputRef}\n/>\n- <UserList userInfos={userSearchResults} onSelect={onUserSelect} />\n+ <UserList\n+ userInfos={userSearchResultWithENSNames}\n+ onSelect={onUserSelect}\n+ />\n<View style={styles.buttons}>\n{cancelButton}\n{addButton}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Show ENS names in AddUsersModal
Summary: Depends on D6441
Test Plan: | {F350110} | {F350111} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6442 |
129,187 | 29.01.2023 17:22:06 | 18,000 | 65b1df0644e213bc2c8be6fe89ac7e2ec8ab13d3 | [native] Show ENS names in MessageListThreadSearch
Summary: Thank God this one was already a hook...
Test Plan: | {F350149} | {F350150} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "native/chat/message-list-thread-search.react.js",
"new_path": "native/chat/message-list-thread-search.react.js",
"diff": "import * as React from 'react';\nimport { Text, View } from 'react-native';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { notFriendNotice } from 'lib/shared/search-utils';\nimport type { AccountUserInfo, UserListItem } from 'lib/types/user-types';\n@@ -97,16 +98,21 @@ const MessageListThreadSearch: React.ComponentType<Props> = React.memo<Props>(\nlet separator = null;\nlet userList = null;\nlet userSelectionAdditionalStyles = styles.userSelectionLimitedHeight;\n+ const userListItemsWithENSNames = useENSNames(userListItems);\nif (isSearchResultVisible) {\nuserList = (\n<View style={styles.userList}>\n- <UserList userInfos={userListItems} onSelect={onUserSelect} />\n+ <UserList\n+ userInfos={userListItemsWithENSNames}\n+ onSelect={onUserSelect}\n+ />\n</View>\n);\nseparator = <View style={styles.separator} />;\nuserSelectionAdditionalStyles = null;\n}\n+ const userInfoInputArrayWithENSNames = useENSNames(userInfoInputArray);\nreturn (\n<>\n<View style={[styles.userSelection, userSelectionAdditionalStyles]}>\n@@ -114,7 +120,7 @@ const MessageListThreadSearch: React.ComponentType<Props> = React.memo<Props>(\n<Text style={styles.tagInputLabel}>To: </Text>\n<View style={styles.tagInput}>\n<TagInput\n- value={userInfoInputArray}\n+ value={userInfoInputArrayWithENSNames}\nonChange={updateTagInput}\ntext={usernameInputText}\nonChangeText={updateUsernameInput}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Show ENS names in MessageListThreadSearch
Summary: Thank God this one was already a hook...
Test Plan: | {F350149} | {F350150} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6443 |
129,187 | 29.01.2023 18:24:14 | 18,000 | e2f102581b9eb37633e774508ddf4a027f4d1e20 | [web] Fetch ENS names in ChatThreadComposer
Test Plan: | {F350487} | {F350488} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-thread-composer.react.js",
"new_path": "web/chat/chat-thread-composer.react.js",
"diff": "@@ -3,6 +3,7 @@ import classNames from 'classnames';\nimport * as React from 'react';\nimport { useDispatch } from 'react-redux';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { userSearchIndexForPotentialMembers } from 'lib/selectors/user-selectors';\nimport { getPotentialMemberItems } from 'lib/shared/search-utils';\nimport { threadIsPending } from 'lib/shared/thread-utils';\n@@ -51,6 +52,7 @@ function ChatThreadComposer(props: Props): React.Node {\n),\n[usernameInputText, otherUserInfos, userSearchIndex, userInfoInputIDs],\n);\n+ const userListItemsWithENSNames = useENSNames(userListItems);\nconst onSelectUserFromSearch = React.useCallback(\n(id: string) => {\n@@ -84,7 +86,7 @@ function ChatThreadComposer(props: Props): React.Node {\nconst userSearchResultList = React.useMemo(() => {\nif (\n- !userListItems.length ||\n+ !userListItemsWithENSNames.length ||\n(!usernameInputText && userInfoInputArray.length)\n) {\nreturn null;\n@@ -92,7 +94,7 @@ function ChatThreadComposer(props: Props): React.Node {\nreturn (\n<ul className={css.searchResultsContainer}>\n- {userListItems.map((userSearchResult: UserListItem) => (\n+ {userListItemsWithENSNames.map((userSearchResult: UserListItem) => (\n<li key={userSearchResult.id} className={css.searchResultsItem}>\n<Button\nvariant=\"text\"\n@@ -109,7 +111,7 @@ function ChatThreadComposer(props: Props): React.Node {\n}, [\nonSelectUserFromSearch,\nuserInfoInputArray.length,\n- userListItems,\n+ userListItemsWithENSNames,\nusernameInputText,\n]);\n@@ -134,11 +136,12 @@ function ChatThreadComposer(props: Props): React.Node {\nhideSearch('reset-active-thread-if-pending');\n}, [hideSearch]);\n+ const userInfoInputArrayWithENSNames = useENSNames(userInfoInputArray);\nconst tagsList = React.useMemo(() => {\n- if (!userInfoInputArray?.length) {\n+ if (!userInfoInputArrayWithENSNames?.length) {\nreturn null;\n}\n- const labels = userInfoInputArray.map(user => {\n+ const labels = userInfoInputArrayWithENSNames.map(user => {\nreturn (\n<Label key={user.id} onClose={() => onRemoveUserFromSelected(user.id)}>\n{user.username}\n@@ -146,7 +149,7 @@ function ChatThreadComposer(props: Props): React.Node {\n);\n});\nreturn <div className={css.userSelectedTags}>{labels}</div>;\n- }, [userInfoInputArray, onRemoveUserFromSelected]);\n+ }, [userInfoInputArrayWithENSNames, onRemoveUserFromSelected]);\nReact.useEffect(() => {\nif (!inputState) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fetch ENS names in ChatThreadComposer
Test Plan: | {F350487} | {F350488} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6449 |
129,187 | 29.01.2023 18:32:46 | 18,000 | ffcd7a1632183d336ddf2a1573cd7a1753a55c72 | [web] Fetch ENS names in AddMembersModal
Test Plan: | {F350514} | {F350515} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/members/add-members-modal.react.js",
"new_path": "web/modals/threads/members/add-members-modal.react.js",
"diff": "@@ -6,6 +6,7 @@ import {\nchangeThreadSettingsActionTypes,\nchangeThreadSettings,\n} from 'lib/actions/thread-actions';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport {\nuserSearchIndexForPotentialMembers,\n@@ -77,6 +78,7 @@ function AddMembersModalContent(props: ContentProps): React.Node {\nuserSearchIndex,\n],\n);\n+ const userSearchResultsWithENSNames = useENSNames(userSearchResults);\nconst onSwitchUser = React.useCallback(\nuserID =>\n@@ -112,35 +114,39 @@ function AddMembersModalContent(props: ContentProps): React.Node {\nthreadID,\n]);\n- const pendingUsersWithNames = React.useMemo(\n+ const pendingUserInfos = React.useMemo(\n() =>\nArray.from(pendingUsersToAdd)\n- .map(userID => [userID, otherUserInfos[userID].username])\n- .sort((a, b) => a[1].localeCompare(b[1])),\n+ .map(userID => ({\n+ id: userID,\n+ username: otherUserInfos[userID].username,\n+ }))\n+ .sort((a, b) => a.username.localeCompare(b.username)),\n[otherUserInfos, pendingUsersToAdd],\n);\n+ const pendingUserInfosWithENSNames = useENSNames(pendingUserInfos);\nconst labelItems = React.useMemo(() => {\n- if (!pendingUsersWithNames.length) {\n+ if (!pendingUserInfosWithENSNames.length) {\nreturn null;\n}\nreturn (\n<div className={css.addMembersPendingList}>\n- {pendingUsersWithNames.map(([userID, username]) => (\n- <Label key={userID} onClose={() => onSwitchUser(userID)}>\n- {username}\n+ {pendingUserInfosWithENSNames.map(userInfo => (\n+ <Label key={userInfo.id} onClose={() => onSwitchUser(userInfo.id)}>\n+ {userInfo.username}\n</Label>\n))}\n</div>\n);\n- }, [onSwitchUser, pendingUsersWithNames]);\n+ }, [onSwitchUser, pendingUserInfosWithENSNames]);\nreturn (\n<div className={css.addMembersContent}>\n{labelItems}\n<div className={css.addMembersListContainer}>\n<AddMembersListContent\n- userListItems={userSearchResults}\n+ userListItems={userSearchResultsWithENSNames}\nswitchUser={onSwitchUser}\npendingUsersToAdd={pendingUsersToAdd}\nhasParentThread={!!threadInfo.parentThreadID}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fetch ENS names in AddMembersModal
Test Plan: | {F350514} | {F350515} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6450 |
129,184 | 30.01.2023 13:37:17 | 18,000 | 932d057e9d68a583e6baa26808a398d5eba42d54 | [lib] Introduce `reducePrimaryIdentityPublicKey` reducer
Summary:
Introduce `setPrimaryIdentityPublicKey` action type and `reducePrimaryIdentityPublicKey` reducer.
`setPrimaryIdentityPublicKey` action will be dispatched in subsequent diffs to properly set the `primaryIdentityPublicKey`.
Depends on D6433
Test Plan: Will be tested by subsequent diffs/flow
Reviewers: ashoat, tomek | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/redux/primary-identity-public-key-reducer.js",
"diff": "+// @flow\n+\n+import {\n+ logOutActionTypes,\n+ deleteAccountActionTypes,\n+} from 'lib/actions/user-actions';\n+import { setNewSessionActionType } from 'lib/utils/action-utils.js';\n+\n+import type { Action } from './redux-setup.js';\n+\n+const setPrimaryIdentityPublicKey = 'SET_PRIMARY_IDENTITY_PUBLIC_KEY';\n+function reducePrimaryIdentityPublicKey(\n+ state: ?string,\n+ action: Action,\n+): ?string {\n+ if (action.type === setPrimaryIdentityPublicKey) {\n+ return action.payload;\n+ } else if (\n+ action.type === logOutActionTypes.success ||\n+ action.type === deleteAccountActionTypes.success ||\n+ (action.type === setNewSessionActionType &&\n+ action.payload.sessionChange.cookieInvalidated)\n+ ) {\n+ return null;\n+ }\n+ return state;\n+}\n+\n+export { setPrimaryIdentityPublicKey, reducePrimaryIdentityPublicKey };\n"
},
{
"change_type": "MODIFY",
"old_path": "web/redux/redux-setup.js",
"new_path": "web/redux/redux-setup.js",
"diff": "@@ -37,6 +37,10 @@ import {\n} from './action-types';\nimport { reduceDeviceID } from './device-id-reducer';\nimport reduceNavInfo from './nav-reducer';\n+import {\n+ reducePrimaryIdentityPublicKey,\n+ setPrimaryIdentityPublicKey,\n+} from './primary-identity-public-key-reducer';\nimport { getVisibility } from './visibility';\nexport type WindowDimensions = { width: number, height: number };\n@@ -85,7 +89,8 @@ export type Action =\n| {\ntype: 'SET_DEVICE_ID',\npayload: string,\n- };\n+ }\n+ | { +type: 'SET_PRIMARY_IDENTITY_PUBLIC_KEY', payload: ?string };\nexport function reducer(oldState: AppState | void, action: Action): AppState {\ninvariant(oldState, 'should be set');\n@@ -134,7 +139,8 @@ export function reducer(oldState: AppState | void, action: Action): AppState {\nif (\naction.type !== updateNavInfoActionType &&\n- action.type !== setDeviceIDActionType\n+ action.type !== setDeviceIDActionType &&\n+ action.type !== setPrimaryIdentityPublicKey\n) {\nstate = baseReducer(state, action).state;\n}\n@@ -147,6 +153,10 @@ export function reducer(oldState: AppState | void, action: Action): AppState {\nstate.threadStore.threadInfos,\n),\ndeviceID: reduceDeviceID(state.deviceID, action),\n+ primaryIdentityPublicKey: reducePrimaryIdentityPublicKey(\n+ state.primaryIdentityPublicKey,\n+ action,\n+ ),\n};\nreturn validateState(oldState, state);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce `reducePrimaryIdentityPublicKey` reducer
Summary:
Introduce `setPrimaryIdentityPublicKey` action type and `reducePrimaryIdentityPublicKey` reducer.
`setPrimaryIdentityPublicKey` action will be dispatched in subsequent diffs to properly set the `primaryIdentityPublicKey`.
---
Depends on D6433
Test Plan: Will be tested by subsequent diffs/flow
Reviewers: ashoat, tomek
Reviewed By: ashoat, tomek
Differential Revision: https://phab.comm.dev/D6434 |
129,184 | 30.01.2023 16:17:38 | 18,000 | b18d7b64905348d084584b2d58f44986934dd784 | [native] `codeVersion` -> 179 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 177\n- versionName '1.0.177'\n+ versionCode 179\n+ versionName '1.0.179'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{177};\n+ const int codeVersion{179};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 177;\n+ CURRENT_PROJECT_VERSION = 179;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.177;\n+ MARKETING_VERSION = 1.0.179;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 177;\n+ CURRENT_PROJECT_VERSION = 179;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.177;\n+ MARKETING_VERSION = 1.0.179;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.177</string>\n+ <string>1.0.179</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>177</string>\n+ <string>179</string>\n<key>CFBundleURLTypes</key>\n<array>\n<dict>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.177</string>\n+ <string>1.0.179</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>177</string>\n+ <string>179</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 179 |
129,184 | 30.01.2023 16:20:53 | 18,000 | 7bad24d6d5ad678c53570a301987b109543a5634 | [native] `codeVersion` -> 180 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 179\n- versionName '1.0.179'\n+ versionCode 180\n+ versionName '1.0.180'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{179};\n+ const int codeVersion{180};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 179;\n+ CURRENT_PROJECT_VERSION = 180;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.179;\n+ MARKETING_VERSION = 1.0.180;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 179;\n+ CURRENT_PROJECT_VERSION = 180;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.179;\n+ MARKETING_VERSION = 1.0.180;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.179</string>\n+ <string>1.0.180</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>179</string>\n+ <string>180</string>\n<key>CFBundleURLTypes</key>\n<array>\n<dict>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.179</string>\n+ <string>1.0.180</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>179</string>\n+ <string>180</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 180 |
129,205 | 25.01.2023 09:59:56 | -3,600 | a7374be8b830c89e1dad63426c88520d5fb55803 | [backup-service] Add blob client init function
Summary:
Part of
Created a function that initializes a blob client instance. The connection is lazy-initialized so it won't be established until first use.
Depends on D6383
Test Plan: Backup service compiles.
Reviewers: varun, jon, michal, tomek
Subscribers: ashoat, atul | [
{
"change_type": "MODIFY",
"old_path": "services/backup/src/blob/mod.rs",
"new_path": "services/backup/src/blob/mod.rs",
"diff": "mod proto {\ntonic::include_proto!(\"blob\");\n}\n+use proto::blob_service_client::BlobServiceClient;\npub use proto::put_request::Data as PutRequestData;\npub use proto::{PutRequest, PutResponse};\n@@ -8,3 +9,14 @@ mod downloader;\nmod uploader;\npub use downloader::*;\npub use uploader::*;\n+\n+pub type BlobClient = BlobServiceClient<tonic::transport::Channel>;\n+\n+/// Creates a new Blob service client instance. It does not attempt to connect\n+/// to the service until first use.\n+pub fn init_blob_client() -> BlobClient {\n+ let service_url = &crate::CONFIG.blob_service_url;\n+ let channel =\n+ tonic::transport::Channel::from_static(service_url).connect_lazy();\n+ BlobServiceClient::new(channel)\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [backup-service] Add blob client init function
Summary:
Part of https://linear.app/comm/issue/ENG-2688/backup-service-reuse-single-blob-client-instance
Created a function that initializes a blob client instance. The connection is lazy-initialized so it won't be established until first use.
Depends on D6383
Test Plan: Backup service compiles.
Reviewers: varun, jon, michal, tomek
Reviewed By: tomek
Subscribers: ashoat, atul
Differential Revision: https://phab.comm.dev/D6384 |
129,187 | 30.01.2023 16:04:29 | 18,000 | 4c635a2108bdd040376cd6aa7b3dd6cb39f8873c | [web] Show ENS names in ThreadSettingsRelationshipTab
Test Plan:
I used [this patch](https://gist.github.com/Ashoat/d53bd37b7273370a81e0428bbb0e34ef) to get ENS to work in my dev environment
| {F352785} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/settings/thread-settings-relationship-tab.react.js",
"new_path": "web/modals/threads/settings/thread-settings-relationship-tab.react.js",
"diff": "import * as React from 'react';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { type SetState } from 'lib/types/hook-types';\nimport { type RelationshipButton } from 'lib/types/relationship-types';\nimport type { UserInfo } from 'lib/types/user-types';\n@@ -17,17 +18,18 @@ type Props = {\nfunction ThreadSettingsRelationshipTab(props: Props): React.Node {\nconst { relationshipButtons, otherUserInfo, setErrorMessage } = props;\n+ const [otherUserInfoWithENSName] = useENSNames([otherUserInfo]);\nconst buttons = React.useMemo(\n() =>\nrelationshipButtons.map(action => (\n<ThreadSettingsRelationshipButton\nkey={action}\nrelationshipButton={action}\n- otherUserInfo={otherUserInfo}\n+ otherUserInfo={otherUserInfoWithENSName}\nsetErrorMessage={setErrorMessage}\n/>\n)),\n- [otherUserInfo, relationshipButtons, setErrorMessage],\n+ [otherUserInfoWithENSName, relationshipButtons, setErrorMessage],\n);\nreturn <div className={css.container}>{buttons}</div>;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Show ENS names in ThreadSettingsRelationshipTab
Test Plan:
I used [this patch](https://gist.github.com/Ashoat/d53bd37b7273370a81e0428bbb0e34ef) to get ENS to work in my dev environment
| {F352785} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6472 |
129,187 | 30.01.2023 16:28:59 | 18,000 | 7d07bbbff04d3ca6873e1ff5092906975a69b9db | [web] Show ENS names for HistoryEntry
Summary: I went ahead and changed `EntryInfo.creator` for this diff. It's a client-only type that's only touched in `web`.
Test Plan:
I used [this patch](https://gist.github.com/Ashoat/d53bd37b7273370a81e0428bbb0e34ef) to get ENS to work in my dev environment
| {F352835} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/entry-utils.js",
"new_path": "lib/shared/entry-utils.js",
"diff": "@@ -48,7 +48,7 @@ function createEntryInfo(\nmonth: rawEntryInfo.month,\nday: rawEntryInfo.day,\ncreationTime: rawEntryInfo.creationTime,\n- creator: creatorInfo && creatorInfo.username,\n+ creator: creatorInfo,\ndeleted: rawEntryInfo.deleted,\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/entry-types.js",
"new_path": "lib/types/entry-types.js",
"diff": "@@ -12,7 +12,7 @@ import type {\nServerCreateUpdatesResponse,\nClientCreateUpdatesResponse,\n} from './update-types';\n-import type { AccountUserInfo } from './user-types';\n+import type { UserInfo, AccountUserInfo } from './user-types';\nexport type RawEntryInfo = {\nid?: string, // null if local copy without ID yet\n@@ -36,7 +36,7 @@ export type EntryInfo = {\nmonth: number, // 1-indexed\nday: number, // 1-indexed\ncreationTime: number, // millisecond timestamp\n- creator: ?string,\n+ creator: ?UserInfo,\ndeleted: boolean,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/history/history-entry.react.js",
"new_path": "web/modals/history/history-entry.react.js",
"diff": "@@ -8,6 +8,7 @@ import {\nrestoreEntryActionTypes,\nrestoreEntry,\n} from 'lib/actions/entry-actions';\n+import { useENSNames } from 'lib/hooks/ens-cache';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport { colorIsDark } from 'lib/shared/thread-utils';\n@@ -19,6 +20,7 @@ import {\n} from 'lib/types/entry-types';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { ThreadInfo } from 'lib/types/thread-types';\n+import type { UserInfo } from 'lib/types/user-types';\nimport {\ntype DispatchActionPromise,\nuseDispatchActionPromise,\n@@ -43,6 +45,7 @@ type Props = {\n+calendarQuery: () => CalendarQuery,\n+dispatchActionPromise: DispatchActionPromise,\n+restoreEntry: (info: RestoreEntryInfo) => Promise<RestoreEntryResult>,\n+ +creator: ?UserInfo,\n};\nclass HistoryEntry extends React.PureComponent<Props> {\n@@ -82,13 +85,10 @@ class HistoryEntry extends React.PureComponent<Props> {\n[css.darkEntry]: colorIsDark(this.props.threadInfo.color),\n});\nconst textStyle = { backgroundColor: '#' + this.props.threadInfo.color };\n- const creator =\n- this.props.entryInfo.creator === null ? (\n- 'Anonymous'\n+ const creator = this.props.creator?.username ? (\n+ <span className={css.entryUsername}>{this.props.creator.username}</span>\n) : (\n- <span className={css.entryUsername}>\n- {this.props.entryInfo.creator}\n- </span>\n+ 'anonymous'\n);\nreturn (\n@@ -162,19 +162,23 @@ const ConnectedHistoryEntry: React.ComponentType<BaseProps> = React.memo<BasePro\n`${restoreEntryActionTypes.started}:${entryID}`,\n),\n);\n- const calanderQuery = useSelector(nonThreadCalendarQuery);\n+ const calenderQuery = useSelector(nonThreadCalendarQuery);\nconst callRestoreEntry = useServerCall(restoreEntry);\nconst dispatchActionPromise = useDispatchActionPromise();\n+ const { creator } = props.entryInfo;\n+ const [creatorWithENSName] = useENSNames([creator]);\n+\nreturn (\n<HistoryEntry\n{...props}\nthreadInfo={threadInfo}\nloggedIn={loggedIn}\nrestoreLoadingStatus={restoreLoadingStatus}\n- calendarQuery={calanderQuery}\n- restoreEntry={callRestoreEntry}\n+ calendarQuery={calenderQuery}\ndispatchActionPromise={dispatchActionPromise}\n+ restoreEntry={callRestoreEntry}\n+ creator={creatorWithENSName}\n/>\n);\n},\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Show ENS names for HistoryEntry
Summary: I went ahead and changed `EntryInfo.creator` for this diff. It's a client-only type that's only touched in `web`.
Test Plan:
I used [this patch](https://gist.github.com/Ashoat/d53bd37b7273370a81e0428bbb0e34ef) to get ENS to work in my dev environment
| {F352835} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6473 |
129,184 | 31.01.2023 12:05:35 | 18,000 | b542be5d4b3bf082bd6b2dcbc0d64da5e3853dfc | [native] `codeVersion` -> 181 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 180\n- versionName '1.0.180'\n+ versionCode 181\n+ versionName '1.0.181'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{180};\n+ const int codeVersion{181};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 180;\n+ CURRENT_PROJECT_VERSION = 181;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.180;\n+ MARKETING_VERSION = 1.0.181;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 180;\n+ CURRENT_PROJECT_VERSION = 181;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.180;\n+ MARKETING_VERSION = 1.0.181;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.180</string>\n+ <string>1.0.181</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>180</string>\n+ <string>181</string>\n<key>CFBundleURLTypes</key>\n<array>\n<dict>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.180</string>\n+ <string>1.0.181</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>180</string>\n+ <string>181</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 181 |
129,184 | 31.01.2023 12:28:35 | 18,000 | 6470d810047cec2dc70c23409158ded6eeabdc68 | [native] `codeVersion` -> 182 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 181\n- versionName '1.0.181'\n+ versionCode 182\n+ versionName '1.0.182'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{181};\n+ const int codeVersion{182};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 181;\n+ CURRENT_PROJECT_VERSION = 182;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.181;\n+ MARKETING_VERSION = 1.0.182;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 181;\n+ CURRENT_PROJECT_VERSION = 182;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.181;\n+ MARKETING_VERSION = 1.0.182;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.181</string>\n+ <string>1.0.182</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>181</string>\n+ <string>182</string>\n<key>CFBundleURLTypes</key>\n<array>\n<dict>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.181</string>\n+ <string>1.0.182</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>181</string>\n+ <string>182</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 182 |
129,187 | 30.01.2023 17:47:05 | 18,000 | 472a155c66203ed4552a2ce515ba5b52b8d2923a | [lib] Introduce useThreadSearchIndex hook
Summary:
Converting this to a hook will make it easier to swap in ENS names.
Depends on D6476
Test Plan:
Tested the two surfaces that currently use `useSearchThreads`: `SidebarListModal` and `SubchannelsListModal` on `native`
| {F353504} | {F353505} |
Reviewers: atul, inka
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/hooks/search-threads.js",
"new_path": "lib/hooks/search-threads.js",
"diff": "@@ -6,9 +6,9 @@ import {\ntype ChatThreadItem,\nuseFilteredChatListData,\n} from '../selectors/chat-selectors';\n+import { useThreadSearchIndex } from '../selectors/nav-selectors';\nimport { sidebarInfoSelector } from '../selectors/thread-selectors';\n-import SearchIndex from '../shared/search-index';\n-import { threadIsChannel, threadSearchText } from '../shared/thread-utils';\n+import { threadIsChannel } from '../shared/thread-utils';\nimport type { SetState } from '../types/hook-types';\nimport type {\nSidebarInfo,\n@@ -39,8 +39,6 @@ function useSearchThreads<U: SidebarInfo | ChatThreadItem>(\nresults: new Set<string>(),\n});\n- const userInfos = useSelector(state => state.userStore.userInfos);\n-\nconst listData = React.useMemo(() => {\nif (!searchState.text) {\nreturn childThreadInfos;\n@@ -50,20 +48,9 @@ function useSearchThreads<U: SidebarInfo | ChatThreadItem>(\n);\n}, [childThreadInfos, searchState]);\n- const viewerID = useSelector(\n- state => state.currentUserInfo && state.currentUserInfo.id,\n- );\n- const searchIndex = React.useMemo(() => {\n- const index = new SearchIndex();\n- for (const thread of childThreadInfos) {\n- const threadInfoFromItem = thread.threadInfo;\n- index.addEntry(\n- threadInfoFromItem.id,\n- threadSearchText(threadInfoFromItem, userInfos, viewerID),\n+ const searchIndex = useThreadSearchIndex(\n+ childThreadInfos.map(childThreadInfo => childThreadInfo.threadInfo),\n);\n- }\n- return index;\n- }, [childThreadInfos, userInfos, viewerID]);\nconst onChangeSearchInputText = React.useCallback(\n(text: string) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/selectors/nav-selectors.js",
"new_path": "lib/selectors/nav-selectors.js",
"diff": "// @flow\n+import * as React from 'react';\nimport { createSelector } from 'reselect';\nimport SearchIndex from '../shared/search-index';\n@@ -9,9 +10,10 @@ import { type CalendarQuery, defaultCalendarQuery } from '../types/entry-types';\nimport type { CalendarFilter } from '../types/filter-types';\nimport type { BaseNavInfo } from '../types/nav-types';\nimport type { BaseAppState } from '../types/redux-types';\n-import type { RawThreadInfo } from '../types/thread-types';\n+import type { RawThreadInfo, ThreadInfo } from '../types/thread-types';\nimport type { UserInfos } from '../types/user-types';\nimport { getConfig } from '../utils/config';\n+import { useSelector } from '../utils/redux-utils';\nfunction timeUntilCalendarRangeExpiration(\nlastUserInteractionCalendar: number,\n@@ -65,6 +67,25 @@ const currentCalendarQuery: (\n},\n);\n+function useThreadSearchIndex(\n+ threadInfos: $ReadOnlyArray<RawThreadInfo | ThreadInfo>,\n+): SearchIndex {\n+ const userInfos = useSelector(state => state.userStore.userInfos);\n+ const viewerID = useSelector(\n+ state => state.currentUserInfo && state.currentUserInfo.id,\n+ );\n+ return React.useMemo(() => {\n+ const searchIndex = new SearchIndex();\n+ for (const threadInfo of threadInfos) {\n+ searchIndex.addEntry(\n+ threadInfo.id,\n+ threadSearchText(threadInfo, userInfos, viewerID),\n+ );\n+ }\n+ return searchIndex;\n+ }, [threadInfos, userInfos, viewerID]);\n+}\n+\nconst threadSearchIndex: (\nstate: BaseAppState<*>,\n) => SearchIndex = createSelector(\n@@ -92,4 +113,5 @@ export {\ntimeUntilCalendarRangeExpiration,\ncurrentCalendarQuery,\nthreadSearchIndex,\n+ useThreadSearchIndex,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce useThreadSearchIndex hook
Summary:
Converting this to a hook will make it easier to swap in ENS names.
Depends on D6476
Test Plan:
Tested the two surfaces that currently use `useSearchThreads`: `SidebarListModal` and `SubchannelsListModal` on `native`
| {F353504} | {F353505} |
Reviewers: atul, inka
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6477 |
129,184 | 31.01.2023 15:04:43 | 18,000 | 7f30e26bce4ca9d645898edb0d6abd17e61b8b9a | [lib] Add `emote-smile-filled` to `CommIcons`
Summary: Context:
Test Plan:
Here's what it looks like:
{F354084}
{F354085}
Reviewers: ashoat, tomek, ginsu, rohan | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/comm-icon-config.json",
"new_path": "lib/shared/comm-icon-config.json",
"diff": "{\n\"icon\": {\n\"paths\": [\n- \"M658.286 0c-201.947 0-365.714 163.767-365.714 365.714v73.143c-161.573 0-292.571 130.999-292.571 292.571s130.999 292.571 292.571 292.571h731.429c161.573 0 292.571-130.999 292.571-292.571s-130.999-292.571-292.571-292.571v-73.143c0-201.947-163.767-365.714-365.714-365.714z\"\n+ \"M512 85.333c235.643 0 426.667 191.025 426.667 426.667s-191.024 426.667-426.667 426.667c-235.642 0-426.667-191.024-426.667-426.667s191.025-426.667 426.667-426.667zM317.265 573.265c-13.183 9.886-16.81 27.786-9.189 41.855l2.625 4.094 0.445 0.586 0.842 1.077c0.693 0.875 1.649 2.057 2.863 3.505 2.427 2.893 5.899 6.853 10.376 11.522 8.926 9.317 22.003 21.618 38.922 33.923 33.71 24.515 84.107 50.036 147.851 50.036 63.742 0 114.141-25.521 147.85-50.036 16.918-12.306 29.998-24.607 38.925-33.923 4.477-4.669 7.947-8.63 10.371-11.522 1.217-1.448 2.171-2.63 2.866-3.505l0.84-1.077 0.271-0.359c-0.201-0.457-0.433-0.634-0.819-0.928l-0.71-0.572 1.704 1.272c10.875-14.502 7.938-35.074-6.564-45.949-13.176-9.882-31.364-8.357-42.739 2.884l-3.161 3.614-0.289 0.368c-0.324 0.407-0.884 1.107-1.676 2.052-1.593 1.895-4.1 4.77-7.487 8.306-6.8 7.094-16.97 16.673-30.138 26.248-26.462 19.246-63.584 37.485-109.244 37.485-45.658 0-82.782-18.239-109.243-37.485-13.167-9.575-23.338-19.154-30.138-26.248-3.387-3.536-5.898-6.411-7.488-8.306-0.794-0.945-1.355-1.645-1.677-2.052-11.141-14.809-31.697-17.736-46.189-6.866zM653.411 347.897h-0.565c-23.407 0-42.384 18.976-42.384 42.384s18.977 42.384 42.384 42.384h0.565c23.407 0 42.384-18.976 42.384-42.384s-18.977-42.384-42.384-42.384zM371.483 347.897h-0.565c-23.408 0-42.384 18.976-42.384 42.384s18.976 42.384 42.384 42.384h0.565c23.408 0 42.384-18.976 42.384-42.384s-18.976-42.384-42.384-42.384z\"\n],\n\"attrs\": [{}],\n- \"width\": 1317,\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n\"grid\": 0,\n- \"tags\": [\"cloud-filled\"]\n+ \"tags\": [\"emote-smile-filled\"]\n+ },\n+ \"attrs\": [{}],\n+ \"properties\": {\n+ \"order\": 3,\n+ \"id\": 7,\n+ \"name\": \"emote-smile-filled\",\n+ \"prevSize\": 32,\n+ \"code\": 59654\n+ },\n+ \"setIdx\": 1,\n+ \"setId\": 2,\n+ \"iconIdx\": 0\n+ },\n+ {\n+ \"icon\": {\n+ \"paths\": [\n+ \"M658.286 0c-201.947 0-365.714 163.767-365.714 365.714v73.143c-161.573 0-292.571 130.999-292.571 292.571s130.999 292.571 292.571 292.571h731.429c161.573 0 292.571-130.999 292.571-292.571s-130.999-292.571-292.571-292.571v-73.143c0-201.947-163.767-365.714-365.714-365.714z\"\n+ ],\n+ \"width\": 1317,\n+ \"attrs\": [{}],\n+ \"isMulticolor\": false,\n+ \"isMulticolor2\": false,\n+ \"tags\": [\"cloud-filled\"],\n+ \"grid\": 0\n},\n\"attrs\": [{}],\n\"properties\": {\n\"code\": 59648\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 0\n+ \"setId\": 2,\n+ \"iconIdx\": 1\n},\n{\n\"icon\": {\n\"M432.547 692.53l-40.308 131.593c-8.427 27.442 6.22 56.736 33.257 66.47l310.226 112.604c30.575 10.982 63.84-7.063 70.962-38.789l43.017-187.193c6.901-29.975-12.695-59.706-43.014-65.12l-312.862-56.757c-26.906-4.991-53.277 11.028-61.278 37.193zM502.838 739.059l261.767 47.535-29.912 130.21-257.725-93.507 25.869-84.237z\",\n\"M1065.206 16.225l-700.699 170.863c-24.102 5.81-41.139 27.454-41.139 52.367v406.797c0 25.494 17.848 47.549 42.903 52.733l700.386 149.452c33.538 7.14 65.133-18.473 65.133-52.735v-727.094c0-34.912-32.694-60.586-66.583-52.383zM1050.947 102.885v659.51l-646.737-137.971v-363.843l646.737-157.696z\"\n],\n- \"attrs\": [{}, {}, {}],\n\"width\": 1132,\n+ \"attrs\": [{}, {}, {}],\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n- \"grid\": 0,\n- \"tags\": [\"megaphone\"]\n+ \"tags\": [\"megaphone\"],\n+ \"grid\": 0\n},\n\"attrs\": [{}, {}, {}],\n\"properties\": {\n\"code\": 59649\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 1\n+ \"setId\": 2,\n+ \"iconIdx\": 2\n},\n{\n\"icon\": {\n\"paths\": [\n\"M34.752 441.984c-31.040 25.6-31.040 73.152 0 98.752l507.456 418.56c41.728 34.368 104.704 4.736 104.704-49.408v-255.808c239.232 11.456 449.728 90.496 586.752 207.936 30.016 25.792 78.592 12.864 78.592-26.752 0-273.152-290.176-498.624-665.344-531.904v-230.464c0-54.144-62.976-83.84-104.704-49.408l-507.456 418.496z\"\n],\n- \"attrs\": [{}],\n\"width\": 1344,\n+ \"attrs\": [{}],\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n- \"grid\": 0,\n- \"tags\": [\"reply-filled\"]\n+ \"tags\": [\"reply-filled\"],\n+ \"grid\": 0\n},\n\"attrs\": [{}],\n\"properties\": {\n\"code\": 59650\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 2\n+ \"setId\": 2,\n+ \"iconIdx\": 3\n},\n{\n\"icon\": {\n\"paths\": [\n\"M541.796 47.496l-477.596 393.871c-51.125 42.165-51.125 120.485-0.001 162.649l484.365 399.092c68.601 48.299 165.707-0.256 165.707-86.508l-0.045-192.392 2.853 0.288c190.546 17.759 360.768 83.569 474.854 181.349 55.99 48.111 148.545 19.231 148.545-59.48l-0.258-14.54c-9.266-260.857-267.192-474.604-609.354-524.327l-16.639-2.287 0.045-176.369c0-89.143-103.724-138.076-172.474-81.347zM623.917 128.843v258.254l41.185 3.653 18.536 1.824c319.722 34.592 557.376 222.822 566.23 441.162l0.030 2.811 0.876 0.732c-140.156-120.125-349.725-195.561-579.519-206.565l-47.337-2.267v288.152c0 12.742-14.817 19.726-24.648 11.63l-477.581-393.918c-7.306-6.026-7.306-17.215-0.002-23.24l477.614-393.886c9.807-8.092 24.616-1.106 24.616 11.656z\"\n],\n- \"attrs\": [{}],\n\"width\": 1385,\n+ \"attrs\": [{}],\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n- \"grid\": 0,\n- \"tags\": [\"reply\"]\n+ \"tags\": [\"reply\"],\n+ \"grid\": 0\n},\n\"attrs\": [{}],\n\"properties\": {\n\"code\": 59651\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 3\n+ \"setId\": 2,\n+ \"iconIdx\": 4\n},\n{\n\"icon\": {\n\"attrs\": [{}],\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n- \"grid\": 0,\n- \"tags\": [\"sidebar-filled\"]\n+ \"tags\": [\"sidebar-filled\"],\n+ \"grid\": 0\n},\n\"attrs\": [{}],\n\"properties\": {\n\"code\": 59652\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 4\n+ \"setId\": 2,\n+ \"iconIdx\": 5\n},\n{\n\"icon\": {\n\"attrs\": [{}, {}, {}],\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n- \"grid\": 0,\n- \"tags\": [\"sidebar\"]\n+ \"tags\": [\"sidebar\"],\n+ \"grid\": 0\n},\n\"attrs\": [{}, {}, {}],\n\"properties\": {\n\"code\": 59653\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 5\n+ \"setId\": 2,\n+ \"iconIdx\": 6\n},\n{\n\"icon\": {\n\"attrs\": [],\n\"isMulticolor\": false,\n\"isMulticolor2\": false,\n- \"grid\": 0,\n+ \"colorPermutations\": {},\n\"tags\": [\"copy-filled\"],\n- \"colorPermutations\": {}\n+ \"grid\": 0\n},\n\"attrs\": [],\n\"properties\": {\n\"order\": 376,\n- \"id\": 7,\n+ \"id\": 6,\n\"name\": \"copy-filled\",\n- \"prevSize\": 32\n+ \"prevSize\": 32,\n+ \"code\": 59655\n},\n\"setIdx\": 1,\n- \"setId\": 10,\n- \"iconIdx\": 6\n+ \"setId\": 2,\n+ \"iconIdx\": 7\n}\n],\n\"height\": 1024,\n\"showMetrics\": true,\n\"showMetadata\": true,\n\"noie8\": false,\n- \"ie7\": false\n+ \"ie7\": false,\n+ \"showVersion\": true\n},\n\"imagePref\": {\n\"prefix\": \"icon-\",\n"
},
{
"change_type": "MODIFY",
"old_path": "native/fonts/CommIcons.ttf",
"new_path": "native/fonts/CommIcons.ttf",
"diff": "Binary files a/native/fonts/CommIcons.ttf and b/native/fonts/CommIcons.ttf differ\n"
},
{
"change_type": "MODIFY",
"old_path": "web/CommIcon.react.js",
"new_path": "web/CommIcon.react.js",
"diff": "@@ -12,7 +12,8 @@ export type CommIcons =\n| 'reply'\n| 'reply-filled'\n| 'megaphone'\n- | 'copy-filled';\n+ | 'copy-filled'\n+ | 'emote-smile-filled';\ntype CommIconProps = {\n+icon: CommIcons,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/utils/tooltip-utils.js",
"new_path": "web/utils/tooltip-utils.js",
"diff": "@@ -30,7 +30,6 @@ import {\nuseOnClickPendingSidebar,\nuseOnClickThread,\n} from '../selectors/thread-selectors';\n-import SWMansionIcon from '../SWMansionIcon.react';\nimport { calculateMaxTextWidth } from '../utils/text-utils';\nexport const tooltipPositions = Object.freeze({\n@@ -469,7 +468,7 @@ function useMessageReactAction(\nreturn null;\n}\n- const buttonContent = <SWMansionIcon icon=\"emote-smile\" size={18} />;\n+ const buttonContent = <CommIcon icon=\"emote-smile-filled\" size={18} />;\nconst onClickReact = () => {\nif (!setRenderEmojiKeyboard) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Add `emote-smile-filled` to `CommIcons`
Summary: Context: https://linear.app/comm/issue/ENG-2886/implement-new-react-icon-for-web-tooltip
Test Plan:
Here's what it looks like:
{F354084}
{F354085}
Reviewers: ashoat, tomek, ginsu, rohan
Reviewed By: ginsu
Differential Revision: https://phab.comm.dev/D6486 |
129,188 | 21.12.2022 12:13:14 | -3,600 | e7245b91cfae54814ee046d6ef9b92ed26cf3410 | [native] add function to set database status after successful structure creation
Summary: Setting Secure Store flag that database structure is properly created
Test Plan: After successful migration process `DatabaseManagerStatus` should equals `WORKABLE`
Reviewers: marcin, tomek
Subscribers: ashoat, tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp",
"new_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp",
"diff": "namespace comm {\n-typedef std::string DatabaseManagerStatus;\n-const DatabaseManagerStatus DB_MANAGER_WORKABLE = \"WORKABLE\";\n-const DatabaseManagerStatus DB_MANAGER_FIRST_FAILURE = \"FIRST_FAILURE\";\n-const DatabaseManagerStatus DB_MANAGER_SECOND_FAILURE = \"SECOND_FAILURE\";\n+std::once_flag DatabaseManager::initialized;\n+\n+typedef const std::string DatabaseManagerStatus;\n+DatabaseManagerStatus DB_MANAGER_WORKABLE = \"WORKABLE\";\n+DatabaseManagerStatus DB_MANAGER_FIRST_FAILURE = \"FIRST_FAILURE\";\n+DatabaseManagerStatus DB_MANAGER_SECOND_FAILURE = \"SECOND_FAILURE\";\nconst std::string DATABASE_MANAGER_STATUS_KEY = \"DATABASE_MANAGER_STATUS\";\n@@ -16,11 +18,18 @@ const DatabaseQueryExecutor &DatabaseManager::getQueryExecutor() {\n// TODO: conditionally create desired type of db manager\n// maybe basing on some preprocessor flag\nthread_local SQLiteQueryExecutor instance;\n+\n+ // creating an instance means that migration code was executed\n+ // and finished without error and database is workable\n+ std::call_once(DatabaseManager::initialized, []() {\n+ DatabaseManager::setDatabaseStatusAsWorkable();\n+ });\nreturn instance;\n}\nvoid DatabaseManager::clearSensitiveData() {\nSQLiteQueryExecutor::clearSensitiveData();\n+ DatabaseManager::setDatabaseStatusAsWorkable();\n}\nvoid DatabaseManager::initializeQueryExecutor(std::string &databasePath) {\n@@ -51,4 +60,9 @@ void DatabaseManager::initializeQueryExecutor(std::string &databasePath) {\n}\n}\n+void DatabaseManager::setDatabaseStatusAsWorkable() {\n+ comm::CommSecureStore commSecureStore{};\n+ commSecureStore.set(DATABASE_MANAGER_STATUS_KEY, DB_MANAGER_WORKABLE);\n+}\n+\n} // namespace comm\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.h",
"new_path": "native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.h",
"diff": "// TODO: includes may be conditional if we base on the preprocessor\n#include \"SQLiteQueryExecutor.h\"\n+#include <mutex>\n+\nnamespace comm {\nclass DatabaseManager {\n+ static std::once_flag initialized;\n+\n+ static void setDatabaseStatusAsWorkable();\n+\npublic:\nstatic const DatabaseQueryExecutor &getQueryExecutor();\nstatic void clearSensitiveData();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] add function to set database status after successful structure creation
Summary: Setting Secure Store flag that database structure is properly created
Test Plan: After successful migration process `DatabaseManagerStatus` should equals `WORKABLE`
Reviewers: marcin, tomek
Reviewed By: marcin, tomek
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D5992 |
129,188 | 21.12.2022 12:28:03 | -3,600 | 78591724e16f3d6f9aaf8041e07724d652c37dee | [native] throw exception when migration process will fail
Summary: Context in [ENG-2068](https://linear.app/comm/issue/ENG-2068/update-migration-code-to-throw-an-error-on-failure)
Test Plan: Force migration and creating new db process to fail and check if exception is thrown
Reviewers: marcin, tomek
Subscribers: ashoat, tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp",
"new_path": "native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp",
"diff": "@@ -694,7 +694,12 @@ void SQLiteQueryExecutor::migrate() {\nLogger::log(version_msg.str());\nif (db_version == 0) {\n- set_up_database(db);\n+ auto db_created = set_up_database(db);\n+ if (!db_created) {\n+ sqlite3_close(db);\n+ Logger::log(\"Database structure creation error.\");\n+ throw std::runtime_error(\"Database structure creation error\");\n+ }\nLogger::log(\"Database structure created.\");\nsqlite3_close(db);\n@@ -720,7 +725,8 @@ void SQLiteQueryExecutor::migrate() {\nif (migrationResult == MigrationResult::FAILURE) {\nmigration_msg << \"migration \" << idx << \" failed.\" << std::endl;\nLogger::log(migration_msg.str());\n- break;\n+ sqlite3_close(db);\n+ throw std::runtime_error(migration_msg.str());\n}\nif (migrationResult == MigrationResult::SUCCESS) {\nmigration_msg << \"migration \" << idx << \" succeeded.\" << std::endl;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] throw exception when migration process will fail
Summary: Context in [ENG-2068](https://linear.app/comm/issue/ENG-2068/update-migration-code-to-throw-an-error-on-failure)
Test Plan: Force migration and creating new db process to fail and check if exception is thrown
Reviewers: marcin, tomek
Reviewed By: marcin, tomek
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D5994 |
129,184 | 01.02.2023 14:03:10 | 18,000 | c8787e79d2e37139986003c2d375766a3d5122fd | [CI] Add automatic retries to Buildkite workflows
Summary:
Context:
Should hopefully reduce the number of times that developers will need to manually restart workflows.
Test Plan: NA, see what happens
Reviewers: tomek, marcin, jon, ashoat, ginsu, rohan, varun | [
{
"change_type": "MODIFY",
"old_path": ".buildkite/android.yml",
"new_path": ".buildkite/android.yml",
"diff": "@@ -9,6 +9,8 @@ steps:\n- 'yarn cleaninstall --frozen-lockfile --skip-optional'\n- 'cd native/android'\n- './gradlew clean && ./gradlew bundleRelease --no-daemon \"-Dorg.gradle.jvmargs=-Xmx32g -XX:MaxPermSize=32g -XX:+HeapDumpOnOutOfMemoryError\"'\n+ retry:\n+ automatic: true\nplugins:\n- docker#v3.13.0:\nimage: 'reactnativecommunity/react-native-android:latest'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/backup_build.yml",
"new_path": ".buildkite/backup_build.yml",
"diff": "steps:\n- - label: \":docker: Backup Build (Docker)\"\n+ - label: ':docker: Backup Build (Docker)'\ncommand: 'cd services && docker-compose build --no-cache backup-server'\n+ retry:\n+ automatic: true\nagents:\n- 'autoscaling=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/blob_build.yml",
"new_path": ".buildkite/blob_build.yml",
"diff": "steps:\n- - label: \":docker: Blob Build (Docker)\"\n+ - label: ':docker: Blob Build (Docker)'\ncommand: 'cd services && docker-compose build --no-cache blob-server'\n+ retry:\n+ automatic: true\nagents:\n- 'autoscaling=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/blob_unittests.yml",
"new_path": ".buildkite/blob_unittests.yml",
"diff": "steps:\n- - label: \":nix: Blob Unittests\"\n+ - label: ':nix: Blob Unittests'\ncommand:\n- 'cd services/blob'\n- 'nix develop --accept-flake-config --command cargo test'\n+ retry:\n+ automatic: true\nagents:\n- 'mac=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/cmakecheck.yml",
"new_path": ".buildkite/cmakecheck.yml",
"diff": "@@ -4,6 +4,8 @@ steps:\n- 'pip install cmakelang'\n- 'shopt -s globstar'\n- 'cmake-lint **/CMakeLists.txt **/*.cmake'\n+ retry:\n+ automatic: true\nplugins:\n- docker#v3.13.0:\nimage: 'python:bullseye'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/docker_keyserver.yml",
"new_path": ".buildkite/docker_keyserver.yml",
"diff": "steps:\n- - label: \":docker: Keyserver Build (Docker)\"\n+ - label: ':docker: Keyserver Build (Docker)'\ncommand: 'cd keyserver && touch .env && bash/dc.sh build --no-cache'\n+ retry:\n+ automatic: true\nagents:\n- 'autoscaling=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/eslint_flow_jest.yml",
"new_path": ".buildkite/eslint_flow_jest.yml",
"diff": "@@ -7,6 +7,8 @@ steps:\n- 'yarn cleaninstall --frozen-lockfile --skip-optional --network-timeout 180000'\n- 'yarn eslint --max-warnings=0 && yarn workspace lib flow && yarn workspace web flow && yarn workspace landing flow && yarn workspace native flow && yarn workspace keyserver flow && yarn workspace desktop flow'\n- 'yarn workspace lib test && yarn workspace keyserver test'\n+ retry:\n+ automatic: true\nplugins:\n- docker#v3.13.0:\nimage: 'node:16.13-bullseye'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/identity_build.yml",
"new_path": ".buildkite/identity_build.yml",
"diff": "steps:\n- - label: \":docker: Identity Build (Docker)\"\n+ - label: ':docker: Identity Build (Docker)'\ncommand: 'cd services && docker-compose build --no-cache identity-server'\n+ retry:\n+ automatic: true\nagents:\n- 'autoscaling=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/identity_tests.yml",
"new_path": ".buildkite/identity_tests.yml",
"diff": "env:\n- PATH: \"$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH\"\n+ PATH: '$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH'\nsteps:\n- - label: \":nix: Identity Tests (Nix)\"\n+ - label: ':nix: Identity Tests (Nix)'\ncommand:\n- 'cd services/identity'\n- 'nix develop --accept-flake-config --command cargo test'\n+ retry:\n+ automatic: true\nagents:\n- 'mac=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/ios.yml",
"new_path": ".buildkite/ios.yml",
"diff": "@@ -6,7 +6,9 @@ steps:\n- 'source /Users/comm/.cargo/env'\n- 'yarn cleaninstall --frozen-lockfile --skip-optional'\n- 'cd native/ios && xcodebuild -workspace Comm.xcworkspace -scheme Comm -destination generic/platform=iOS -allowProvisioningUpdates'\n+ retry:\n+ automatic: true\nenv:\n- PROTOC: \"/opt/homebrew/bin/protoc\"\n+ PROTOC: '/opt/homebrew/bin/protoc'\nagents:\n- 'mac=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/jsi_codegen.yml",
"new_path": ".buildkite/jsi_codegen.yml",
"diff": "@@ -4,6 +4,8 @@ steps:\n- '(pkill flow || true)'\n- 'yarn cleaninstall --frozen-lockfile --skip-optional --network-timeout 180000'\n- 'cd native && yarn codegen-jsi && git diff --exit-code'\n+ retry:\n+ automatic: true\nplugins:\n- docker#v3.13.0:\nimage: 'node:16.13-bullseye'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/nix_yarn.yml",
"new_path": ".buildkite/nix_yarn.yml",
"diff": "steps:\n- label: 'nix develop -c yarn cleaninstall --network-timeout 180000'\ncommand: 'nix develop --accept-flake-config -c yarn cleaninstall --network-timeout 180000'\n+ retry:\n+ automatic: true\nagents:\n- 'nixdarwin=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/shellcheck.yml",
"new_path": ".buildkite/shellcheck.yml",
"diff": "@@ -4,6 +4,8 @@ steps:\n- 'apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y shellcheck'\n- 'shopt -s globstar'\n- 'shellcheck -x -P SCRIPTDIR **/*.sh'\n+ retry:\n+ automatic: true\nplugins:\n- docker#v3.13.0:\nimage: 'debian:stable'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/tunnelbroker_build.yml",
"new_path": ".buildkite/tunnelbroker_build.yml",
"diff": "steps:\n- - label: \":docker: Tunnelbroker Build (Docker)\"\n+ - label: ':docker: Tunnelbroker Build (Docker)'\ncommand: 'cd services && docker-compose build --no-cache tunnelbroker-server'\n+ retry:\n+ automatic: true\nagents:\n- 'autoscaling=true'\n"
},
{
"change_type": "MODIFY",
"old_path": ".buildkite/tunnelbroker_unittests.yml",
"new_path": ".buildkite/tunnelbroker_unittests.yml",
"diff": "env:\n- PATH: \"$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH\"\n+ PATH: '$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH'\nsteps:\n- label: ':nix: Tunnelbroker Unittests'\ncommand:\n@@ -10,5 +10,7 @@ steps:\n- 'rm -rf build'\n- 'nix develop --accept-flake-config -c bash -c \"cmake -B build . && make -C build -j\"'\n- 'build/runTests --gtest_filter=\"-AmqpManager*:DatabaseManager*\"'\n+ retry:\n+ automatic: true\nagents:\n- 'mac=true'\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [CI] Add automatic retries to Buildkite workflows
Summary:
Context: https://buildkite.com/docs/pipelines/command-step#retry-attributes-automatic-retry-attributes
Should hopefully reduce the number of times that developers will need to manually restart workflows.
Test Plan: NA, see what happens
Reviewers: tomek, marcin, jon, ashoat, ginsu, rohan, varun
Reviewed By: varun
Differential Revision: https://phab.comm.dev/D6496 |
129,181 | 19.01.2023 23:30:22 | -3,600 | 4db32ecb9f2badbea89d1d3525a344444c226465 | [services] [electron update server] Add a Dockerfile
Summary: For easy distribution we need to package the update server into a container like the rest of the services.
Test Plan: Check if the update server correctly runs inside docker
Reviewers: atul, jon, varun, ashoat
Subscribers: ashoat, tomek | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "services/electron-update-server/Dockerfile",
"diff": "+FROM node:16.18.0-bullseye\n+\n+WORKDIR /home/comm/\n+\n+COPY package.json yarn.lock postinstall.sh ./\n+COPY patches patches/\n+\n+COPY package.json yarn.lock postinstall.sh ./\n+COPY lib/package.json lib/.flowconfig lib/\n+COPY native/package.json native/.flowconfig native/\n+COPY native/expo-modules/android-lifecycle/package.json \\\n+ native/expo-modules/android-lifecycle/\n+COPY services/electron-update-server/package.json \\\n+ services/electron-update-server/\n+\n+RUN yarn install --frozen-lockfile\n+\n+COPY services/electron-update-server services/electron-update-server/\n+\n+EXPOSE 80\n+\n+WORKDIR /home/comm/services/electron-update-server\n+CMD [\"yarn\", \"run\", \"prod\"]\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "services/electron-update-server/docker-compose.yml",
"diff": "+services:\n+ electron-update-server:\n+ image: electron-update-server\n+ build:\n+ context: ../..\n+ dockerfile: services/electron-update-server/Dockerfile\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [services] [electron update server] Add a Dockerfile
Summary: For easy distribution we need to package the update server into a container like the rest of the services.
Test Plan: Check if the update server correctly runs inside docker
Reviewers: atul, jon, varun, ashoat
Reviewed By: ashoat
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D6355 |
129,188 | 01.02.2023 16:00:33 | -3,600 | 99ec0f13fd0473dac1748522d3ddc34fd8a199d5 | [keyserver] enable accepting policies feature
Summary: Updating code version because feature is released. Setting date to run script properly.
Test Plan:
1. Test if `yarn script dist/scripts/force-policy-acknowledgment.js` works properly.
2. Test if accepting policy works on native
Reviewers: atul, tomek, inka
Subscribers: ashoat | [
{
"change_type": "MODIFY",
"old_path": "keyserver/src/responders/user-responders.js",
"new_path": "keyserver/src/responders/user-responders.js",
"diff": "@@ -230,7 +230,7 @@ async function processSuccessfulLogin(\nif (\nnotAcknowledgedPolicies.length &&\n- hasMinCodeVersion(viewer.platformDetails, 1000)\n+ hasMinCodeVersion(viewer.platformDetails, 181)\n) {\nconst currentUserInfo = await fetchLoggedInUserInfo(viewer);\nreturn {\n"
},
{
"change_type": "MODIFY",
"old_path": "keyserver/src/scripts/force-policy-acknowledgment.js",
"new_path": "keyserver/src/scripts/force-policy-acknowledgment.js",
"diff": "@@ -6,7 +6,7 @@ import { dbQuery, SQL } from '../database/database.js';\nimport { main } from './utils.js';\n// time when policy was officially published for users\n-const policyUpdateTime = new Date('2022-12-30T00:00:00').getTime();\n+const policyUpdateTime = new Date('2023-02-03T00:00:00').getTime();\nasync function forcePolicyAcknowledgment() {\nawait dbQuery(SQL`\n"
},
{
"change_type": "MODIFY",
"old_path": "keyserver/src/utils/validation-utils.js",
"new_path": "keyserver/src/utils/validation-utils.js",
"diff": "@@ -163,7 +163,7 @@ async function policiesValidator(\nif (!policies.length) {\nreturn;\n}\n- if (!hasMinCodeVersion(viewer.platformDetails, 1000)) {\n+ if (!hasMinCodeVersion(viewer.platformDetails, 181)) {\nreturn;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [keyserver] enable accepting policies feature
Summary: Updating code version because feature is released. Setting date to run script properly.
Test Plan:
1. Test if `yarn script dist/scripts/force-policy-acknowledgment.js` works properly.
2. Test if accepting policy works on native
Reviewers: atul, tomek, inka
Reviewed By: atul
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D6492 |
129,200 | 02.02.2023 11:30:05 | 18,000 | 132c2ddb011132ab7ca2870008407c4d8314facd | [scripts] make install_protobuf script work on macos
Summary: nproc isn't a command on macos, so we need to use sysctl if it's not available
Test Plan: CI passes
Reviewers: jon
Subscribers: ashoat, tomek, atul | [
{
"change_type": "MODIFY",
"old_path": "scripts/install_protobuf.sh",
"new_path": "scripts/install_protobuf.sh",
"diff": "@@ -18,7 +18,7 @@ cmake ../cmake \\\n-Dprotobuf_ABSL_PROVIDER=package \\\n-Dprotobuf_BUILD_TESTS=OFF\n-make install -j \"$(nproc)\" -l \"$(nproc)\"\n+make install -j \"$(nproc || sysctl -n hw.physicalcpu)\"\npopd || exit # cmake-build\npopd || exit # protobuf\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [scripts] make install_protobuf script work on macos
Summary: nproc isn't a command on macos, so we need to use sysctl if it's not available
Test Plan: CI passes
Reviewers: jon
Reviewed By: jon
Subscribers: ashoat, tomek, atul
Differential Revision: https://phab.comm.dev/D6525 |
129,187 | 01.02.2023 14:43:56 | 18,000 | 9bf4b234aafb0c65b48a0bd2507d521694c1b436 | [lib] Add helpers for EntityText
Summary:
These helpers will be used by code that composes `EntityText`s.
Depends on D6508
Test Plan: Tested in combination with the following diffs
Reviewers: atul, tomek, ginsu | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/entity-text.js",
"new_path": "lib/utils/entity-text.js",
"diff": "@@ -5,7 +5,12 @@ import * as React from 'react';\nimport { threadNoun } from '../shared/thread-utils';\nimport { stringForUser } from '../shared/user-utils';\n-import { threadTypes, type ThreadType } from '../types/thread-types';\n+import {\n+ threadTypes,\n+ type ThreadType,\n+ type RawThreadInfo,\n+ type ThreadInfo,\n+} from '../types/thread-types';\ntype UserEntity = {\n+type: 'user',\n@@ -45,12 +50,10 @@ type EntityTextComponent = UserEntity | ThreadEntity | ColorEntity | string;\nexport type EntityText = $ReadOnlyArray<EntityTextComponent>;\n-// ET is a JS tag function used in template literals, eg. ET`something`\n-// It allows you to compose raw text and \"entities\" together\n-function ET(\n+const entityTextFunction = (\nstrings: $ReadOnlyArray<string>,\n...entities: $ReadOnlyArray<EntityTextComponent | EntityText>\n-): EntityText {\n+) => {\nconst result = [];\nfor (let i = 0; i < strings.length; i++) {\nconst str = strings[i];\n@@ -83,7 +86,114 @@ function ET(\n}\n}\nreturn result;\n+};\n+\n+// defaults to shortName\n+type EntityTextThreadInput =\n+ | {\n+ +display: 'uiName',\n+ +threadInfo: ThreadInfo,\n+ }\n+ | {\n+ +display?: 'shortName',\n+ +threadInfo: ThreadInfo | RawThreadInfo,\n+ +possessive?: ?boolean,\n+ }\n+ | {\n+ +display: 'alwaysDisplayShortName',\n+ +threadInfo: ThreadInfo | RawThreadInfo,\n+ +possessive?: ?boolean,\n+ }\n+ | {\n+ +display: 'alwaysDisplayShortName',\n+ +threadID: string,\n+ +possessive?: ?boolean,\n+ };\n+entityTextFunction.thread = (input: EntityTextThreadInput) => {\n+ if (input.display === 'uiName') {\n+ const { threadInfo } = input;\n+ return {\n+ type: 'thread',\n+ id: threadInfo.id,\n+ name: threadInfo.name,\n+ display: 'uiName',\n+ uiName: threadInfo.uiName,\n+ };\n+ }\n+ if (input.display === 'alwaysDisplayShortName' && input.threadID) {\n+ const { threadID, possessive } = input;\n+ return {\n+ type: 'thread',\n+ id: threadID,\n+ name: undefined,\n+ display: 'shortName',\n+ threadType: undefined,\n+ alwaysDisplayShortName: true,\n+ possessive,\n+ };\n+ } else if (input.display === 'alwaysDisplayShortName' && input.threadInfo) {\n+ const { threadInfo, possessive } = input;\n+ return {\n+ type: 'thread',\n+ id: threadInfo.id,\n+ name: threadInfo.name,\n+ display: 'shortName',\n+ threadType: threadInfo.type,\n+ alwaysDisplayShortName: true,\n+ possessive,\n+ };\n+ } else if (input.display === 'shortName' || !input.display) {\n+ const { threadInfo, possessive } = input;\n+ return {\n+ type: 'thread',\n+ id: threadInfo.id,\n+ name: threadInfo.name,\n+ display: 'shortName',\n+ threadType: threadInfo.type,\n+ possessive,\n+ };\n}\n+ invariant(\n+ false,\n+ `ET.thread passed unexpected display type: ${input.display}`,\n+ );\n+};\n+\n+type EntityTextUserInput = {\n+ +userInfo: {\n+ +id: string,\n+ +username?: ?string,\n+ +isViewer?: ?boolean,\n+ ...\n+ },\n+ +possessive?: ?boolean,\n+};\n+entityTextFunction.user = (input: EntityTextUserInput) => ({\n+ type: 'user',\n+ id: input.userInfo.id,\n+ username: input.userInfo.username,\n+ isViewer: input.userInfo.isViewer,\n+ possessive: input.possessive,\n+});\n+\n+type EntityTextColorInput = { +hex: string };\n+entityTextFunction.color = (input: EntityTextColorInput) => ({\n+ type: 'color',\n+ hex: input.hex,\n+});\n+\n+// ET is a JS tag function used in template literals, eg. ET`something`\n+// It allows you to compose raw text and \"entities\" together\n+type EntityTextFunction = ((\n+ strings: $ReadOnlyArray<string>,\n+ ...entities: $ReadOnlyArray<EntityTextComponent | EntityText>\n+) => EntityText) & {\n+ +thread: EntityTextThreadInput => ThreadEntity,\n+ +user: EntityTextUserInput => UserEntity,\n+ +color: EntityTextColorInput => ColorEntity,\n+ ...\n+};\n+const ET: EntityTextFunction = entityTextFunction;\ntype MakePossessiveInput = { +str: string, +isViewer?: ?boolean };\nfunction makePossessive(input: MakePossessiveInput) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Add helpers for EntityText
Summary:
These helpers will be used by code that composes `EntityText`s.
Depends on D6508
Test Plan: Tested in combination with the following diffs
Reviewers: atul, tomek, ginsu
Reviewed By: tomek
Differential Revision: https://phab.comm.dev/D6509 |
129,187 | 01.02.2023 08:35:39 | 18,000 | 216451b11dd9da5b4cc1433f4b1c480db60092e9 | [lib] Use pluralize in robotextForUsers
Summary: Seems like this code is just duplicated. I checked the unit tests for `pluralize` and they seem to do exactly what we want here.
Test Plan: Played around with robotext messages and they all look right
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/message-utils.js",
"new_path": "lib/shared/message-utils.js",
"diff": "@@ -32,6 +32,7 @@ import type {\nimport { type ThreadInfo } from '../types/thread-types';\nimport type { RelativeUserInfo, UserInfos } from '../types/user-types';\nimport { type EntityText, entityTextToRawString } from '../utils/entity-text';\n+import { pluralize } from '../utils/text-utils';\nimport { codeBlockRegex, type ParserRules } from './markdown';\nimport { messageSpecs } from './messages/message-specs';\nimport { threadIsGroupChat } from './thread-utils';\n@@ -67,21 +68,7 @@ function robotextForUser(user: RelativeUserInfo): string {\n}\nfunction robotextForUsers(users: RelativeUserInfo[]): string {\n- if (users.length === 1) {\n- return robotextForUser(users[0]);\n- } else if (users.length === 2) {\n- return `${robotextForUser(users[0])} and ${robotextForUser(users[1])}`;\n- } else if (users.length === 3) {\n- return (\n- `${robotextForUser(users[0])}, ${robotextForUser(users[1])}, ` +\n- `and ${robotextForUser(users[2])}`\n- );\n- } else {\n- return (\n- `${robotextForUser(users[0])}, ${robotextForUser(users[1])}, ` +\n- `and ${users.length - 2} others`\n- );\n- }\n+ return pluralize(users.map(robotextForUser), 3);\n}\nfunction encodedThreadEntity(threadID: string, text: string): string {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Use pluralize in robotextForUsers
Summary: Seems like this code is just duplicated. I checked the unit tests for `pluralize` and they seem to do exactly what we want here.
Test Plan: Played around with robotext messages and they all look right
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6510 |
129,187 | 01.02.2023 16:49:57 | 18,000 | a95f14bef0930cda8dc1bd1155668c5927278e27 | [lib] Introduce basePluralize
Summary:
In the next diff, I introduce a function that pluralizes `EntityText`. This diff factors out the shared functionality.
Depends on D6510
Test Plan: The test cases in `lib/utils/text-utils.test.js` are extremely thorough
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/text-utils.js",
"new_path": "lib/utils/text-utils.js",
"diff": "// @flow\n-function pluralize(\n- nouns: $ReadOnlyArray<string>,\n+function basePluralize<T>(\n+ nouns: $ReadOnlyArray<T>,\nmaxNumberOfNouns: number = 3,\n-): string {\n+ composeFunc: (T | string, ?T | string) => T,\n+): T {\n+ const baseCase = composeFunc('');\n+\nif (nouns.length === 0 || maxNumberOfNouns <= 0) {\n- return '';\n+ return baseCase;\n} else if (nouns.length === 1) {\nreturn nouns[0];\n} else if (maxNumberOfNouns === 1) {\n- return `${nouns.length} users`;\n+ return composeFunc(`${nouns.length} users`);\n}\nconst comma = maxNumberOfNouns > 2 && nouns.length > 2 ? ',' : '';\nif (nouns.length <= maxNumberOfNouns) {\n- const prefix = nouns.slice(0, -1).join(', ');\n- return `${prefix}${comma} and ${nouns[nouns.length - 1]}`;\n+ const allButLast = nouns.slice(0, -1);\n+ const mostlyComposed = allButLast.reduce(\n+ (partlyComposed, noun) =>\n+ composeFunc(composeFunc(partlyComposed, noun), `${comma} `),\n+ baseCase,\n+ );\n+ return composeFunc(\n+ composeFunc(mostlyComposed, 'and '),\n+ nouns[nouns.length - 1],\n+ );\n+ }\n+ const explicitNouns = nouns.slice(0, maxNumberOfNouns - 1);\n+ const mostlyComposed = explicitNouns.reduce(\n+ (partlyComposed, noun) =>\n+ composeFunc(composeFunc(partlyComposed, noun), `${comma} `),\n+ baseCase,\n+ );\n+ return composeFunc(\n+ composeFunc(mostlyComposed, 'and '),\n+ `${nouns.length - maxNumberOfNouns + 1} others`,\n+ );\n}\n- const prefix = nouns.slice(0, maxNumberOfNouns - 1).join(', ');\n- return `${prefix}${comma} and ${nouns.length - maxNumberOfNouns + 1} others`;\n+\n+function pluralize(\n+ nouns: $ReadOnlyArray<string>,\n+ maxNumberOfNouns: number = 3,\n+): string {\n+ return basePluralize(nouns, maxNumberOfNouns, (a: string, b: ?string) =>\n+ b ? a + b : a,\n+ );\n}\nfunction trimText(text: string, maxLength: number): string {\n@@ -43,4 +71,4 @@ function pluralizeAndTrim(\nreturn trimText(pluralize(nouns, 1), maxLength);\n}\n-export { pluralize, trimText, pluralizeAndTrim };\n+export { basePluralize, pluralize, trimText, pluralizeAndTrim };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce basePluralize
Summary:
In the next diff, I introduce a function that pluralizes `EntityText`. This diff factors out the shared functionality.
Depends on D6510
Test Plan: The test cases in `lib/utils/text-utils.test.js` are extremely thorough
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6511 |
129,187 | 01.02.2023 16:54:20 | 18,000 | 691ad069529f09ea7c780712c8c00232a66791d0 | [lib] Convert AddMembers/RemoveMembers robotext to use EntityText
Summary: Depends on D6511
Test Plan: Looked at an `AddMembers` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/add-members-message-spec.js",
"new_path": "lib/shared/messages/add-members-message-spec.js",
"diff": "@@ -15,6 +15,11 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import {\n+ ET,\n+ type EntityText,\n+ pluralizeEntityText,\n+} from '../../utils/entity-text';\nimport { values } from '../../utils/objects';\nimport {\nrobotextForMessageInfo,\n@@ -26,7 +31,6 @@ import type {\nMessageSpec,\nMessageTitleParam,\nNotificationTextsParams,\n- RobotextParams,\n} from './message-spec';\nimport { joinResult } from './utils';\n@@ -122,15 +126,16 @@ export const addMembersMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: AddMembersMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n+ robotext(messageInfo: AddMembersMessageInfo): EntityText {\nconst users = messageInfo.addedMembers;\ninvariant(users.length !== 0, 'added who??');\n- const addedUsersString = params.robotextForUsers(users);\n- return `${creator} added ${addedUsersString}`;\n+\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const addedUsers = pluralizeEntityText(\n+ users.map(user => ET`${ET.user({ userInfo: user })}`),\n+ );\n+\n+ return ET`${creator} added ${addedUsers}`;\n},\nnotificationTexts(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/remove-members-message-spec.js",
"new_path": "lib/shared/messages/remove-members-message-spec.js",
"diff": "@@ -15,6 +15,11 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import {\n+ ET,\n+ type EntityText,\n+ pluralizeEntityText,\n+} from '../../utils/entity-text';\nimport { values } from '../../utils/objects';\nimport {\nrobotextForMessageInfo,\n@@ -26,7 +31,6 @@ import type {\nMessageSpec,\nMessageTitleParam,\nNotificationTextsParams,\n- RobotextParams,\n} from './message-spec';\nimport { joinResult } from './utils';\n@@ -122,15 +126,16 @@ export const removeMembersMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: RemoveMembersMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n+ robotext(messageInfo: RemoveMembersMessageInfo): EntityText {\nconst users = messageInfo.removedMembers;\n- invariant(users.length !== 0, 'removed who??');\n- const removedUsersString = params.robotextForUsers(users);\n- return `${creator} removed ${removedUsersString}`;\n+ invariant(users.length !== 0, 'added who??');\n+\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const removedUsers = pluralizeEntityText(\n+ users.map(user => ET`${ET.user({ userInfo: user })}`),\n+ );\n+\n+ return ET`${creator} removed ${removedUsers}`;\n},\nnotificationTexts(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/entity-text.js",
"new_path": "lib/utils/entity-text.js",
"diff": "@@ -11,6 +11,7 @@ import {\ntype RawThreadInfo,\ntype ThreadInfo,\n} from '../types/thread-types';\n+import { basePluralize } from '../utils/text-utils';\ntype UserEntity = {\n+type: 'user',\n@@ -301,4 +302,16 @@ function entityTextToReact(\n});\n}\n-export { ET, entityTextToRawString, entityTextToReact };\n+function pluralizeEntityText(\n+ nouns: $ReadOnlyArray<EntityText>,\n+ maxNumberOfNouns: number = 3,\n+): EntityText {\n+ return basePluralize<EntityText>(\n+ nouns,\n+ maxNumberOfNouns,\n+ (a: EntityText | string, b: ?EntityText | string) =>\n+ b ? ET`${a}${b}` : ET`${a}`,\n+ );\n+}\n+\n+export { ET, entityTextToRawString, entityTextToReact, pluralizeEntityText };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert AddMembers/RemoveMembers robotext to use EntityText
Summary: Depends on D6511
Test Plan: Looked at an `AddMembers` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6512 |
129,187 | 01.02.2023 16:55:15 | 18,000 | 3e3b36eb26bb053ec8b5046a0b06f1c8de927bfa | [lib] Convert ChangeSettings robotext to use EntityText
Summary: Depends on D6512
Test Plan: Looked at a `ChangeSettings` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/change-settings-message-spec.js",
"new_path": "lib/shared/messages/change-settings-message-spec.js",
"diff": "@@ -16,6 +16,7 @@ import type { NotifTexts } from '../../types/notif-types';\nimport { assertThreadType } from '../../types/thread-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport { validHexColorRegex } from '../account-utils';\nimport {\nrobotextToRawString,\n@@ -28,7 +29,6 @@ import {\ntype MessageSpec,\ntype MessageTitleParam,\ntype NotificationTextsParams,\n- type RobotextParams,\n} from './message-spec';\nimport { joinResult } from './utils';\n@@ -122,26 +122,24 @@ export const changeSettingsMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: ChangeSettingsMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n+ robotext(messageInfo: ChangeSettingsMessageInfo): EntityText {\n+ const creator = ET.user({ userInfo: messageInfo.creator });\nif (\n(messageInfo.field === 'name' || messageInfo.field === 'description') &&\nmessageInfo.value.toString() === ''\n) {\n- return `${creator} cleared ${params.encodedThreadEntity(\n- messageInfo.threadID,\n- 'the chat',\n- )}'s ${messageInfo.field}`;\n+ return ET`${creator} cleared ${ET.thread({\n+ display: 'alwaysDisplayShortName',\n+ threadID: messageInfo.threadID,\n+ possessive: true,\n+ })} ${messageInfo.field}`;\n}\nlet value;\nif (\nmessageInfo.field === 'color' &&\nmessageInfo.value.toString().match(validHexColorRegex)\n) {\n- value = `<#${messageInfo.value}|c${messageInfo.threadID}>`;\n+ value = ET.color({ hex: `#${messageInfo.value}` });\n} else if (messageInfo.field === 'type') {\ninvariant(\ntypeof messageInfo.value === 'number',\n@@ -150,13 +148,13 @@ export const changeSettingsMessageSpec: MessageSpec<\nconst newThreadType = assertThreadType(messageInfo.value);\nvalue = threadLabel(newThreadType);\n} else {\n- value = messageInfo.value;\n+ value = messageInfo.value.toString();\n}\n- return (\n- `${creator} updated ` +\n- `${params.encodedThreadEntity(messageInfo.threadID, 'the chat')}'s ` +\n- `${messageInfo.field} to \"${value}\"`\n- );\n+ return ET`${creator} updated ${ET.thread({\n+ display: 'alwaysDisplayShortName',\n+ threadID: messageInfo.threadID,\n+ possessive: true,\n+ })} ${messageInfo.field} to \"${value}\"`;\n},\nnotificationTexts(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert ChangeSettings robotext to use EntityText
Summary: Depends on D6512
Test Plan: Looked at a `ChangeSettings` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6513 |
129,187 | 01.02.2023 18:36:41 | 18,000 | 950fbd9cd274e012229b29201786cf095bf047ee | [lib] Convert ChangeRole robotext to use EntityText
Summary: Depends on D6513
Test Plan: Looked at a `ChangeRole` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/change-role-message-spec.js",
"new_path": "lib/shared/messages/change-role-message-spec.js",
"diff": "@@ -15,6 +15,11 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import {\n+ ET,\n+ type EntityText,\n+ pluralizeEntityText,\n+} from '../../utils/entity-text';\nimport { values } from '../../utils/objects';\nimport {\nrobotextToRawString,\n@@ -131,21 +136,25 @@ export const changeRoleMessageSpec: MessageSpec<\nrobotext(\nmessageInfo: ChangeRoleMessageInfo,\n- creator: string,\n+ creatorString: string,\nparams: RobotextParams,\n- ): string {\n+ ): EntityText {\nconst users = messageInfo.members;\ninvariant(users.length !== 0, 'changed whose role??');\n- const usersString = params.robotextForUsers(users);\n+\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const affectedUsers = pluralizeEntityText(\n+ users.map(user => ET`${ET.user({ userInfo: user })}`),\n+ );\nconst { threadInfo } = params;\ninvariant(threadInfo, 'ThreadInfo should be set for CHANGE_ROLE message');\nconst verb = threadInfo.roles[messageInfo.newRole].isDefault\n? 'removed'\n: 'added';\n-\nconst noun = users.length === 1 ? 'an admin' : 'admins';\n- return `${creator} ${verb} ${usersString} as ${noun}`;\n+\n+ return ET`${creator} ${verb} ${affectedUsers} as ${noun}`;\n},\nnotificationTexts(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert ChangeRole robotext to use EntityText
Summary: Depends on D6513
Test Plan: Looked at a `ChangeRole` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6514 |
129,187 | 01.02.2023 18:47:25 | 18,000 | 6372f7462204bd3d70e56f3c1681833104a1bc53 | [lib] Convert JoinThread/LeaveThread robotext to use EntityText
Test Plan: Looked at a `JoinThread` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/join-thread-message-spec.js",
"new_path": "lib/shared/messages/join-thread-message-spec.js",
"diff": "@@ -15,6 +15,7 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport { values } from '../../utils/objects';\nimport { pluralize } from '../../utils/text-utils';\nimport {\n@@ -27,7 +28,6 @@ import type {\nMessageSpec,\nMessageTitleParam,\nNotificationTextsParams,\n- RobotextParams,\n} from './message-spec';\nimport { joinResult } from './utils';\n@@ -94,15 +94,12 @@ export const joinThreadMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: JoinThreadMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n- return (\n- `${creator} joined ` +\n- params.encodedThreadEntity(messageInfo.threadID, 'this chat')\n- );\n+ robotext(messageInfo: JoinThreadMessageInfo): EntityText {\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ return ET`${creator} joined ${ET.thread({\n+ display: 'alwaysDisplayShortName',\n+ threadID: messageInfo.threadID,\n+ })}`;\n},\nnotificationTexts(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/leave-thread-message-spec.js",
"new_path": "lib/shared/messages/leave-thread-message-spec.js",
"diff": "@@ -15,6 +15,7 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport { values } from '../../utils/objects';\nimport { pluralize } from '../../utils/text-utils';\nimport {\n@@ -27,7 +28,6 @@ import type {\nMessageSpec,\nMessageTitleParam,\nNotificationTextsParams,\n- RobotextParams,\n} from './message-spec';\nimport { joinResult } from './utils';\n@@ -94,15 +94,12 @@ export const leaveThreadMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: LeaveThreadMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n- return (\n- `${creator} left ` +\n- params.encodedThreadEntity(messageInfo.threadID, 'this chat')\n- );\n+ robotext(messageInfo: LeaveThreadMessageInfo): EntityText {\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ return ET`${creator} left ${ET.thread({\n+ display: 'alwaysDisplayShortName',\n+ threadID: messageInfo.threadID,\n+ })}`;\n},\nnotificationTexts(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert JoinThread/LeaveThread robotext to use EntityText
Test Plan: Looked at a `JoinThread` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6515 |
129,187 | 01.02.2023 19:15:24 | 18,000 | d9dfc704a93362afff4ce31f7c54280a41939ff9 | [lib] Convert entry robotexts to use EntityText
Summary: Depends on D6515
Test Plan: Looked at a `CreateEntry` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/create-entry-message-spec.js",
"new_path": "lib/shared/messages/create-entry-message-spec.js",
"diff": "@@ -16,6 +16,7 @@ import type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\nimport { prettyDate } from '../../utils/date-utils';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -123,12 +124,11 @@ export const createEntryMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(messageInfo: CreateEntryMessageInfo, creator: string): string {\n+ robotext(messageInfo: CreateEntryMessageInfo): EntityText {\nconst date = prettyDate(messageInfo.date);\n- return (\n- `${creator} created an event scheduled for ${date}: ` +\n- `\"${encodeURI(messageInfo.text)}\"`\n- );\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const { text } = messageInfo;\n+ return ET`${creator} created an event scheduled for ${date}: \"${text}\"`;\n},\nnotificationTexts(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/delete-entry-message-spec.js",
"new_path": "lib/shared/messages/delete-entry-message-spec.js",
"diff": "@@ -16,6 +16,7 @@ import type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\nimport { prettyDate } from '../../utils/date-utils';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -123,12 +124,11 @@ export const deleteEntryMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(messageInfo: DeleteEntryMessageInfo, creator: string): string {\n+ robotext(messageInfo: DeleteEntryMessageInfo): EntityText {\nconst date = prettyDate(messageInfo.date);\n- return (\n- `${creator} deleted an event scheduled for ${date}: ` +\n- `\"${encodeURI(messageInfo.text)}\"`\n- );\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const { text } = messageInfo;\n+ return ET`${creator} deleted an event scheduled for ${date}: \"${text}\"`;\n},\nnotificationTexts(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/edit-entry-message-spec.js",
"new_path": "lib/shared/messages/edit-entry-message-spec.js",
"diff": "@@ -16,6 +16,7 @@ import type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\nimport { prettyDate } from '../../utils/date-utils';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -123,12 +124,11 @@ export const editEntryMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(messageInfo: EditEntryMessageInfo, creator: string): string {\n+ robotext(messageInfo: EditEntryMessageInfo): EntityText {\nconst date = prettyDate(messageInfo.date);\n- return (\n- `${creator} updated the text of an event scheduled for ` +\n- `${date}: \"${encodeURI(messageInfo.text)}\"`\n- );\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const { text } = messageInfo;\n+ return ET`${creator} updated the text of an event scheduled for ${date}: \"${text}\"`;\n},\nnotificationTexts(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/restore-entry-message-spec.js",
"new_path": "lib/shared/messages/restore-entry-message-spec.js",
"diff": "@@ -16,6 +16,7 @@ import type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\nimport { prettyDate } from '../../utils/date-utils';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -123,12 +124,11 @@ export const restoreEntryMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(messageInfo: RestoreEntryMessageInfo, creator: string): string {\n+ robotext(messageInfo: RestoreEntryMessageInfo): EntityText {\nconst date = prettyDate(messageInfo.date);\n- return (\n- `${creator} restored an event scheduled for ${date}: ` +\n- `\"${encodeURI(messageInfo.text)}\"`\n- );\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ const { text } = messageInfo;\n+ return ET`${creator} restored an event scheduled for ${date}: \"${text}\"`;\n},\nnotificationTexts(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert entry robotexts to use EntityText
Summary: Depends on D6515
Test Plan: Looked at a `CreateEntry` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6516 |
129,187 | 01.02.2023 20:54:45 | 18,000 | 5fd8fb36ef7880a56c3d1717e615ea976dd954a3 | [lib] Convert CreateSidebar/CreateThread robotext to use EntityText
Summary: Depends on D6517
Test Plan: Looked at a `CreateSidebar` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/create-sidebar-message-spec.js",
"new_path": "lib/shared/messages/create-sidebar-message-spec.js",
"diff": "@@ -17,6 +17,11 @@ import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import {\n+ ET,\n+ type EntityText,\n+ pluralizeEntityText,\n+} from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -29,7 +34,6 @@ import {\ntype CreateMessageInfoParams,\ntype MessageSpec,\ntype MessageTitleParam,\n- type RobotextParams,\n} from './message-spec';\nimport { assertSingleMessageInfo } from './utils';\n@@ -164,23 +168,22 @@ export const createSidebarMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: CreateSidebarMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n- let text = `started ${params.encodedThreadEntity(\n- messageInfo.threadID,\n- `this thread`,\n- )}`;\n+ robotext(messageInfo: CreateSidebarMessageInfo): EntityText {\n+ let text = ET`started ${ET.thread({\n+ display: 'alwaysDisplayShortName',\n+ threadID: messageInfo.threadID,\n+ })}`;\nconst users = messageInfo.initialThreadState.otherMembers.filter(\nmember => member.id !== messageInfo.sourceMessageAuthor.id,\n);\nif (users.length !== 0) {\n- const initialUsersString = params.robotextForUsers(users);\n- text += ` and added ${initialUsersString}`;\n+ const initialUsers = pluralizeEntityText(\n+ users.map(user => ET`${ET.user({ userInfo: user })}`),\n+ );\n+ text = ET`${text} and added ${initialUsers}`;\n}\n- return `${creator} ${text}`;\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ return ET`${creator} ${text}`;\n},\nshimUnsupportedMessageInfo(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/create-thread-message-spec.js",
"new_path": "lib/shared/messages/create-thread-message-spec.js",
"diff": "@@ -15,6 +15,11 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import {\n+ ET,\n+ type EntityText,\n+ pluralizeEntityText,\n+} from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -27,7 +32,6 @@ import {\ntype MessageSpec,\ntype MessageTitleParam,\ntype NotificationTextsParams,\n- type RobotextParams,\n} from './message-spec';\nimport { assertSingleMessageInfo } from './utils';\n@@ -141,32 +145,30 @@ export const createThreadMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: CreateThreadMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n- let text = `created ${params.encodedThreadEntity(\n- messageInfo.threadID,\n- `this chat`,\n- )}`;\n+ robotext(messageInfo: CreateThreadMessageInfo): EntityText {\n+ let text = ET`created ${ET.thread({\n+ display: 'alwaysDisplayShortName',\n+ threadID: messageInfo.threadID,\n+ })}`;\nconst parentThread = messageInfo.initialThreadState.parentThreadInfo;\nif (parentThread) {\n- text +=\n- ' as a child of ' +\n- `<${encodeURI(parentThread.uiName)}|t${parentThread.id}>`;\n+ text = ET`${text} as a child of ${ET.thread({\n+ display: 'uiName',\n+ threadInfo: parentThread,\n+ })}`;\n}\nif (messageInfo.initialThreadState.name) {\n- text += ` with the name \"${encodeURI(\n- messageInfo.initialThreadState.name,\n- )}\"`;\n+ text = ET`${text} with the name \"${messageInfo.initialThreadState.name}\"`;\n}\nconst users = messageInfo.initialThreadState.otherMembers;\nif (users.length !== 0) {\n- const initialUsersString = params.robotextForUsers(users);\n- text += ` and added ${initialUsersString}`;\n+ const initialUsers = pluralizeEntityText(\n+ users.map(user => ET`${ET.user({ userInfo: user })}`),\n+ );\n+ text = ET`${text} and added ${initialUsers}`;\n}\n- return `${creator} ${text}`;\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ return ET`${creator} ${text}`;\n},\nnotificationTexts(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert CreateSidebar/CreateThread robotext to use EntityText
Summary: Depends on D6517
Test Plan: Looked at a `CreateSidebar` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6518 |
129,187 | 01.02.2023 21:07:34 | 18,000 | adccdeb5dec21a1d1f8d65187aa6b852bf49558b | [lib] Convert UpdateRelationship robotext to use EntityText
Summary: Depends on D6519
Test Plan: Looked at an `UpdateRelationship` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/update-relationship-message-spec.js",
"new_path": "lib/shared/messages/update-relationship-message-spec.js",
"diff": "@@ -17,6 +17,7 @@ import type {\nimport type { NotifTexts } from '../../types/notif-types';\nimport type { ThreadInfo } from '../../types/thread-types';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -29,7 +30,6 @@ import {\ntype CreateMessageInfoParams,\ntype MessageSpec,\ntype MessageTitleParam,\n- type RobotextParams,\n} from './message-spec';\nimport { assertSingleMessageInfo } from './utils';\n@@ -131,19 +131,17 @@ export const updateRelationshipMessageSpec: MessageSpec<\nreturn { ...messageData, id };\n},\n- robotext(\n- messageInfo: UpdateRelationshipMessageInfo,\n- creator: string,\n- params: RobotextParams,\n- ): string {\n- const target = params.robotextForUser(messageInfo.target);\n+ robotext(messageInfo: UpdateRelationshipMessageInfo): EntityText {\n+ const creator = ET.user({ userInfo: messageInfo.creator });\nif (messageInfo.operation === 'request_sent') {\n- return `${creator} sent ${target} a friend request`;\n+ const target = ET.user({ userInfo: messageInfo.target });\n+ return ET`${creator} sent ${target} a friend request`;\n} else if (messageInfo.operation === 'request_accepted') {\n- const targetPossessive = messageInfo.target.isViewer\n- ? 'your'\n- : `${target}'s`;\n- return `${creator} accepted ${targetPossessive} friend request`;\n+ const targetPossessive = ET.user({\n+ userInfo: messageInfo.target,\n+ possessive: true,\n+ });\n+ return ET`${creator} accepted ${targetPossessive} friend request`;\n}\ninvariant(\nfalse,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert UpdateRelationship robotext to use EntityText
Summary: Depends on D6519
Test Plan: Looked at an `UpdateRelationship` robotext on web and native, both from the perspective of the viewer and of somebody else
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6520 |
129,187 | 01.02.2023 21:09:27 | 18,000 | ebdd947d7d78d0c968873bef5c01e20fffdb01ab | [lib] Convert Unsupported robotext to use EntityText
Summary: Depends on D6520
Test Plan: Flow
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/messages/unsupported-message-spec.js",
"new_path": "lib/shared/messages/unsupported-message-spec.js",
"diff": "@@ -11,6 +11,7 @@ import type {\nUnsupportedMessageInfo,\n} from '../../types/messages/unsupported';\nimport type { RelativeUserInfo } from '../../types/user-types';\n+import { ET, type EntityText } from '../../utils/entity-text';\nimport {\nrobotextToRawString,\nrobotextForMessageInfo,\n@@ -87,11 +88,12 @@ export const unsupportedMessageSpec: MessageSpec<\n);\n},\n- robotext(messageInfo: UnsupportedMessageInfo, creator: string): string {\n+ robotext(messageInfo: UnsupportedMessageInfo): EntityText {\nif (messageInfo.dontPrefixCreator) {\n- return messageInfo.robotext;\n+ return ET`${messageInfo.robotext}`;\n}\n- return `${creator} ${messageInfo.robotext}`;\n+ const creator = ET.user({ userInfo: messageInfo.creator });\n+ return ET`${creator} ${messageInfo.robotext}`;\n},\ngeneratesNotifs: async () => pushTypes.NOTIF,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Convert Unsupported robotext to use EntityText
Summary: Depends on D6520
Test Plan: Flow
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6521 |
129,187 | 02.02.2023 09:30:38 | 18,000 | dbde4a826a66f0b1e5f93eea09084537527825d6 | [web] Convert RobotextMessage to hook
Summary:
This will make it a little easier to call `useENSNames`, and the component is better suited as a hook anyways.
Depends on D6526
Test Plan: Make sure that robotext messages still render on web. Also Flow
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -26,60 +26,62 @@ const availableTooltipPositionsForRobotext = [\ntooltipPositions.RIGHT_BOTTOM,\n];\n-type BaseProps = {\n+type Props = {\n+item: RobotextChatMessageInfoItem,\n+threadInfo: ThreadInfo,\n};\n-type Props = {\n- ...BaseProps,\n- +onMouseLeave: ?() => mixed,\n- +onMouseEnter: (event: SyntheticEvent<HTMLDivElement>) => mixed,\n-};\n-class RobotextMessage extends React.PureComponent<Props> {\n- render() {\n+function RobotextMessage(props: Props): React.Node {\nlet inlineEngagement;\n- if (\n- this.props.item.threadCreatedFromMessage ||\n- this.props.item.reactions.size > 0\n- ) {\n+ const { item } = props;\n+ const { threadCreatedFromMessage, reactions } = item;\n+ if (threadCreatedFromMessage || reactions.size > 0) {\ninlineEngagement = (\n<div className={css.sidebarMarginTop}>\n<InlineEngagement\n- threadInfo={this.props.item.threadCreatedFromMessage}\n- reactions={this.props.item.reactions}\n+ threadInfo={threadCreatedFromMessage}\n+ reactions={reactions}\npositioning=\"center\"\n/>\n</div>\n);\n}\n+ const { messageInfo, robotext } = item;\n+ const { threadID } = messageInfo;\n+ const textParts = React.useMemo(() => {\n+ return entityTextToReact(robotext, threadID, {\n+ // eslint-disable-next-line react/display-name\n+ renderText: ({ text }) => (\n+ <Markdown rules={linkRules(false)}>{text}</Markdown>\n+ ),\n+ // eslint-disable-next-line react/display-name\n+ renderThread: ({ id, name }) => <ThreadEntity id={id} name={name} />,\n+ // eslint-disable-next-line react/display-name\n+ renderColor: ({ hex }) => <ColorEntity color={hex} />,\n+ });\n+ }, [robotext, threadID]);\n+\n+ const { threadInfo } = props;\n+ const { onMouseEnter, onMouseLeave } = useMessageTooltip({\n+ item,\n+ threadInfo,\n+ availablePositions: availableTooltipPositionsForRobotext,\n+ });\n+\nreturn (\n<div className={css.robotextContainer}>\n<div\nclassName={css.innerRobotextContainer}\n- onMouseEnter={this.props.onMouseEnter}\n- onMouseLeave={this.props.onMouseLeave}\n+ onMouseEnter={onMouseEnter}\n+ onMouseLeave={onMouseLeave}\n>\n- <span>{this.linkedRobotext()}</span>\n+ <span>{textParts}</span>\n</div>\n{inlineEngagement}\n</div>\n);\n}\n- linkedRobotext() {\n- const { item } = this.props;\n- const { robotext } = item;\n- const { threadID } = item.messageInfo;\n- return entityTextToReact(robotext, threadID, {\n- renderText: ({ text }) => (\n- <Markdown rules={linkRules(false)}>{text}</Markdown>\n- ),\n- renderThread: ({ id, name }) => <ThreadEntity id={id} name={name} />,\n- renderColor: ({ hex }) => <ColorEntity color={hex} />,\n- });\n- }\n-}\ntype BaseInnerThreadEntityProps = {\n+id: string,\n+name: string,\n@@ -126,24 +128,8 @@ function ColorEntity(props: { color: string }) {\nreturn <span style={colorStyle}>{props.color}</span>;\n}\n-const ConnectedRobotextMessage: React.ComponentType<BaseProps> = React.memo<BaseProps>(\n- function ConnectedRobotextMessage(props) {\n- const { item, threadInfo } = props;\n-\n- const { onMouseLeave, onMouseEnter } = useMessageTooltip({\n- item,\n- threadInfo,\n- availablePositions: availableTooltipPositionsForRobotext,\n- });\n-\n- return (\n- <RobotextMessage\n- {...props}\n- onMouseLeave={onMouseLeave}\n- onMouseEnter={onMouseEnter}\n- />\n- );\n- },\n+const MemoizedRobotextMessage: React.ComponentType<Props> = React.memo<Props>(\n+ RobotextMessage,\n);\n-export default ConnectedRobotextMessage;\n+export default MemoizedRobotextMessage;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Convert RobotextMessage to hook
Summary:
This will make it a little easier to call `useENSNames`, and the component is better suited as a hook anyways.
Depends on D6526
Test Plan: Make sure that robotext messages still render on web. Also Flow
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6527 |
129,187 | 02.02.2023 09:31:43 | 18,000 | 6f9d494a4ad01107a1a2f8aeff0b8e401acdfcba | [lib][native][web] Fetch ENS names for robotext messages
Summary:
Woohoo!!
Depends on D6527
Test Plan:
| `web` | `native` |
| {F358142} | {F358143} |
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/entity-text.js",
"new_path": "lib/utils/entity-text.js",
"diff": "import invariant from 'invariant';\nimport * as React from 'react';\n+import { useENSNames } from '../hooks/ens-cache';\nimport { threadNoun } from '../shared/thread-utils';\nimport { stringForUser } from '../shared/user-utils';\nimport {\n@@ -326,4 +327,28 @@ function pluralizeEntityText(\n);\n}\n-export { ET, entityTextToRawString, entityTextToReact, pluralizeEntityText };\n+function useENSNamesForEntityText(entityText: EntityText): EntityText {\n+ const allObjects = React.useMemo(\n+ () =>\n+ entityText.map(entity =>\n+ typeof entity === 'string' ? { type: 'text', text: entity } : entity,\n+ ),\n+ [entityText],\n+ );\n+ const objectsWithENSNames = useENSNames(allObjects);\n+ return React.useMemo(\n+ () =>\n+ objectsWithENSNames.map(entity =>\n+ entity.type === 'text' ? entity.text : entity,\n+ ),\n+ [objectsWithENSNames],\n+ );\n+}\n+\n+export {\n+ ET,\n+ entityTextToRawString,\n+ entityTextToReact,\n+ pluralizeEntityText,\n+ useENSNamesForEntityText,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/inner-robotext-message.react.js",
"new_path": "native/chat/inner-robotext-message.react.js",
"diff": "@@ -8,6 +8,7 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport {\nentityTextToReact,\nentityTextToRawString,\n+ useENSNamesForEntityText,\ntype EntityText,\n} from 'lib/utils/entity-text';\n@@ -43,9 +44,10 @@ function InnerRobotextMessage(props: InnerRobotextMessageProps): React.Node {\nconst { messageInfo, robotext } = item;\nconst { threadID } = messageInfo;\n+ const robotextWithENSNames = useENSNamesForEntityText(robotext);\nconst textParts = React.useMemo(() => {\nconst darkColor = activeTheme === 'dark';\n- return entityTextToReact(robotext, threadID, {\n+ return entityTextToReact(robotextWithENSNames, threadID, {\n// eslint-disable-next-line react/display-name\nrenderText: ({ text }) => (\n<Markdown\n@@ -60,7 +62,7 @@ function InnerRobotextMessage(props: InnerRobotextMessageProps): React.Node {\n// eslint-disable-next-line react/display-name\nrenderColor: ({ hex }) => <ColorEntity color={hex} />,\n});\n- }, [robotext, activeTheme, threadID, styles.robotext]);\n+ }, [robotextWithENSNames, activeTheme, threadID, styles.robotext]);\nconst viewStyle = [styles.robotextContainer];\nif (!__DEV__) {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -7,7 +7,10 @@ import { type RobotextChatMessageInfoItem } from 'lib/selectors/chat-selectors';\nimport { threadInfoSelector } from 'lib/selectors/thread-selectors';\nimport type { Dispatch } from 'lib/types/redux-types';\nimport { type ThreadInfo } from 'lib/types/thread-types';\n-import { entityTextToReact } from 'lib/utils/entity-text';\n+import {\n+ entityTextToReact,\n+ useENSNamesForEntityText,\n+} from 'lib/utils/entity-text';\nimport Markdown from '../markdown/markdown.react';\nimport { linkRules } from '../markdown/rules.react';\n@@ -48,8 +51,9 @@ function RobotextMessage(props: Props): React.Node {\nconst { messageInfo, robotext } = item;\nconst { threadID } = messageInfo;\n+ const robotextWithENSNames = useENSNamesForEntityText(robotext);\nconst textParts = React.useMemo(() => {\n- return entityTextToReact(robotext, threadID, {\n+ return entityTextToReact(robotextWithENSNames, threadID, {\n// eslint-disable-next-line react/display-name\nrenderText: ({ text }) => (\n<Markdown rules={linkRules(false)}>{text}</Markdown>\n@@ -59,7 +63,7 @@ function RobotextMessage(props: Props): React.Node {\n// eslint-disable-next-line react/display-name\nrenderColor: ({ hex }) => <ColorEntity color={hex} />,\n});\n- }, [robotext, threadID]);\n+ }, [robotextWithENSNames, threadID]);\nconst { threadInfo } = props;\nconst { onMouseEnter, onMouseLeave } = useMessageTooltip({\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib][native][web] Fetch ENS names for robotext messages
Summary:
Woohoo!!
Depends on D6527
Test Plan:
| `web` | `native` |
| {F358142} | {F358143} |
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6528 |
129,184 | 02.02.2023 15:42:17 | 18,000 | aa8960579695bb6059c1a268fbe46a7e11336133 | [web] Change `modal_body` colors in `log-in-form.css`
Summary: Modify `modal_body` colors and replace outer glow with outline to match the SIWE web designs (https://www.figma.com/file/a1nkbWgbgjRlrOY9LVurTz/Comm-%2F-Desktop-app?node-id=7646%3A134916&t=6T70eVfC0cqPSbXJ-1)
Test Plan:
Before:
{F353927}
After:
{F353928}
Reviewers: ashoat, tomek, ginsu, rohan | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.css",
"new_path": "web/account/log-in-form.css",
"diff": "@@ -6,8 +6,8 @@ div.modal_body {\nmin-width: 320px;\npadding: 20px 40px;\nborder-radius: 16px;\n- background-color: var(--modal-bg);\n- box-shadow: 0 0 40px rgba(126, 87, 194, 0.5);\n+ background-color: #191723;\n+ outline: #282537 solid 1px;\n}\ndiv.form_title {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -20,7 +20,7 @@ hr:after {\npadding: 0 8px;\ncolor: white;\ncontent: 'or';\n- background-color: #1f1f1fff;\n+ background-color: #191723;\n}\ndiv.siweLoginFormContainer p {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Change `modal_body` colors in `log-in-form.css`
Summary: Modify `modal_body` colors and replace outer glow with outline to match the SIWE web designs (https://www.figma.com/file/a1nkbWgbgjRlrOY9LVurTz/Comm-%2F-Desktop-app?node-id=7646%3A134916&t=6T70eVfC0cqPSbXJ-1)
Test Plan:
Before:
{F353927}
After:
{F353928}
Reviewers: ashoat, tomek, ginsu, rohan
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6481 |
129,184 | 02.02.2023 15:11:34 | 18,000 | 875a654c9d7a63a2f28ced6484e65384db8ade6e | [web] Fix "Go back" button copy
Summary: Should be "Back to sing in with username" with left chevron icon instead of just "Go back"
Test Plan: NA, looks as expected
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/siwe-login-form.react.js",
"new_path": "web/account/siwe-login-form.react.js",
"diff": "@@ -33,6 +33,7 @@ import LoadingIndicator from '../loading-indicator.react';\nimport { setPrimaryIdentityPublicKey } from '../redux/primary-identity-public-key-reducer';\nimport { useSelector } from '../redux/redux-utils';\nimport { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';\n+import SWMansionIcon from '../SWMansionIcon.react.js';\nimport css from './siwe.css';\ntype SIWELoginFormProps = {\n@@ -151,7 +152,8 @@ function SIWELoginForm(props: SIWELoginFormProps): React.Node {\n</Button>\n<OrBreak />\n<Button variant=\"filled\" onClick={cancelSIWEAuthFlow}>\n- Go back\n+ <SWMansionIcon icon=\"chevron-left\" size={18} />\n+ Back to sign in with username\n</Button>\n</div>\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix "Go back" button copy
Summary: Should be "Back to sing in with username" with left chevron icon instead of just "Go back"
Test Plan: NA, looks as expected
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6536 |
129,184 | 02.02.2023 15:20:31 | 18,000 | 95f6cea97c5102151dee93966d1960b4d7fb22e5 | [web] Add "Sign in with Ethereum" header to `SIWELoginForm`
Summary: Add header to label `SIWELoginForm` and match designs.
Test Plan:
Looks as expected:
{F358585}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/siwe-login-form.react.js",
"new_path": "web/account/siwe-login-form.react.js",
"diff": "@@ -137,6 +137,10 @@ function SIWELoginForm(props: SIWELoginFormProps): React.Node {\nreturn (\n<div className={css.siweLoginFormContainer}>\n+ <h4>Sign in with Ethereum</h4>\n+ <div className={css.headerSeparator}>\n+ <hr />\n+ </div>\n<div className={css.connectButtonContainer}>\n<ConnectButton />\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -13,6 +13,17 @@ div.siweLoginFormContainer p {\nfont-size: 14px;\n}\n+div.siweLoginFormContainer h4 {\n+ color: white;\n+ font-family: sans-serif;\n+}\n+\n+div.headerSeparator hr {\n+ margin: 8px 0;\n+ border: none;\n+ border-top: #282537 solid 1px;\n+}\n+\ndiv.siweLoginFormContainer {\ndisplay: flex;\nflex-direction: column;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Add "Sign in with Ethereum" header to `SIWELoginForm`
Summary: Add header to label `SIWELoginForm` and match designs.
Test Plan:
Looks as expected:
{F358585}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6537 |
129,184 | 02.02.2023 16:07:14 | 18,000 | 6ec89efb0267f16ec92fcd96cd08eb0e7190bb91 | [web] Merge `siweMessageSigningExplanationStatements` into `string` and left-align
Summary: Personally think this looks better than before. Got signoff from design team: Can revert if there's any disagreement with this change.
Test Plan:
Before:
{F358786}
After:
{F358787}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "landing/siwe.react.js",
"new_path": "landing/siwe.react.js",
"diff": "@@ -134,8 +134,7 @@ function SIWE(): React.Node {\n<span className={css.walletDisplayText}>Wallet Connected:</span>\n<ConnectButton />\n</div>\n- <p>{siweMessageSigningExplanationStatements[0]}</p>\n- <p>{siweMessageSigningExplanationStatements[1]}</p>\n+ <p>{siweMessageSigningExplanationStatements}</p>\n<p>\nBy signing up, you agree to our{' '}\n<a href=\"https://comm.app/terms\">Terms of Use</a> &{' '}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe-login-form.react.js",
"new_path": "web/account/siwe-login-form.react.js",
"diff": "@@ -144,8 +144,7 @@ function SIWELoginForm(props: SIWELoginFormProps): React.Node {\n<div className={css.connectButtonContainer}>\n<ConnectButton />\n</div>\n- <p>{siweMessageSigningExplanationStatements[0]}</p>\n- <p>{siweMessageSigningExplanationStatements[1]}</p>\n+ <p>{siweMessageSigningExplanationStatements}</p>\n<p>\nBy signing up, you agree to our{' '}\n<a href=\"https://comm.app/terms\">Terms of Use</a> &{' '}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -8,9 +8,8 @@ div.ethereumLogoContainer {\ndiv.siweLoginFormContainer p {\ncolor: white;\nfont-family: sans-serif;\n- text-align: center;\npadding-bottom: 20px;\n- font-size: 14px;\n+ font-size: 15px;\n}\ndiv.siweLoginFormContainer h4 {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Merge `siweMessageSigningExplanationStatements` into `string` and left-align
Summary: Personally think this looks better than before. Got signoff from design team: https://blob.sh/5e90d1.png. Can revert if there's any disagreement with this change.
Test Plan:
Before:
{F358786}
After:
{F358787}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6539 |
129,184 | 02.02.2023 16:24:20 | 18,000 | 206b25506a8b037125972d7aa5fff8b873c35403 | [web] Change "Log in" to "Sign in" in `TraditionalLoginForm`
Summary: To match the designs (I realize that similar changes will need to be made on `native` and whatnot... will sequence that later)
Test Plan: NA
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/traditional-login-form.react.js",
"new_path": "web/account/traditional-login-form.react.js",
"diff": "@@ -120,7 +120,7 @@ function TraditionalLoginForm(): React.Node {\nif (inputDisabled) {\nreturn <LoadingIndicator status=\"loading\" />;\n}\n- return 'Log in';\n+ return 'Sign in';\n}, [inputDisabled]);\nreturn (\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Change "Log in" to "Sign in" in `TraditionalLoginForm`
Summary: To match the designs (I realize that similar changes will need to be made on `native` and whatnot... will sequence that later)
Test Plan: NA
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6542 |
129,184 | 02.02.2023 16:31:03 | 18,000 | b57aa8841915fd37b120727441ef89b87f3ab046 | [web] Introduce `HeaderSeparator`
Summary: Same as with `OrBreak` (which I'll rename to `OrSeparator`), want to use this on both `TraditionalLoginForm` and `SIWELoginForm`.
Test Plan: NA, the `hr` in `SIWELoginForm` continues to look as expected.
Reviewers: ashoat, tomek | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/account/header-separator.css",
"diff": "+div.headerSeparator hr {\n+ margin: 8px 0;\n+ border: none;\n+ border-top: #282537 solid 1px;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/account/header-separator.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+\n+import css from './header-separator.css';\n+\n+function HeaderSeparator(): React.Node {\n+ return (\n+ <div className={css.headerSeparator}>\n+ <hr />\n+ </div>\n+ );\n+}\n+\n+export default HeaderSeparator;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe-login-form.react.js",
"new_path": "web/account/siwe-login-form.react.js",
"diff": "@@ -34,6 +34,7 @@ import { setPrimaryIdentityPublicKey } from '../redux/primary-identity-public-ke\nimport { useSelector } from '../redux/redux-utils';\nimport { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';\nimport SWMansionIcon from '../SWMansionIcon.react.js';\n+import HeaderSeparator from './header-separator.react.js';\nimport css from './siwe.css';\ntype SIWELoginFormProps = {\n@@ -143,9 +144,7 @@ function SIWELoginForm(props: SIWELoginFormProps): React.Node {\nreturn (\n<div className={css.siweLoginFormContainer}>\n<h4>Sign in with Ethereum</h4>\n- <div className={css.headerSeparator}>\n- <hr />\n- </div>\n+ <HeaderSeparator />\n<div className={css.connectButtonContainer}>\n<ConnectButton />\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -17,12 +17,6 @@ div.siweLoginFormContainer h4 {\nfont-family: sans-serif;\n}\n-div.headerSeparator hr {\n- margin: 8px 0;\n- border: none;\n- border-top: #282537 solid 1px;\n-}\n-\ndiv.siweLoginFormContainer {\ndisplay: flex;\nflex-direction: column;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Introduce `HeaderSeparator`
Summary: Same as with `OrBreak` (which I'll rename to `OrSeparator`), want to use this on both `TraditionalLoginForm` and `SIWELoginForm`.
Test Plan: NA, the `hr` in `SIWELoginForm` continues to look as expected.
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6543 |
129,184 | 02.02.2023 16:36:53 | 18,000 | 3a2230af635f5cfad8e5fa2f9b61459d7ef069ab | [web] Add "Sign in to Comm" header to `TraditionalLoginForm`
Summary: To match what's in designs.
Test Plan:
Here's what it looks like:
{F358923}
(vertical spacing/padding/margin/whatever will be addressed in a later diff)
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.css",
"new_path": "web/account/log-in-form.css",
"diff": "@@ -10,6 +10,11 @@ div.modal_body {\noutline: #282537 solid 1px;\n}\n+div.modal_body h4 {\n+ color: white;\n+ font-family: sans-serif;\n+}\n+\ndiv.form_title {\npadding: 6px 6px 0 0;\nfont-size: var(--s-font-14);\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/siwe.css",
"new_path": "web/account/siwe.css",
"diff": "@@ -12,11 +12,6 @@ div.siweLoginFormContainer p {\nfont-size: 15px;\n}\n-div.siweLoginFormContainer h4 {\n- color: white;\n- font-family: sans-serif;\n-}\n-\ndiv.siweLoginFormContainer {\ndisplay: flex;\nflex-direction: column;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/traditional-login-form.react.js",
"new_path": "web/account/traditional-login-form.react.js",
"diff": "@@ -25,6 +25,7 @@ import LoadingIndicator from '../loading-indicator.react.js';\nimport Input from '../modals/input.react.js';\nimport { useSelector } from '../redux/redux-utils.js';\nimport { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';\n+import HeaderSeparator from './header-separator.react.js';\nimport css from './log-in-form.css';\nimport PasswordInput from './password-input.react.js';\n@@ -126,6 +127,8 @@ function TraditionalLoginForm(): React.Node {\nreturn (\n<form method=\"POST\">\n<div>\n+ <h4>Sign in to Comm</h4>\n+ <HeaderSeparator />\n<div className={css.form_title}>Username</div>\n<div className={css.form_content}>\n<Input\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Add "Sign in to Comm" header to `TraditionalLoginForm`
Summary: To match what's in designs.
Test Plan:
Here's what it looks like:
{F358923}
(vertical spacing/padding/margin/whatever will be addressed in a later diff)
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6544 |
129,184 | 02.02.2023 17:19:07 | 18,000 | badc90a39f78352d78d1479ea9c537aefcd91b6c | [web] Restyle `LoginForm` inputs to match designs
Summary: Restyle the text/password inputs in `LoginForm` to match the designs.
Test Plan:
Before:
{F358979}
After:
{F359026}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.css",
"new_path": "web/account/log-in-form.css",
"diff": "@@ -47,3 +47,23 @@ div.modal_form_error {\npadding-left: 6px;\nalign-self: center;\n}\n+\n+div.modal_body .input[type='text'],\n+div.modal_body .input[type='password'] {\n+ background: #282537;\n+ border: 1px solid #211e2d;\n+ transition: border 0.35s ease;\n+ border-radius: 8px;\n+}\n+\n+div.modal_body .input[type='text']::placeholder,\n+div.modal_body .input[type='password']::placeholder {\n+ color: #8c889b;\n+}\n+\n+div.modal_body .input[type='text']:focus,\n+div.modal_body .input[type='password']:focus {\n+ outline: none;\n+ border: #6a20e399 solid 1px;\n+ transition: border 0.35s ease;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/password-input.css",
"new_path": "web/account/password-input.css",
"diff": "margin: 7px;\npadding: 6px;\nborder: 0;\n- border-radius: 50%;\n- color: var(--fg);\n+ color: #8c889b;\n+ transition: color 0.3s ease;\n}\n.button:hover {\n- background-color: var(--show-password-bg-hover);\n+ color: #ffffff;\n+ transition: color 0.3s ease;\n}\n.wrapper {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/account/traditional-login-form.react.js",
"new_path": "web/account/traditional-login-form.react.js",
"diff": "@@ -132,6 +132,7 @@ function TraditionalLoginForm(): React.Node {\n<div className={css.form_title}>Username</div>\n<div className={css.form_content}>\n<Input\n+ className={css.input}\ntype=\"text\"\nplaceholder=\"Username\"\nvalue={username}\n@@ -146,6 +147,7 @@ function TraditionalLoginForm(): React.Node {\n<div className={css.form_title}>Password</div>\n<div className={css.form_content}>\n<PasswordInput\n+ className={css.input}\nvalue={password}\nonChange={onPasswordChange}\ndisabled={inputDisabled}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/components/button.css",
"new_path": "web/components/button.css",
"diff": ".btn {\n--border-width: 1px;\n- --border-radius: 4px;\n+ --border-radius: 8px;\nposition: relative;\nfont-size: var(--m-font-16);\n"
},
{
"change_type": "MODIFY",
"old_path": "web/theme.css",
"new_path": "web/theme.css",
"diff": "--success: var(--success-dark-50);\n/* Color Theme */\n- --btn-bg-filled: var(--violet-dark-100);\n+\n+ /* Feb 2023: New color that will be introduced in updated design system. */\n+ --btn-bg-filled: #6a20e3;\n--btn-bg-outline: var(--shades-black-90);\n--btn-bg-success: var(--success-dark-50);\n--btn-bg-danger: var(--error-primary);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Restyle `LoginForm` inputs to match designs
Summary: Restyle the text/password inputs in `LoginForm` to match the designs.
Test Plan:
Before:
{F358979}
After:
{F359026}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6545 |
129,184 | 02.02.2023 17:44:57 | 18,000 | 6f890fbc35631d715b0dd810ac618f2d6937b956 | [web] Equalize `modal_body` vertical/horizontal padding
Summary: Makes things look more symmetrical.
Test Plan:
Before:
{F359071}
After:
{F359072}
Reviewers: ashoat, tomek | [
{
"change_type": "MODIFY",
"old_path": "web/account/log-in-form.css",
"new_path": "web/account/log-in-form.css",
"diff": "@@ -3,8 +3,8 @@ div.modal_body {\nflex-direction: column;\njustify-content: center;\nmin-height: 324px;\n- min-width: 320px;\n- padding: 20px 40px;\n+ min-width: 360px;\n+ padding: 20px 20px;\nborder-radius: 16px;\nbackground-color: #191723;\noutline: #282537 solid 1px;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Equalize `modal_body` vertical/horizontal padding
Summary: Makes things look more symmetrical.
Test Plan:
Before:
{F359071}
After:
{F359072}
Reviewers: ashoat, tomek
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D6547 |
129,184 | 04.02.2023 18:09:13 | 18,000 | bd5cf541b539459ffb8d07adc283022381153e5b | [native] `codeVersion` -> 183 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 182\n- versionName '1.0.182'\n+ versionCode 183\n+ versionName '1.0.183'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{182};\n+ const int codeVersion{183};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 182;\n+ CURRENT_PROJECT_VERSION = 183;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.182;\n+ MARKETING_VERSION = 1.0.183;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 182;\n+ CURRENT_PROJECT_VERSION = 183;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.182;\n+ MARKETING_VERSION = 1.0.183;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.182</string>\n+ <string>1.0.183</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>182</string>\n+ <string>183</string>\n<key>CFBundleURLTypes</key>\n<array>\n<dict>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.182</string>\n+ <string>1.0.183</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>182</string>\n+ <string>183</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 183 |
129,184 | 04.02.2023 18:12:17 | 18,000 | 349a77a091680b0f2e661300196495ae554c08e9 | [native] `codeVersion` -> 184 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -471,8 +471,8 @@ android {\napplicationId 'app.comm.android'\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 183\n- versionName '1.0.183'\n+ versionCode 184\n+ versionName '1.0.184'\nbuildConfigField \"boolean\", \"IS_NEW_ARCHITECTURE_ENABLED\", isNewArchitectureEnabled().toString()\nif (isNewArchitectureEnabled()) {\n// We configure the CMake build only if you decide to opt-in for the New Architecture.\n"
},
{
"change_type": "MODIFY",
"old_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"new_path": "native/cpp/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -13,7 +13,7 @@ namespace comm {\nnamespace jsi = facebook::jsi;\nclass CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\n- const int codeVersion{183};\n+ const int codeVersion{184};\nstd::unique_ptr<WorkerThread> cryptoThread;\nCommSecureStore secureStore;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"new_path": "native/ios/Comm.xcodeproj/project.pbxproj",
"diff": "CODE_SIGN_IDENTITY = \"Apple Development\";\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\n- CURRENT_PROJECT_VERSION = 183;\n+ CURRENT_PROJECT_VERSION = 184;\nDEBUG_INFORMATION_FORMAT = dwarf;\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.183;\n+ MARKETING_VERSION = 1.0.184;\nMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\nMTL_FAST_MATH = YES;\nOTHER_CFLAGS = (\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCODE_SIGN_STYLE = Automatic;\nCOPY_PHASE_STRIP = NO;\n- CURRENT_PROJECT_VERSION = 183;\n+ CURRENT_PROJECT_VERSION = 184;\nDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\nDEVELOPMENT_TEAM = H98Y8MH53M;\n\"EXCLUDED_ARCHS[sdk=iphonesimulator*]\" = arm64;\n\"@executable_path/Frameworks\",\n\"@executable_path/../../Frameworks\",\n);\n- MARKETING_VERSION = 1.0.183;\n+ MARKETING_VERSION = 1.0.184;\nMTL_FAST_MATH = YES;\nONLY_ACTIVE_ARCH = YES;\nOTHER_CFLAGS = (\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.debug.plist",
"new_path": "native/ios/Comm/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.183</string>\n+ <string>1.0.184</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>183</string>\n+ <string>184</string>\n<key>CFBundleURLTypes</key>\n<array>\n<dict>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/Comm/Info.release.plist",
"new_path": "native/ios/Comm/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>1.0.183</string>\n+ <string>1.0.184</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>183</string>\n+ <string>184</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>rainbow</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] `codeVersion` -> 184 |
129,187 | 03.02.2023 14:29:24 | 18,000 | 6572bd9e76635b35c21c30534bd792d9330aeabb | [lib] Pass object of props into createPendingSidebar
Summary:
I'm about to add some more props, so I figured it would be good to convert this to take an object now.
Depends on D6563
Test Plan: Flow
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -421,12 +421,19 @@ function createPendingThreadItem(\n};\n}\n-function createPendingSidebar(\n- sourceMessageInfo: ComposableMessageInfo | RobotextMessageInfo,\n- parentThreadInfo: ThreadInfo,\n- viewerID: string,\n- markdownRules: ParserRules,\n-): ThreadInfo {\n+type CreatePendingSidebarInput = {\n+ +sourceMessageInfo: ComposableMessageInfo | RobotextMessageInfo,\n+ +parentThreadInfo: ThreadInfo,\n+ +viewerID: string,\n+ +markdownRules: ParserRules,\n+};\n+function createPendingSidebar(input: CreatePendingSidebarInput): ThreadInfo {\n+ const {\n+ sourceMessageInfo,\n+ parentThreadInfo,\n+ viewerID,\n+ markdownRules,\n+ } = input;\nconst { color, type: parentThreadType } = parentThreadInfo;\nconst messageTitleEntityText = getMessageTitle(\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/sidebar-navigation.js",
"new_path": "native/chat/sidebar-navigation.js",
"diff": "@@ -26,12 +26,12 @@ function getSidebarThreadInfo(\n}\nconst { messageInfo, threadInfo } = sourceMessage;\n- return createPendingSidebar(\n- messageInfo,\n- threadInfo,\n+ return createPendingSidebar({\n+ sourceMessageInfo: messageInfo,\n+ parentThreadInfo: threadInfo,\nviewerID,\n- getDefaultTextMessageRules().simpleMarkdownRules,\n- );\n+ markdownRules: getDefaultTextMessageRules().simpleMarkdownRules,\n+ });\n}\nfunction useNavigateToSidebar(item: ChatMessageInfoItemWithHeight): () => void {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/selectors/thread-selectors.js",
"new_path": "web/selectors/thread-selectors.js",
"diff": "@@ -64,12 +64,12 @@ function useOnClickPendingSidebar(\nif (!viewerID) {\nreturn;\n}\n- const pendingSidebarInfo = createPendingSidebar(\n- messageInfo,\n- threadInfo,\n+ const pendingSidebarInfo = createPendingSidebar({\n+ sourceMessageInfo: messageInfo,\n+ parentThreadInfo: threadInfo,\nviewerID,\n- getDefaultTextMessageRules().simpleMarkdownRules,\n- );\n+ markdownRules: getDefaultTextMessageRules().simpleMarkdownRules,\n+ });\ndispatch({\ntype: updateNavInfoActionType,\npayload: {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Pass object of props into createPendingSidebar
Summary:
I'm about to add some more props, so I figured it would be good to convert this to take an object now.
Depends on D6563
Test Plan: Flow
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6564 |
129,187 | 03.02.2023 21:13:56 | 18,000 | 90cb990c058f9839753944365a48923f51430033 | [keyserver] Base setup of ethers.js and ENSCache
Summary: Most callsites in `keyserver` will probably interact with `getENSNames` directly, but exposing the others doesn't hurt.
Test Plan: Tested in combination with later notif diffs
Reviewers: atul
Subscribers: tomek | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "keyserver/src/utils/ens-cache.js",
"diff": "+// @flow\n+\n+import { ethers } from 'ethers';\n+\n+import { ENSCache, type EthersProvider } from 'lib/utils/ens-cache';\n+import {\n+ getENSNames as baseGetENSNames,\n+ type GetENSNames,\n+} from 'lib/utils/ens-helpers';\n+\n+const alchemyKey = process.env.COMM_ALCHEMY_KEY;\n+\n+let provider: ?EthersProvider;\n+if (alchemyKey) {\n+ provider = new ethers.providers.AlchemyProvider('mainnet', alchemyKey);\n+}\n+\n+let ensCache: ?ENSCache;\n+if (provider) {\n+ ensCache = new ENSCache(provider);\n+}\n+\n+let getENSNames: ?GetENSNames;\n+if (ensCache) {\n+ getENSNames = baseGetENSNames.bind(null, ensCache);\n+}\n+\n+export { provider, ensCache, getENSNames };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [keyserver] Base setup of ethers.js and ENSCache
Summary: Most callsites in `keyserver` will probably interact with `getENSNames` directly, but exposing the others doesn't hurt.
Test Plan: Tested in combination with later notif diffs
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6572 |
129,187 | 03.02.2023 21:15:24 | 18,000 | 99ef1cfaa4ebdfebdc7b42a6d9f7efec884bdd14 | [lib] Extend EntityText to support rendering thread names for notifs
Summary: Depends on D6572
Test Plan: Tested in combination with later notif diffs
Reviewers: atul, tomek | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/entity-text.js",
"new_path": "lib/utils/entity-text.js",
"diff": "@@ -212,6 +212,7 @@ function makePossessive(input: MakePossessiveInput) {\nfunction getNameForThreadEntity(\nentity: ThreadEntity,\nthreadID: ?string,\n+ params?: EntityTextToRawStringParams,\n): string {\nconst { name: userGeneratedName, display } = entity;\nif (entity.display === 'uiName') {\n@@ -222,12 +223,16 @@ function getNameForThreadEntity(\n`getNameForThreadEntity can't handle thread entity display ${display}`,\n);\n- let name = userGeneratedName;\n+ let { name } = entity;\nif (!name || entity.alwaysDisplayShortName) {\nconst threadType = entity.threadType ?? threadTypes.PERSONAL;\n- name = entity.subchannel ? 'subchannel' : threadNoun(threadType);\n+ const noun = entity.subchannel ? 'subchannel' : threadNoun(threadType);\nif (entity.id === threadID) {\n- name = `this ${name}`;\n+ const prefixThisThreadNounWith =\n+ params?.prefixThisThreadNounWith === 'your' ? 'your' : 'this';\n+ name = `${prefixThisThreadNounWith} ${noun}`;\n+ } else {\n+ name = `a ${noun}`;\n}\n}\nif (entity.possessive) {\n@@ -252,6 +257,7 @@ function getNameForUserEntity(\ntype EntityTextToRawStringParams = {\n+threadID?: ?string,\n+ignoreViewer?: ?boolean,\n+ +prefixThisThreadNounWith?: ?('this' | 'your'),\n};\nfunction entityTextToRawString(\nentityText: EntityText,\n@@ -261,7 +267,7 @@ function entityTextToRawString(\nif (typeof entity === 'string') {\nreturn entity;\n} else if (entity.type === 'thread') {\n- return getNameForThreadEntity(entity, params?.threadID);\n+ return getNameForThreadEntity(entity, params?.threadID, params);\n} else if (entity.type === 'color') {\nreturn entity.hex;\n} else if (entity.type === 'user') {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Extend EntityText to support rendering thread names for notifs
Summary: Depends on D6572
Test Plan: Tested in combination with later notif diffs
Reviewers: atul, tomek
Reviewed By: atul
Differential Revision: https://phab.comm.dev/D6573 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.