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,187 | 02.01.2019 22:30:33 | 18,000 | 7e12c1dbc89960c0c586cc28bdc42e681af3e125 | [server] Fix Flow | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/flow-typed/npm/react-dnd-html5-backend_vx.x.x.js",
"diff": "+// flow-typed signature: 3a65c86a3aa91668377c3aebf103505d\n+// flow-typed version: <<STUB>>/react-dnd-html5-backend_v^7.0.2/flow_v0.78.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'react-dnd-html5-backend'\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 'react-dnd-html5-backend' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+declare module 'react-dnd-html5-backend/dist/ReactDnDHTML5Backend' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/dist/ReactDnDHTML5Backend.min' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/BrowserDetector' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/EnterLeaveCounter' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/getEmptyImage' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/HTML5Backend' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/index' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/interfaces' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/MonotonicInterpolant' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/NativeDragSources' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/NativeTypes' {\n+ declare module.exports: any;\n+}\n+\n+declare module 'react-dnd-html5-backend/lib/OffsetUtils' {\n+ declare module.exports: any;\n+}\n+\n+// Filename aliases\n+declare module 'react-dnd-html5-backend/dist/ReactDnDHTML5Backend.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/dist/ReactDnDHTML5Backend'>;\n+}\n+declare module 'react-dnd-html5-backend/dist/ReactDnDHTML5Backend.min.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/dist/ReactDnDHTML5Backend.min'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/BrowserDetector.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/BrowserDetector'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/EnterLeaveCounter.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/EnterLeaveCounter'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/getEmptyImage.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/getEmptyImage'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/HTML5Backend.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/HTML5Backend'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/index.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/index'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/interfaces.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/interfaces'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/MonotonicInterpolant.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/MonotonicInterpolant'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/NativeDragSources.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/NativeDragSources'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/NativeTypes.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/NativeTypes'>;\n+}\n+declare module 'react-dnd-html5-backend/lib/OffsetUtils.js' {\n+ declare module.exports: $Exports<'react-dnd-html5-backend/lib/OffsetUtils'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"new_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"diff": "-// flow-typed signature: 502cfd4f5e95c6308f747cdf16dc93ce\n-// flow-typed version: 1751d5bf0a/react-redux_v5.x.x/flow_>=v0.68.0\n+// flow-typed signature: b872fdc4da6b0c1021c55df6fab87e73\n+// flow-typed version: f8afc4cfdd/react-redux_v5.x.x/flow_>=v0.68.0 <=v0.84.x\ndeclare module \"react-redux\" {\nimport type { ComponentType, ElementConfig } from 'react';\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Fix Flow |
129,187 | 03.01.2019 11:19:56 | 18,000 | 9a19e90afae0c13759ec1d2edc75c7eaee24d2a2 | Add progressPercent/onProgress to web ChatInputState | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/message-actions.js",
"new_path": "lib/actions/message-actions.js",
"diff": "@@ -87,11 +87,12 @@ async function sendMultimediaMessage(\nthreadID: string,\nlocalID: string,\nmultimedia: $ReadOnlyArray<Object>,\n+ onProgress: (percent: number) => void,\n): Promise<SendMessageResult> {\nconst response = await fetchJSON(\n'create_multimedia_message',\n{ threadID, localID, multimedia },\n- { blobUpload: true },\n+ { blobUpload: true, onProgress },\n);\nreturn { id: response.id, time: response.time };\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -20,9 +20,11 @@ export type PendingMultimediaUpload = {|\nfile: File,\nmediaType: MediaType,\nuri: string,\n+ progressPercent: number,\n|};\nexport const pendingMultimediaUploadPropType = PropTypes.shape({\nfile: PropTypes.object.isRequired,\nmediaType: mediaTypePropType.isRequired,\nuri: PropTypes.string.isRequired,\n+ progressPercent: PropTypes.number.isRequired,\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/fetch-json.js",
"new_path": "lib/utils/fetch-json.js",
"diff": "@@ -28,7 +28,7 @@ import { fetchJSONTimeout } from '../shared/timeouts';\nexport type FetchJSONOptions = $Shape<{|\ntimeout: number, // in milliseconds\nblobUpload: bool,\n- onProgress: (percent: number) => void,\n+ onProgress: (percent: number) => void, // only works with blobUpload\n|}>;\nexport type FetchJSONServerResponse = $Shape<{|\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -72,6 +72,7 @@ type Props = {|\nthreadID: string,\nlocalID: string,\nmultimedia: $ReadOnlyArray<Object>,\n+ onProgress: (percent: number) => void,\n) => Promise<SendMessageResult>,\njoinThread: (request: ClientThreadJoinRequest) => Promise<ThreadJoinPayload>,\n|};\n@@ -339,8 +340,6 @@ class ChatInputBar extends React.PureComponent<Props> {\ndispatchMultimediaMessageAction(\npendingUploads: $ReadOnlyArray<PendingMultimediaUpload>,\n) {\n- this.props.chatInputState.clearPendingUploads();\n-\nconst localID = `local${this.props.nextLocalID}`;\nconst creatorID = this.props.viewerID;\ninvariant(creatorID, \"should have viewer ID in order to send a message\");\n@@ -378,7 +377,9 @@ class ChatInputBar extends React.PureComponent<Props> {\nmessageInfo.threadID,\nlocalID,\nfiles,\n+ this.props.chatInputState.setProgress,\n);\n+ this.props.chatInputState.clearPendingUploads();\nreturn {\nlocalID,\nserverID: result.id,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -46,6 +46,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nthis.removePendingUpload(threadID, pendingUpload),\nclearPendingUploads: () => this.clearPendingUploads(threadID),\nsetDraft: (draft: string) => this.setDraft(threadID, draft),\n+ setProgress: (percent: number) => this.setProgress(threadID, percent),\n}),\n));\n@@ -59,6 +60,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nfile,\nmediaType,\nuri: URL.createObjectURL(file),\n+ progressPercent: 0,\n}));\nthis.setState(prevState => {\nconst prevUploads = prevState.pendingUploads[threadID];\n@@ -121,6 +123,24 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n}));\n}\n+ setProgress(threadID: string, percent: number) {\n+ this.setState(prevState => {\n+ const pendingUploads = prevState.pendingUploads[threadID];\n+ if (!pendingUploads) {\n+ return {};\n+ }\n+ const newPendingUploads = pendingUploads.map(\n+ pendingUpload => ({ ...pendingUpload, progressPercent: percent }),\n+ );\n+ return {\n+ pendingUploads: {\n+ ...prevState.pendingUploads,\n+ [threadID]: newPendingUploads,\n+ },\n+ };\n+ });\n+ }\n+\nrender() {\nconst { activeChatThreadID } = this.props;\nconst chatInputState = activeChatThreadID\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state.js",
"new_path": "web/chat/chat-input-state.js",
"diff": "@@ -14,6 +14,7 @@ export type ChatInputState = {|\nremovePendingUpload: (pendingUpload: PendingMultimediaUpload) => void,\nclearPendingUploads: () => void,\nsetDraft: (draft: string) => void,\n+ setProgress: (percent: number) => void,\n|};\nexport const chatInputStatePropType = PropTypes.shape({\npendingUploads: PropTypes.arrayOf(pendingMultimediaUploadPropType).isRequired,\n@@ -22,4 +23,5 @@ export const chatInputStatePropType = PropTypes.shape({\nremovePendingUpload: PropTypes.func.isRequired,\nclearPendingUploads: PropTypes.func.isRequired,\nsetDraft: PropTypes.func.isRequired,\n+ setProgress: PropTypes.func.isRequired,\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add progressPercent/onProgress to web ChatInputState |
129,187 | 03.01.2019 14:55:46 | 18,000 | b273af166c6f6b13ca5cb8fda0b161eb5c1fcad1 | [server] Fix broken parsing of notif delivery column for notif rescind | [
{
"change_type": "MODIFY",
"old_path": "server/src/push/rescind.js",
"new_path": "server/src/push/rescind.js",
"diff": "@@ -29,18 +29,18 @@ async function rescindPushNotifs(\nconst deliveries = Array.isArray(row.delivery)\n? row.delivery\n: [ row.delivery ];\n- for (let delivery of row.delivery) {\n- if (row.delivery.iosID && row.delivery.iosDeviceTokens) {\n+ for (let delivery of deliveries) {\n+ if (delivery.iosID && delivery.iosDeviceTokens) {\n// Old iOS\nconst notification = prepareIOSNotification(\n- row.delivery.iosID,\n+ delivery.iosID,\nrow.unread_count,\n);\npromises.push(apnPush(\nnotification,\n- row.delivery.iosDeviceTokens,\n+ delivery.iosDeviceTokens,\n));\n- } else if (row.delivery.androidID) {\n+ } else if (delivery.androidID) {\n// Old Android\nconst notification = prepareAndroidNotification(\nrow.collapse_key ? row.collapse_key : row.id.toString(),\n@@ -48,7 +48,7 @@ async function rescindPushNotifs(\n);\npromises.push(fcmPush(\nnotification,\n- row.delivery.androidDeviceTokens,\n+ delivery.androidDeviceTokens,\nnull,\n));\n} else if (delivery.deviceType === \"ios\") {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Fix broken parsing of notif delivery column for notif rescind |
129,187 | 03.01.2019 17:32:25 | 18,000 | 8f1743017bb2d0c049738974b8b773ccdcd004c9 | [web] Show progress during multimedia upload | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -186,19 +186,30 @@ a.multimediaUpload > svg {\n}\ndiv.previews {\n+ display: flex;\noverflow-x: auto;\nwhite-space: nowrap;\n}\nspan.preview {\n+ display: inline-flex;\n+ align-items: center;\n+ justify-content: center;\nmargin: 10px;\nposition: relative;\n- display: inline-block;\n}\n-span.preview > img {\n+span.preview > span.previewImage {\n+ display: inline-flex;\n+ align-items: center;\n+ justify-content: center;\n+ position: relative;\n+ min-height: 50px;\n+ min-width: 50px;\n+}\n+span.preview > span.previewImage > img {\nmax-height: 200px;\nmax-width: 200px;\n}\n-span.preview > svg {\n+span.preview > span.previewImage > svg.removeUpload {\ndisplay: none;\nposition: absolute;\ncursor: pointer;\n@@ -209,6 +220,28 @@ span.preview > svg {\nbox-shadow: inset 0px 0px 5px rgba(0,0,0,0.5);\nbackground-color: #222222AA;\n}\n-span.preview:hover > svg {\n+span.preview:hover > span.previewImage > svg.removeUpload {\ndisplay: inherit;\n}\n+span.preview > svg.progressIndicator {\n+ position: absolute;\n+ top: 0;\n+ bottom: 0;\n+ left: 0;\n+ right: 0;\n+ margin: auto auto;\n+ width: 50px;\n+ height: 50px;\n+}\n+:global(.CircularProgressbar-background) {\n+ fill: #666 !important;\n+}\n+:global(.CircularProgressbar-text) {\n+ fill: #fff !important;\n+}\n+:global(.CircularProgressbar-path) {\n+ stroke: #fff !important;\n+}\n+:global(.CircularProgressbar-trail) {\n+ stroke: transparent !important;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "@@ -8,6 +8,8 @@ import {\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport XCircleIcon from 'react-feather/dist/icons/x-circle';\n+import CircularProgressbar from 'react-circular-progressbar';\n+import 'react-circular-progressbar/dist/styles.css';\nimport css from './chat-message-list.css';\n@@ -23,10 +25,31 @@ class MultimediaPreview extends React.PureComponent<Props> {\n};\nrender() {\n+ const { uri, progressPercent } = this.props.pendingUpload;\n+ const removeButton = progressPercent === 0\n+ ? <XCircleIcon onClick={this.remove} className={css.removeUpload} />\n+ : null;\n+ let progressIndicator = null;\n+ if (progressPercent !== 0) {\n+ const outOfHundred = progressPercent * 100;\n+ const text = `${outOfHundred}%`;\n+ progressIndicator = (\n+ <CircularProgressbar\n+ percentage={outOfHundred}\n+ text={text}\n+ background\n+ backgroundPadding={6}\n+ className={css.progressIndicator}\n+ />\n+ );\n+ }\nreturn (\n<span className={css.preview}>\n- <img src={this.props.pendingUpload.uri} />\n- <XCircleIcon onClick={this.remove} />\n+ <span className={css.previewImage}>\n+ <img src={uri} />\n+ {removeButton}\n+ </span>\n+ {progressIndicator}\n</span>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/package.json",
"new_path": "web/package.json",
"diff": "\"lodash\": \"^4.17.5\",\n\"prop-types\": \"^15.6.0\",\n\"react\": \"^16.2.0\",\n+ \"react-circular-progressbar\": \"^1.0.0\",\n\"react-color\": \"^2.13.0\",\n\"react-dnd\": \"^7.0.2\",\n\"react-dnd-html5-backend\": \"^7.0.2\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -9201,6 +9201,13 @@ rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@^1.2.7:\nminimist \"^1.2.0\"\nstrip-json-comments \"~2.0.1\"\n+react-circular-progressbar@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/react-circular-progressbar/-/react-circular-progressbar-1.0.0.tgz#0d2a6c07c9f14fcafca4510f27829e4276dee3e0\"\n+ integrity sha512-6QOqwsYJCeFDPYTparTS3FdFGlSItafJWD8BloLG3k1sW8ZG7JGdHo7FQsqtGEIK0bldwTO9v+nD2nEYAU1OYg==\n+ dependencies:\n+ prop-types \"^15.5.10\"\n+\nreact-clone-referenced-element@^1.0.1:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/react-clone-referenced-element/-/react-clone-referenced-element-1.1.0.tgz#9cdda7f2aeb54fea791f3ab8c6ab96c7a77d0158\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Show progress during multimedia upload |
129,187 | 04.01.2019 10:39:38 | 18,000 | d1465183d7c0974e6246bcfeb44dd000c7df4d00 | [lib] Add abortHandler to FetchJSONOptions for uploadBlob | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/fetch-json.js",
"new_path": "lib/utils/fetch-json.js",
"diff": "@@ -28,13 +28,16 @@ import { fetchJSONTimeout } from '../shared/timeouts';\nexport type FetchJSONOptions = $Shape<{|\ntimeout: number, // in milliseconds\nblobUpload: bool,\n- onProgress: (percent: number) => void, // only works with blobUpload\n+ // the rest (onProgress, abortHandler) only work with blobUpload\n+ onProgress: (percent: number) => void,\n+ // abortHandler will receive an abort function once the upload starts\n+ abortHandler: (abort: () => void) => void,\n|}>;\nexport type FetchJSONServerResponse = $Shape<{|\ncookieChange: ServerSessionChange,\nerror: string,\n- payload: Object\n+ payload: Object,\n|}>;\n// You'll notice that this is not the type of the fetchJSON function below. This\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/upload-blob.js",
"new_path": "lib/utils/upload-blob.js",
"diff": "@@ -7,7 +7,7 @@ import _cloneDeep from 'lodash/fp/cloneDeep';\nimport { getConfig } from './config';\n-async function uploadBlob(\n+function uploadBlob(\nurl: string,\ncookie: ?string,\nsessionID: ?string,\n@@ -65,8 +65,12 @@ async function uploadBlob(\n};\n}\n+ let failed = false;\nconst responsePromise = new Promise((resolve, reject) => {\nxhr.onload = () => {\n+ if (failed) {\n+ return;\n+ }\nconst text = xhr.responseText;\ntry {\nresolve(_cloneDeep(JSON.parse(text)));\n@@ -75,10 +79,28 @@ async function uploadBlob(\nreject(e);\n}\n};\n+ xhr.onabort = () => {\n+ failed = true;\n+ reject(new Error(\"request aborted\"));\n+ };\n+ xhr.onerror = (event) => {\n+ failed = true;\n+ reject(event);\n+ };\n+ if (options && options.abortHandler) {\n+ options.abortHandler(() => {\n+ failed = true;\n+ reject(new Error(\"request aborted\"));\n+ xhr.abort();\n+ });\n+ }\n});\n+ if (!failed) {\nxhr.send(formData);\n- return await responsePromise;\n+ }\n+\n+ return responsePromise;\n}\nexport {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Add abortHandler to FetchJSONOptions for uploadBlob |
129,187 | 04.01.2019 11:49:58 | 18,000 | ba23fdfad90f388ee85eb66915e39f51bd907389 | Add localID/serverID to PendingMultimediaUpload and key state on them | [
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -17,12 +17,16 @@ export const mediaPropType = PropTypes.shape({\n});\nexport type PendingMultimediaUpload = {|\n+ localID: string,\n+ serverID: ?string,\nfile: File,\nmediaType: MediaType,\nuri: string,\nprogressPercent: number,\n|};\nexport const pendingMultimediaUploadPropType = PropTypes.shape({\n+ localID: PropTypes.string.isRequired,\n+ serverID: PropTypes.string,\nfile: PropTypes.object.isRequired,\nmediaType: mediaTypePropType.isRequired,\nuri: PropTypes.string.isRequired,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -45,6 +45,7 @@ import {\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\n+import { values } from 'lib/utils/objects';\nimport css from './chat-message-list.css';\nimport LoadingIndicator from '../loading-indicator.react';\n@@ -106,9 +107,9 @@ class ChatInputBar extends React.PureComponent<Props> {\nif (\nthis.multimediaInput &&\n_difference(\n- prevChatInputState.pendingUploads,\n+ Object.keys(prevChatInputState.pendingUploads),\n)(\n- chatInputState.pendingUploads,\n+ Object.keys(chatInputState.pendingUploads),\n).length > 0\n) {\n// Whenever a pending upload is removed, we reset the file\n@@ -157,12 +158,12 @@ class ChatInputBar extends React.PureComponent<Props> {\n);\n}\n- const multimediaPreviews =\n- this.props.chatInputState.pendingUploads.map(pendingUpload => (\n+ const pendingUploads = values(this.props.chatInputState.pendingUploads);\n+ const multimediaPreviews = pendingUploads.map(pendingUpload => (\n<MultimediaPreview\npendingUpload={pendingUpload}\nremove={this.props.chatInputState.removePendingUpload}\n- key={pendingUpload.uri}\n+ key={pendingUpload.localID}\n/>\n));\nconst previews = multimediaPreviews.length > 0\n@@ -270,7 +271,7 @@ class ChatInputBar extends React.PureComponent<Props> {\nthis.dispatchTextMessageAction(text);\n}\n- const { pendingUploads } = this.props.chatInputState;\n+ const pendingUploads = values(this.props.chatInputState.pendingUploads);\nif (pendingUploads.length > 0) {\nthis.dispatchMultimediaMessageAction(pendingUploads);\n}\n@@ -377,7 +378,11 @@ class ChatInputBar extends React.PureComponent<Props> {\nmessageInfo.threadID,\nlocalID,\nfiles,\n- this.props.chatInputState.setProgress,\n+ (percent: number) => {\n+ for (let uploadID in this.props.chatInputState.pendingUploads) {\n+ this.props.chatInputState.setProgress(uploadID, percent);\n+ }\n+ },\n);\nthis.props.chatInputState.clearPendingUploads();\nreturn {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -7,18 +7,23 @@ import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { createSelector } from 'reselect';\nimport _memoize from 'lodash/memoize';\n+import _keyBy from 'lodash/fp/keyBy';\n+import _omit from 'lodash/fp/omit';\nimport { connect } from 'lib/utils/redux-utils';\nimport ChatMessageList from './chat-message-list.react';\nimport { validateFile } from '../utils/media-utils';\n+let nextLocalMultimediaID = 0;\n+\ntype Props = {|\n// Redux state\nactiveChatThreadID: ?string,\n|};\ntype State = {|\n- pendingUploads: {[threadID: string]: $ReadOnlyArray<PendingMultimediaUpload>},\n+ pendingUploads:\n+ {[threadID: string]: {[localID: string]: PendingMultimediaUpload}},\ndrafts: {[threadID: string]: string},\n|};\nclass ChatInputStateContainer extends React.PureComponent<Props, State> {\n@@ -35,18 +40,19 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n(state: State) => state.pendingUploads[threadID],\n(state: State) => state.drafts[threadID],\n(\n- pendingUploads: ?$ReadOnlyArray<PendingMultimediaUpload>,\n+ pendingUploads: ?{[localID: string]: PendingMultimediaUpload},\ndraft: ?string,\n) => ({\n- pendingUploads: pendingUploads ? pendingUploads : [],\n+ pendingUploads: pendingUploads ? pendingUploads : {},\ndraft: draft ? draft : \"\",\nappendFiles: (files: $ReadOnlyArray<File>) =>\nthis.appendFiles(threadID, files),\n- removePendingUpload: (pendingUpload: PendingMultimediaUpload) =>\n- this.removePendingUpload(threadID, pendingUpload),\n+ removePendingUpload: (localID: string) =>\n+ this.removePendingUpload(threadID, localID),\nclearPendingUploads: () => this.clearPendingUploads(threadID),\nsetDraft: (draft: string) => this.setDraft(threadID, draft),\n- setProgress: (percent: number) => this.setProgress(threadID, percent),\n+ setProgress: (localID: string, percent: number) =>\n+ this.setProgress(threadID, localID, percent),\n}),\n));\n@@ -57,15 +63,18 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nreturn;\n}\nconst newUploads = validatedFileInfo.map(({ file, mediaType }) => ({\n+ localID: `localMultimedia${nextLocalMultimediaID++}`,\n+ serverID: null,\nfile,\nmediaType,\nuri: URL.createObjectURL(file),\nprogressPercent: 0,\n}));\n+ const newUploadsObject = _keyBy('localID')(newUploads);\nthis.setState(prevState => {\nconst prevUploads = prevState.pendingUploads[threadID];\nconst mergedUploads = prevUploads\n- ? [ ...prevUploads, ...newUploads ]\n+ ? { ...prevUploads, ...newUploadsObject }\n: newUploads;\nreturn {\npendingUploads: {\n@@ -78,19 +87,18 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nremovePendingUpload(\nthreadID: string,\n- pendingUpload: PendingMultimediaUpload,\n+ localID: string,\n) {\nthis.setState(prevState => {\nconst currentPendingUploads = prevState.pendingUploads[threadID];\nif (!currentPendingUploads) {\nreturn {};\n}\n- const newPendingUploads = currentPendingUploads.filter(\n- candidate => candidate !== pendingUpload,\n- );\n- if (newPendingUploads.length === currentPendingUploads.length) {\n+ const pendingUpload = currentPendingUploads[localID];\n+ if (!pendingUpload) {\nreturn {};\n}\n+ const newPendingUploads = _omit([ localID ])(currentPendingUploads);\nreturn {\npendingUploads: {\n...prevState.pendingUploads,\n@@ -102,13 +110,16 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nclearPendingUploads(threadID: string) {\nthis.setState(prevState => {\n- if (prevState.pendingUploads[threadID].length === 0) {\n+ if (\n+ !prevState.pendingUploads[threadID] ||\n+ Object.keys(prevState.pendingUploads[threadID]).length === 0\n+ ) {\nreturn {};\n}\nreturn {\npendingUploads: {\n...prevState.pendingUploads,\n- [threadID]: [],\n+ [threadID]: {},\n},\n};\n});\n@@ -123,15 +134,23 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n}));\n}\n- setProgress(threadID: string, percent: number) {\n+ setProgress(threadID: string, localID: string, progressPercent: number) {\nthis.setState(prevState => {\nconst pendingUploads = prevState.pendingUploads[threadID];\nif (!pendingUploads) {\nreturn {};\n}\n- const newPendingUploads = pendingUploads.map(\n- pendingUpload => ({ ...pendingUpload, progressPercent: percent }),\n- );\n+ const pendingUpload = pendingUploads[localID];\n+ if (!pendingUpload) {\n+ return {};\n+ }\n+ const newPendingUploads = {\n+ ...pendingUploads,\n+ [localID]: {\n+ ...pendingUpload,\n+ progressPercent,\n+ },\n+ };\nreturn {\npendingUploads: {\n...prevState.pendingUploads,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state.js",
"new_path": "web/chat/chat-input-state.js",
"diff": "@@ -8,16 +8,17 @@ import {\nimport PropTypes from 'prop-types';\nexport type ChatInputState = {|\n- pendingUploads: $ReadOnlyArray<PendingMultimediaUpload>,\n+ pendingUploads: {[localID: string]: PendingMultimediaUpload},\ndraft: string,\nappendFiles: (files: $ReadOnlyArray<File>) => Promise<void>,\n- removePendingUpload: (pendingUpload: PendingMultimediaUpload) => void,\n+ removePendingUpload: (localID: string) => void,\nclearPendingUploads: () => void,\nsetDraft: (draft: string) => void,\n- setProgress: (percent: number) => void,\n+ setProgress: (localID: string, percent: number) => void,\n|};\nexport const chatInputStatePropType = PropTypes.shape({\n- pendingUploads: PropTypes.arrayOf(pendingMultimediaUploadPropType).isRequired,\n+ pendingUploads:\n+ PropTypes.objectOf(pendingMultimediaUploadPropType).isRequired,\ndraft: PropTypes.string.isRequired,\nappendFiles: PropTypes.func.isRequired,\nremovePendingUpload: PropTypes.func.isRequired,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "@@ -15,7 +15,7 @@ import css from './chat-message-list.css';\ntype Props = {|\npendingUpload: PendingMultimediaUpload,\n- remove: (pendingUpload: PendingMultimediaUpload) => void,\n+ remove: (uploadID: string) => void,\n|};\nclass MultimediaPreview extends React.PureComponent<Props> {\n@@ -55,7 +55,7 @@ class MultimediaPreview extends React.PureComponent<Props> {\n}\nremove = () => {\n- this.props.remove(this.props.pendingUpload);\n+ this.props.remove(this.props.pendingUpload.localID);\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add localID/serverID to PendingMultimediaUpload and key state on them |
129,187 | 05.01.2019 17:44:41 | 18,000 | b136af42f1b8c2a7aae98fe80736bf4150d01761 | Add all necessary state to PendingMultimediaUpload, ChatInputState, and Media | [
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -5,30 +5,20 @@ import PropTypes from 'prop-types';\nexport type MediaType = \"photo\" | \"video\";\nexport type Media = {|\n+ id: string,\nuri: string,\ntype: MediaType,\n|};\n-const mediaTypePropType = PropTypes.oneOf([ \"photo\", \"video\" ]);\n+export const mediaTypePropType = PropTypes.oneOf([ \"photo\", \"video\" ]);\nexport const mediaPropType = PropTypes.shape({\n+ id: PropTypes.string.isRequired,\nuri: PropTypes.string.isRequired,\ntype: mediaTypePropType.isRequired,\n});\n-export type PendingMultimediaUpload = {|\n- localID: string,\n- serverID: ?string,\n- file: File,\n- mediaType: MediaType,\n+export type UploadMultimediaResult = {|\n+ id: string,\nuri: string,\n- progressPercent: number,\n|};\n-export const pendingMultimediaUploadPropType = PropTypes.shape({\n- localID: PropTypes.string.isRequired,\n- serverID: PropTypes.string,\n- file: PropTypes.object.isRequired,\n- mediaType: mediaTypePropType.isRequired,\n- uri: PropTypes.string.isRequired,\n- progressPercent: PropTypes.number.isRequired,\n-});\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -18,10 +18,10 @@ import {\ntype SendMessageResult,\nmessageTypes,\n} from 'lib/types/message-types';\n-import type { PendingMultimediaUpload } from 'lib/types/media-types';\nimport {\nchatInputStatePropType,\ntype ChatInputState,\n+ type PendingMultimediaUpload,\n} from './chat-input-state';\nimport * as React from 'react';\n@@ -45,7 +45,6 @@ import {\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\n-import { values } from 'lib/utils/objects';\nimport css from './chat-message-list.css';\nimport LoadingIndicator from '../loading-indicator.react';\n@@ -107,9 +106,9 @@ class ChatInputBar extends React.PureComponent<Props> {\nif (\nthis.multimediaInput &&\n_difference(\n- Object.keys(prevChatInputState.pendingUploads),\n+ ChatInputBar.unassignedUploadIDs(prevChatInputState.pendingUploads),\n)(\n- Object.keys(chatInputState.pendingUploads),\n+ ChatInputBar.unassignedUploadIDs(chatInputState.pendingUploads),\n).length > 0\n) {\n// Whenever a pending upload is removed, we reset the file\n@@ -119,6 +118,16 @@ class ChatInputBar extends React.PureComponent<Props> {\n}\n}\n+ static unassignedUploadIDs(\n+ pendingUploads: $ReadOnlyArray<PendingMultimediaUpload>,\n+ ) {\n+ return pendingUploads.filter(\n+ (pendingUpload: PendingMultimediaUpload) => !pendingUpload.messageID,\n+ ).map(\n+ (pendingUpload: PendingMultimediaUpload) => pendingUpload.localID,\n+ );\n+ }\n+\nupdateHeight() {\nconst textarea = this.textarea;\nif (textarea) {\n@@ -158,11 +167,11 @@ class ChatInputBar extends React.PureComponent<Props> {\n);\n}\n- const pendingUploads = values(this.props.chatInputState.pendingUploads);\n+ const { pendingUploads } = this.props.chatInputState;\nconst multimediaPreviews = pendingUploads.map(pendingUpload => (\n<MultimediaPreview\npendingUpload={pendingUpload}\n- remove={this.props.chatInputState.removePendingUpload}\n+ remove={this.props.chatInputState.cancelPendingUpload}\nkey={pendingUpload.localID}\n/>\n));\n@@ -271,7 +280,7 @@ class ChatInputBar extends React.PureComponent<Props> {\nthis.dispatchTextMessageAction(text);\n}\n- const pendingUploads = values(this.props.chatInputState.pendingUploads);\n+ const { pendingUploads } = this.props.chatInputState;\nif (pendingUploads.length > 0) {\nthis.dispatchMultimediaMessageAction(pendingUploads);\n}\n@@ -350,12 +359,20 @@ class ChatInputBar extends React.PureComponent<Props> {\nthreadID: this.props.threadInfo.id,\ncreatorID,\ntime: Date.now(),\n- media: pendingUploads.map(({ uri, mediaType }) => ({\n+ media: pendingUploads.map(({ localID, serverID, uri, mediaType }) => ({\n+ id: serverID ? serverID : localID,\nuri,\ntype: mediaType,\n})),\n}: RawMultimediaMessageInfo);\nconst files = pendingUploads.map(({ file }) => file);\n+ // This call triggers a setState in ChatInputStateContainer. We hope that\n+ // propagates quicker than the SEND_MULTIMEDIA_MESSAGE_STARTED that gets\n+ // trigered by the dispatch call below, since ChatInputStateContainer's\n+ // appendFiles (which handles the upload) relies on the aforementioned\n+ // setState to know which pending uploads are associated to local messages\n+ // and thus necessitate Redux actions to update the messageStore.\n+ this.props.chatInputState.assignPendingUploads(localID);\nthis.props.dispatchActionPromise(\nsendMultimediaMessageActionTypes,\nthis.sendMultimediaMessageAction(messageInfo, files),\n@@ -379,12 +396,14 @@ class ChatInputBar extends React.PureComponent<Props> {\nlocalID,\nfiles,\n(percent: number) => {\n- for (let uploadID in this.props.chatInputState.pendingUploads) {\n- this.props.chatInputState.setProgress(uploadID, percent);\n+ for (let pendingUpload of this.props.chatInputState.pendingUploads) {\n+ this.props.chatInputState.setProgress(\n+ pendingUpload.localID,\n+ percent,\n+ );\n}\n},\n);\n- this.props.chatInputState.clearPendingUploads();\nreturn {\nlocalID,\nserverID: result.id,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "// @flow\nimport type { AppState } from '../redux-setup';\n-import type { PendingMultimediaUpload } from 'lib/types/media-types';\n+import type { PendingMultimediaUpload } from './chat-input-state';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n@@ -9,13 +9,19 @@ import { createSelector } from 'reselect';\nimport _memoize from 'lodash/memoize';\nimport _keyBy from 'lodash/fp/keyBy';\nimport _omit from 'lodash/fp/omit';\n+import _flow from 'lodash/fp/flow';\n+import _omitBy from 'lodash/fp/pickBy';\n+import _map from 'lodash/fp/map';\n+import _groupBy from 'lodash/fp/groupBy';\n+import _partition from 'lodash/fp/partition';\n+import _mapValues from 'lodash/fp/mapValues';\nimport { connect } from 'lib/utils/redux-utils';\nimport ChatMessageList from './chat-message-list.react';\nimport { validateFile } from '../utils/media-utils';\n-let nextLocalMultimediaID = 0;\n+let nextLocalUploadID = 0;\ntype Props = {|\n// Redux state\n@@ -23,7 +29,7 @@ type Props = {|\n|};\ntype State = {|\npendingUploads:\n- {[threadID: string]: {[localID: string]: PendingMultimediaUpload}},\n+ {[threadID: string]: {[localUploadID: string]: PendingMultimediaUpload}},\ndrafts: {[threadID: string]: string},\n|};\nclass ChatInputStateContainer extends React.PureComponent<Props, State> {\n@@ -40,20 +46,36 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n(state: State) => state.pendingUploads[threadID],\n(state: State) => state.drafts[threadID],\n(\n- pendingUploads: ?{[localID: string]: PendingMultimediaUpload},\n+ pendingUploads: ?{[localUploadID: string]: PendingMultimediaUpload},\ndraft: ?string,\n- ) => ({\n- pendingUploads: pendingUploads ? pendingUploads : {},\n+ ) => {\n+ let threadPendingUploads, threadAssignedUploads;\n+ if (!pendingUploads) {\n+ threadPendingUploads = [];\n+ threadAssignedUploads = {};\n+ } else {\n+ const [\n+ uploadsWithMessageIDs,\n+ uploadsWithoutMessageIDs,\n+ ] = _partition('messageID')(pendingUploads);\n+ threadPendingUploads = uploadsWithoutMessageIDs;\n+ threadAssignedUploads = _groupBy('messageID')(uploadsWithMessageIDs);\n+ }\n+ return {\n+ pendingUploads: threadPendingUploads,\n+ assignedUploads: threadAssignedUploads,\ndraft: draft ? draft : \"\",\nappendFiles: (files: $ReadOnlyArray<File>) =>\nthis.appendFiles(threadID, files),\n- removePendingUpload: (localID: string) =>\n- this.removePendingUpload(threadID, localID),\n- clearPendingUploads: () => this.clearPendingUploads(threadID),\n+ cancelPendingUpload: (localUploadID: string) =>\n+ this.cancelPendingUpload(threadID, localUploadID),\n+ assignPendingUploads: (localMessageID: string) =>\n+ this.assignPendingUploads(threadID, localMessageID),\nsetDraft: (draft: string) => this.setDraft(threadID, draft),\n- setProgress: (localID: string, percent: number) =>\n- this.setProgress(threadID, localID, percent),\n- }),\n+ setProgress: (localUploadID: string, percent: number) =>\n+ this.setProgress(threadID, localUploadID, percent),\n+ };\n+ },\n));\nasync appendFiles(threadID: string, files: $ReadOnlyArray<File>) {\n@@ -63,11 +85,14 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nreturn;\n}\nconst newUploads = validatedFileInfo.map(({ file, mediaType }) => ({\n- localID: `localMultimedia${nextLocalMultimediaID++}`,\n+ localID: `localUpload${nextLocalUploadID++}`,\nserverID: null,\n+ messageID: null,\n+ failed: null,\nfile,\nmediaType,\nuri: URL.createObjectURL(file),\n+ uriIsReal: false,\nprogressPercent: 0,\n}));\nconst newUploadsObject = _keyBy('localID')(newUploads);\n@@ -85,41 +110,59 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n});\n}\n- removePendingUpload(\n- threadID: string,\n- localID: string,\n- ) {\n- this.setState(prevState => {\n+ cancelPendingUpload(threadID: string, localUploadID: string) {\n+ let revokeURL;\n+ this.setState(\n+ prevState => {\nconst currentPendingUploads = prevState.pendingUploads[threadID];\nif (!currentPendingUploads) {\nreturn {};\n}\n- const pendingUpload = currentPendingUploads[localID];\n+ const pendingUpload = currentPendingUploads[localUploadID];\nif (!pendingUpload) {\nreturn {};\n}\n- const newPendingUploads = _omit([ localID ])(currentPendingUploads);\n+ if (!pendingUpload.uriIsReal) {\n+ revokeURL = pendingUpload.uri;\n+ }\n+ const newPendingUploads = _omit([ localUploadID ])(currentPendingUploads);\nreturn {\npendingUploads: {\n...prevState.pendingUploads,\n[threadID]: newPendingUploads,\n},\n};\n- });\n+ },\n+ () => {\n+ if (revokeURL) {\n+ URL.revokeObjectURL(revokeURL);\n+ }\n+ },\n+ );\n}\n- clearPendingUploads(threadID: string) {\n+ assignPendingUploads(threadID: string, localMessageID: string) {\nthis.setState(prevState => {\n+ const currentPendingUploads = prevState.pendingUploads[threadID];\nif (\n- !prevState.pendingUploads[threadID] ||\n- Object.keys(prevState.pendingUploads[threadID]).length === 0\n+ !currentPendingUploads ||\n+ Object.keys(currentPendingUploads).length === 0\n) {\nreturn {};\n}\n+ const newPendingUploads = _flow(\n+ _omitBy('serverID'),\n+ _mapValues(\n+ (pendingUpload: PendingMultimediaUpload) => ({\n+ ...pendingUpload,\n+ messageID: localMessageID,\n+ }),\n+ ),\n+ )(currentPendingUploads);\nreturn {\npendingUploads: {\n...prevState.pendingUploads,\n- [threadID]: {},\n+ [threadID]: newPendingUploads,\n},\n};\n});\n@@ -134,19 +177,23 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n}));\n}\n- setProgress(threadID: string, localID: string, progressPercent: number) {\n+ setProgress(\n+ threadID: string,\n+ localUploadID: string,\n+ progressPercent: number,\n+ ) {\nthis.setState(prevState => {\nconst pendingUploads = prevState.pendingUploads[threadID];\nif (!pendingUploads) {\nreturn {};\n}\n- const pendingUpload = pendingUploads[localID];\n+ const pendingUpload = pendingUploads[localUploadID];\nif (!pendingUpload) {\nreturn {};\n}\nconst newPendingUploads = {\n...pendingUploads,\n- [localID]: {\n+ [localUploadID]: {\n...pendingUpload,\nprogressPercent,\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state.js",
"new_path": "web/chat/chat-input-state.js",
"diff": "// @flow\n-import {\n- type PendingMultimediaUpload,\n- pendingMultimediaUploadPropType,\n-} from 'lib/types/media-types';\n+import { type MediaType, mediaTypePropType } from 'lib/types/media-types';\nimport PropTypes from 'prop-types';\n+export type PendingMultimediaUpload = {|\n+ localID: string,\n+ // Pending uploads are assigned a serverID once they are complete\n+ serverID: ?string,\n+ // Pending uploads are assigned a messageID once they are sent. serverID and\n+ // messageID shouldn't both be set, as in that case the upload is no longer\n+ // pending and should be cleared out\n+ messageID: ?string,\n+ // This is set to truthy if the upload fails for whatever reason\n+ failed: ?string,\n+ file: File,\n+ mediaType: MediaType,\n+ uri: string,\n+ // URLs created with createObjectURL aren't considered \"real\". The distinction\n+ // is required because those \"fake\" URLs must be disposed properly\n+ uriIsReal: bool,\n+ progressPercent: number,\n+|};\n+export const pendingMultimediaUploadPropType = PropTypes.shape({\n+ localID: PropTypes.string.isRequired,\n+ serverID: PropTypes.string,\n+ messageID: PropTypes.string,\n+ failed: PropTypes.string,\n+ file: PropTypes.object.isRequired,\n+ mediaType: mediaTypePropType.isRequired,\n+ uri: PropTypes.string.isRequired,\n+ uriIsReal: PropTypes.bool.isRequired,\n+ progressPercent: PropTypes.number.isRequired,\n+});\n+\n+// This type represents the input state for a particular thread\nexport type ChatInputState = {|\n- pendingUploads: {[localID: string]: PendingMultimediaUpload},\n+ pendingUploads: $ReadOnlyArray<PendingMultimediaUpload>,\n+ assignedUploads:\n+ {[messageID: string]: $ReadOnlyArray<PendingMultimediaUpload>},\ndraft: string,\nappendFiles: (files: $ReadOnlyArray<File>) => Promise<void>,\n- removePendingUpload: (localID: string) => void,\n- clearPendingUploads: () => void,\n+ cancelPendingUpload: (localUploadID: string) => void,\n+ assignPendingUploads: (localMessageID: string) => void,\nsetDraft: (draft: string) => void,\n- setProgress: (localID: string, percent: number) => void,\n+ setProgress: (localUploadID: string, percent: number) => void,\n|};\n+const arrayOfUploadsPropType =\n+ PropTypes.arrayOf(pendingMultimediaUploadPropType);\nexport const chatInputStatePropType = PropTypes.shape({\n- pendingUploads:\n- PropTypes.objectOf(pendingMultimediaUploadPropType).isRequired,\n+ pendingUploads: arrayOfUploadsPropType.isRequired,\n+ assignedUploads: PropTypes.objectOf(arrayOfUploadsPropType).isRequired,\ndraft: PropTypes.string.isRequired,\nappendFiles: PropTypes.func.isRequired,\n- removePendingUpload: PropTypes.func.isRequired,\n- clearPendingUploads: PropTypes.func.isRequired,\n+ cancelPendingUpload: PropTypes.func.isRequired,\n+ assignPendingUploads: PropTypes.func.isRequired,\nsetDraft: PropTypes.func.isRequired,\nsetProgress: PropTypes.func.isRequired,\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "import {\ntype PendingMultimediaUpload,\npendingMultimediaUploadPropType,\n-} from 'lib/types/media-types';\n+} from './chat-input-state';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n@@ -30,7 +30,7 @@ class MultimediaPreview extends React.PureComponent<Props> {\n? <XCircleIcon onClick={this.remove} className={css.removeUpload} />\n: null;\nlet progressIndicator = null;\n- if (progressPercent !== 0) {\n+ if (progressPercent !== 0 && progressPercent !== 1) {\nconst outOfHundred = progressPercent * 100;\nconst text = `${outOfHundred}%`;\nprogressIndicator = (\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Add all necessary state to PendingMultimediaUpload, ChatInputState, and Media |
129,187 | 08.01.2019 11:13:24 | 18,000 | ed1b290788a08483ee0e2ce2f9d9481f0dfceb02 | ChatInputStateContainer.uploadFile
Introduces `uploadMultimedia` action and `PendingMultimediaUpload.abort` as well. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/actions/upload-actions.js",
"diff": "+// @flow\n+\n+import type { FetchJSON } from '../utils/fetch-json';\n+import type { UploadMultimediaResult } from '../types/media-types';\n+\n+async function uploadMultimedia(\n+ fetchJSON: FetchJSON,\n+ multimedia: Object,\n+ onProgress: (percent: number) => void,\n+ abortHandler: (abort: () => void) => void,\n+): Promise<UploadMultimediaResult> {\n+ const response = await fetchJSON(\n+ 'upload_multimedia',\n+ { multimedia },\n+ { blobUpload: true, onProgress, abortHandler },\n+ );\n+ return { id: response.id, uri: response.uri };\n+}\n+\n+export {\n+ uploadMultimedia,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/endpoints.js",
"new_path": "lib/types/endpoints.js",
"diff": "@@ -32,7 +32,7 @@ type SessionChangingEndpoint = $Values<typeof sessionChangingEndpoints>;\n// upload ends. To avoid blocking other messages we upload using HTTP\n// multipart/form-data.\nconst uploadEndpoints = Object.freeze({\n- CREATE_MULTIMEDIA_MESSAGE: 'create_multimedia_message',\n+ UPLOAD_MULTIMEDIA: 'upload_multimedia',\n});\ntype UploadEndpoint = $Values<typeof uploadEndpoints>;\n@@ -72,6 +72,7 @@ const socketSafeEndpoints = Object.freeze({\nFETCH_ERROR_REPORT_INFOS: 'fetch_error_report_infos',\nREQUEST_ACCESS: 'request_access',\nCREATE_REPORT: 'create_report',\n+ CREATE_MULTIMEDIA_MESSAGE: 'create_multimedia_message',\n});\ntype SocketSafeEndpoint = $Values<typeof socketSafeEndpoints>;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "// @flow\nimport type { AppState } from '../redux-setup';\n+import type { UploadMultimediaResult } from 'lib/types/media-types';\n+import type { DispatchActionPayload } from 'lib/utils/action-utils';\nimport type { PendingMultimediaUpload } from './chat-input-state';\nimport * as React from 'react';\n@@ -17,6 +19,7 @@ import _partition from 'lodash/fp/partition';\nimport _mapValues from 'lodash/fp/mapValues';\nimport { connect } from 'lib/utils/redux-utils';\n+import { uploadMultimedia } from 'lib/actions/upload-actions';\nimport ChatMessageList from './chat-message-list.react';\nimport { validateFile } from '../utils/media-utils';\n@@ -26,6 +29,14 @@ let nextLocalUploadID = 0;\ntype Props = {|\n// Redux state\nactiveChatThreadID: ?string,\n+ // Redux dispatch functions\n+ dispatchActionPayload: DispatchActionPayload,\n+ // async functions that hit server APIs\n+ uploadMultimedia: (\n+ multimedia: Object,\n+ onProgress: (percent: number) => void,\n+ abortHandler: (abort: () => void) => void,\n+ ) => Promise<UploadMultimediaResult>,\n|};\ntype State = {|\npendingUploads:\n@@ -36,6 +47,8 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nstatic propTypes = {\nactiveChatThreadID: PropTypes.string,\n+ dispatchActionPayload: PropTypes.func.isRequired,\n+ uploadMultimedia: PropTypes.func.isRequired,\n};\nstate = {\npendingUploads: {},\n@@ -94,9 +107,11 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nuri: URL.createObjectURL(file),\nuriIsReal: false,\nprogressPercent: 0,\n+ abort: null,\n}));\nconst newUploadsObject = _keyBy('localID')(newUploads);\n- this.setState(prevState => {\n+ this.setState(\n+ prevState => {\nconst prevUploads = prevState.pendingUploads[threadID];\nconst mergedUploads = prevUploads\n? { ...prevUploads, ...newUploadsObject }\n@@ -107,11 +122,149 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n[threadID]: mergedUploads,\n},\n};\n+ },\n+ () => this.uploadFiles(\n+ threadID,\n+ newUploads,\n+ ),\n+ );\n+ }\n+\n+ uploadFiles(\n+ threadID: string,\n+ uploads: $ReadOnlyArray<PendingMultimediaUpload>,\n+ ) {\n+ return Promise.all(\n+ uploads.map(upload => this.uploadFile(threadID, upload)),\n+ );\n+ }\n+\n+ async uploadFile(threadID: string, upload: PendingMultimediaUpload) {\n+ let result;\n+ try {\n+ result = await this.props.uploadMultimedia(\n+ upload.file,\n+ (percent: number) => this.setProgress(\n+ threadID,\n+ upload.localID,\n+ percent,\n+ ),\n+ (abort: () => void) => this.handleAbortCallback(\n+ threadID,\n+ upload.localID,\n+ abort,\n+ ),\n+ );\n+ } catch (e) {\n+ this.handleUploadFailure(\n+ threadID,\n+ upload.localID,\n+ e,\n+ );\n+ return;\n+ }\n+\n+ const uploadAfterSuccess =\n+ this.state.pendingUploads[threadID][upload.localID];\n+ if (uploadAfterSuccess && uploadAfterSuccess.messageID) {\n+ // TODO implement this action\n+ // this.props.dispatchActionPayload(\n+ // assignMediaServerIDActionType,\n+ // { mediaServerID: result.id, messageID: uploadAfterSuccess.messageID },\n+ // );\n+ }\n+\n+ this.setState(prevState => {\n+ const uploads = prevState.pendingUploads[threadID];\n+ const currentUpload = uploads[upload.localID];\n+ if (!currentUpload) {\n+ return {};\n+ }\n+ let newUploads;\n+ if (currentUpload.messageID) {\n+ // If the messageID is already set, then there is no need to keep\n+ // tracking this upload. The above action dispatch should ensure no\n+ // pointers to this localID exist.\n+ newUploads = _omit([ upload.localID ])(uploads);\n+ } else {\n+ // Otherwise, the message hasn't been sent yet, so the uploads are still\n+ // pending. We'll mark the serverID in our local state.\n+ newUploads = {\n+ ...uploads,\n+ [upload.localID]: {\n+ ...currentUpload,\n+ serverID: result.id,\n+ },\n+ };\n+ }\n+ return {\n+ pendingUploads: {\n+ ...prevState.pendingUploads,\n+ [threadID]: newUploads,\n+ },\n+ };\n+ });\n+ }\n+\n+ handleAbortCallback(\n+ threadID: string,\n+ localUploadID: string,\n+ abort: () => void,\n+ ) {\n+ this.setState(prevState => {\n+ const uploads = prevState.pendingUploads[threadID];\n+ const upload = uploads[localUploadID];\n+ if (!upload) {\n+ // The upload has been cancelled before we were even handed the\n+ // abort function. We should immediately abort.\n+ abort();\n+ }\n+ return {\n+ pendingUploads: {\n+ ...prevState.pendingUploads,\n+ [threadID]: {\n+ ...uploads,\n+ [localUploadID]: {\n+ ...upload,\n+ abort,\n+ },\n+ },\n+ },\n+ };\n+ });\n+ }\n+\n+ handleUploadFailure(\n+ threadID: string,\n+ localUploadID: string,\n+ e: any,\n+ ) {\n+ const failed = e instanceof Error ? e.message : \"failed\";\n+ this.setState(prevState => {\n+ const uploads = prevState.pendingUploads[threadID];\n+ const upload = uploads[localUploadID];\n+ if (!upload) {\n+ // The upload has been cancelled before it failed\n+ return;\n+ }\n+ return {\n+ pendingUploads: {\n+ ...prevState.pendingUploads,\n+ [threadID]: {\n+ ...uploads,\n+ [localUploadID]: {\n+ ...upload,\n+ failed,\n+ abort: null,\n+ },\n+ },\n+ },\n+ };\n});\n}\ncancelPendingUpload(threadID: string, localUploadID: string) {\n- let revokeURL;\n+ let revokeURL, abortRequest;\nthis.setState(\nprevState => {\nconst currentPendingUploads = prevState.pendingUploads[threadID];\n@@ -125,6 +278,12 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nif (!pendingUpload.uriIsReal) {\nrevokeURL = pendingUpload.uri;\n}\n+ if (pendingUpload.abort) {\n+ abortRequest = pendingUpload.abort;\n+ }\n+ if (pendingUpload.serverID) {\n+ // TODO delete upload\n+ }\nconst newPendingUploads = _omit([ localUploadID ])(currentPendingUploads);\nreturn {\npendingUploads: {\n@@ -137,6 +296,9 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nif (revokeURL) {\nURL.revokeObjectURL(revokeURL);\n}\n+ if (abortRequest) {\n+ abortRequest();\n+ }\n},\n);\n}\n@@ -222,6 +384,9 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n}\n-export default connect((state: AppState) => ({\n+export default connect(\n+ (state: AppState) => ({\nactiveChatThreadID: state.navInfo.activeChatThreadID,\n-}))(ChatInputStateContainer);\n+ }),\n+ { uploadMultimedia },\n+)(ChatInputStateContainer);\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state.js",
"new_path": "web/chat/chat-input-state.js",
"diff": "@@ -21,6 +21,9 @@ export type PendingMultimediaUpload = {|\n// is required because those \"fake\" URLs must be disposed properly\nuriIsReal: bool,\nprogressPercent: number,\n+ // This is set once the network request begins and used if the upload is\n+ // cancelled\n+ abort: ?(() => void),\n|};\nexport const pendingMultimediaUploadPropType = PropTypes.shape({\nlocalID: PropTypes.string.isRequired,\n@@ -32,6 +35,7 @@ export const pendingMultimediaUploadPropType = PropTypes.shape({\nuri: PropTypes.string.isRequired,\nuriIsReal: PropTypes.bool.isRequired,\nprogressPercent: PropTypes.number.isRequired,\n+ abort: PropTypes.func,\n});\n// This type represents the input state for a particular thread\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | ChatInputStateContainer.uploadFile
Introduces `uploadMultimedia` action and `PendingMultimediaUpload.abort` as well. |
129,187 | 09.01.2019 13:15:24 | 18,000 | a6cb05c2edca22aec8fa0ba9b5625b4ad79f7c49 | [server] Re-add default export for react-redux libdef
See [https://github.com/flow-typed/flow-typed/pull/3012#issuecomment-452799153](here) | [
{
"change_type": "MODIFY",
"old_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"new_path": "server/flow-typed/npm/react-redux_v5.x.x.js",
"diff": "@@ -268,4 +268,11 @@ declare module \"react-redux\" {\nselectorFactory: SelectorFactory<Com, D, S, OP, EFO, CP>,\nconnectAdvancedOptions: ?(ConnectAdvancedOptions & EFO),\n): (component: Com) => React$ComponentType<OP> & $Shape<ST>;\n+\n+ declare export default {\n+ Provider: typeof Provider,\n+ createProvider: typeof createProvider,\n+ connect: typeof connect,\n+ connectAdvanced: typeof connectAdvanced,\n+ };\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Re-add default export for react-redux libdef
See [https://github.com/flow-typed/flow-typed/pull/3012#issuecomment-452799153](here) |
129,187 | 09.01.2019 13:17:41 | 18,000 | 134d98b8255f054bb680be5afa75334aeb9dd8ac | [web] Hide multimedia upload button for now | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -45,6 +45,7 @@ import {\n} from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\nimport { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';\n+import { isStaff } from 'lib/shared/user-utils';\nimport css from './chat-message-list.css';\nimport LoadingIndicator from '../loading-indicator.react';\n@@ -181,16 +182,9 @@ class ChatInputBar extends React.PureComponent<Props> {\nlet content;\nif (threadHasPermission(this.props.threadInfo, threadPermissions.VOICED)) {\n- content = (\n- <div className={css.inputBarTextInput}>\n- <textarea\n- rows=\"1\"\n- placeholder=\"Send a message...\"\n- value={this.props.chatInputState.draft}\n- onChange={this.onChangeMessageText}\n- onKeyDown={this.onKeyDown}\n- ref={this.textareaRef}\n- />\n+ let multimediaUpload = null;\n+ if (this.props.viewerID && isStaff(this.props.viewerID)) {\n+ multimediaUpload = (\n<a className={css.multimediaUpload} onClick={this.onMultimediaClick}>\n<input\ntype=\"file\"\n@@ -203,6 +197,19 @@ class ChatInputBar extends React.PureComponent<Props> {\nicon={faFileImage}\n/>\n</a>\n+ );\n+ }\n+ content = (\n+ <div className={css.inputBarTextInput}>\n+ <textarea\n+ rows=\"1\"\n+ placeholder=\"Send a message...\"\n+ value={this.props.chatInputState.draft}\n+ onChange={this.onChangeMessageText}\n+ onKeyDown={this.onKeyDown}\n+ ref={this.textareaRef}\n+ />\n+ {multimediaUpload}\n<a className={css.send} onClick={this.onSend}>\n<FontAwesomeIcon\nicon={faChevronRight}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Hide multimedia upload button for now |
129,187 | 09.01.2019 16:33:07 | 18,000 | c4228d116e6d4f6940ece05fcaceb8f872b8ad37 | assignMediaServerIDToMessageActionType
Necessary for updating local media IDs to server ones. | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/upload-actions.js",
"new_path": "lib/actions/upload-actions.js",
"diff": "@@ -17,6 +17,10 @@ async function uploadMultimedia(\nreturn { id: response.id, uri: response.uri };\n}\n+const assignMediaServerIDToMessageActionType =\n+ \"ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE\";\n+\nexport {\nuploadMultimedia,\n+ assignMediaServerIDToMessageActionType,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/message-reducer.js",
"new_path": "lib/reducers/message-reducer.js",
"diff": "@@ -74,6 +74,9 @@ import {\nsaveMessagesActionType,\n} from '../actions/message-actions';\nimport threadWatcher from '../shared/thread-watcher';\n+import {\n+ assignMediaServerIDToMessageActionType,\n+} from '../actions/upload-actions';\n// Input must already be ordered!\nfunction threadsToMessageIDsFromMessageInfos(\n@@ -736,6 +739,41 @@ function reduceMessageStore(\nlocal: _omit(messageIDsToPrune)(messageStore.local),\ncurrentAsOf: messageStore.currentAsOf,\n};\n+ } else if (action.type === assignMediaServerIDToMessageActionType) {\n+ const { messageID, mediaLocalID, mediaServerID } = action.payload;\n+ const message = messageStore.messages[messageID];\n+ invariant(message, `message with ID ${messageID} could not be found`);\n+ invariant(\n+ message.type === messageTypes.MULTIMEDIA,\n+ `message with ID ${messageID} is not messageTypes.MULTIMEDIA`,\n+ );\n+ let replaced = false;\n+ const media = message.media.map(\n+ singleMedia => {\n+ if (singleMedia.id !== mediaLocalID) {\n+ return singleMedia;\n+ }\n+ replaced = true;\n+ return {\n+ ...singleMedia,\n+ id: mediaServerID,\n+ };\n+ },\n+ );\n+ invariant(\n+ replaced,\n+ `message ${messageID} did not contain media with ID ${mediaLocalID}`,\n+ );\n+ return {\n+ ...messageStore,\n+ messages: {\n+ ...messageStore.messages,\n+ [messageID]: {\n+ ...message,\n+ media,\n+ },\n+ },\n+ };\n}\nreturn messageStore;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -22,3 +22,9 @@ export type UploadMultimediaResult = {|\nid: string,\nuri: string,\n|};\n+\n+export type AssignMediaServerIDToMessagePayload = {|\n+ messageID: string,\n+ mediaLocalID: string,\n+ mediaServerID: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -55,7 +55,7 @@ import type {\nCalendarThreadFilter,\nSetCalendarDeletedFilterPayload,\n} from './filter-types';\n-import type { SubscriptionUpdateResult } from '../types/subscription-types';\n+import type { SubscriptionUpdateResult } from './subscription-types';\nimport type {\nConnectionInfo,\nStateSyncFullActionPayload,\n@@ -63,13 +63,14 @@ import type {\nUpdateConnectionStatusPayload,\nSetLateResponsePayload,\nUpdateDisconnectedBarPayload,\n-} from '../types/socket-types';\n-import type { UpdatesResultWithUserInfos } from '../types/update-types';\n+} from './socket-types';\n+import type { UpdatesResultWithUserInfos } from './update-types';\nimport type {\nActivityUpdateSuccessPayload,\nActivityUpdateErrorExtras,\nQueueActivityUpdatesPayload,\n-} from '../types/activity-types';\n+} from './activity-types';\n+import type { AssignMediaServerIDToMessagePayload } from './media-types';\nexport type BaseAppState<NavInfo: BaseNavInfo> = {\nnavInfo: NavInfo,\n@@ -635,6 +636,9 @@ export type BaseAction =\ntype: \"REQUEST_ACCESS_SUCCESS\",\npayload?: void,\nloadingInfo: LoadingInfo,\n+ |} | {|\n+ type: \"ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE\",\n+ payload: AssignMediaServerIDToMessagePayload,\n|};\nexport type ActionPayload\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -19,7 +19,10 @@ import _partition from 'lodash/fp/partition';\nimport _mapValues from 'lodash/fp/mapValues';\nimport { connect } from 'lib/utils/redux-utils';\n-import { uploadMultimedia } from 'lib/actions/upload-actions';\n+import {\n+ uploadMultimedia,\n+ assignMediaServerIDToMessageActionType,\n+} from 'lib/actions/upload-actions';\nimport ChatMessageList from './chat-message-list.react';\nimport { validateFile } from '../utils/media-utils';\n@@ -167,11 +170,14 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nconst uploadAfterSuccess =\nthis.state.pendingUploads[threadID][upload.localID];\nif (uploadAfterSuccess && uploadAfterSuccess.messageID) {\n- // TODO implement this action\n- // this.props.dispatchActionPayload(\n- // assignMediaServerIDActionType,\n- // { mediaServerID: result.id, messageID: uploadAfterSuccess.messageID },\n- // );\n+ this.props.dispatchActionPayload(\n+ assignMediaServerIDToMessageActionType,\n+ {\n+ messageID: uploadAfterSuccess.messageID,\n+ mediaLocalID: upload.localID,\n+ mediaServerID: result.id,\n+ },\n+ );\n}\nthis.setState(prevState => {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | assignMediaServerIDToMessageActionType
Necessary for updating local media IDs to server ones. |
129,187 | 09.01.2019 16:51:56 | 18,000 | 914266bc349ffa670d92ad9abdc37400aec7cf6b | [web] Preload upload image URI before swapping them in | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -25,7 +25,7 @@ import {\n} from 'lib/actions/upload-actions';\nimport ChatMessageList from './chat-message-list.react';\n-import { validateFile } from '../utils/media-utils';\n+import { validateFile, preloadImage } from '../utils/media-utils';\nlet nextLocalUploadID = 0;\n@@ -210,6 +210,8 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n},\n};\n});\n+\n+ await preloadImage(result.uri);\n}\nhandleAbortCallback(\n"
},
{
"change_type": "MODIFY",
"old_path": "web/utils/media-utils.js",
"new_path": "web/utils/media-utils.js",
"diff": "@@ -45,7 +45,16 @@ async function validateFile(file: File): Promise<?FileValidationResult> {\nconst allowedMimeTypeString = Object.keys(mimeTypesToMediaTypes).join(',');\n+function preloadImage(uri: string): Promise<void> {\n+ return new Promise(resolve => {\n+ const img = new Image();\n+ img.src = uri;\n+ img.onload = resolve;\n+ });\n+}\n+\nexport {\nvalidateFile,\nallowedMimeTypeString,\n+ preloadImage,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Preload upload image URI before swapping them in |
129,187 | 09.01.2019 16:59:10 | 18,000 | 26ec8d354b4aad6142eea78fe3da81abdc324dbf | assignMediaServerURIToMessageActionType
Necessary for updating local URIs to global ones after preload. | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/upload-actions.js",
"new_path": "lib/actions/upload-actions.js",
"diff": "@@ -19,8 +19,11 @@ async function uploadMultimedia(\nconst assignMediaServerIDToMessageActionType =\n\"ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE\";\n+const assignMediaServerURIToMessageActionType =\n+ \"ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE\";\nexport {\nuploadMultimedia,\nassignMediaServerIDToMessageActionType,\n+ assignMediaServerURIToMessageActionType,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/message-reducer.js",
"new_path": "lib/reducers/message-reducer.js",
"diff": "@@ -76,6 +76,7 @@ import {\nimport threadWatcher from '../shared/thread-watcher';\nimport {\nassignMediaServerIDToMessageActionType,\n+ assignMediaServerURIToMessageActionType,\n} from '../actions/upload-actions';\n// Input must already be ordered!\n@@ -774,6 +775,41 @@ function reduceMessageStore(\n},\n},\n};\n+ } else if (action.type === assignMediaServerURIToMessageActionType) {\n+ const { messageID, mediaID, serverURI } = action.payload;\n+ const message = messageStore.messages[messageID];\n+ invariant(message, `message with ID ${messageID} could not be found`);\n+ invariant(\n+ message.type === messageTypes.MULTIMEDIA,\n+ `message with ID ${messageID} is not messageTypes.MULTIMEDIA`,\n+ );\n+ let replaced = false;\n+ const media = message.media.map(\n+ singleMedia => {\n+ if (singleMedia.id !== mediaID) {\n+ return singleMedia;\n+ }\n+ replaced = true;\n+ return {\n+ ...singleMedia,\n+ uri: serverURI,\n+ };\n+ },\n+ );\n+ invariant(\n+ replaced,\n+ `message ${messageID} did not contain media with ID ${mediaID}`,\n+ );\n+ return {\n+ ...messageStore,\n+ messages: {\n+ ...messageStore.messages,\n+ [messageID]: {\n+ ...message,\n+ media,\n+ },\n+ },\n+ };\n}\nreturn messageStore;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -28,3 +28,9 @@ export type AssignMediaServerIDToMessagePayload = {|\nmediaLocalID: string,\nmediaServerID: string,\n|};\n+\n+export type AssignMediaServerURIToMessagePayload = {|\n+ messageID: string,\n+ mediaID: string,\n+ serverURI: string,\n+|};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -70,7 +70,10 @@ import type {\nActivityUpdateErrorExtras,\nQueueActivityUpdatesPayload,\n} from './activity-types';\n-import type { AssignMediaServerIDToMessagePayload } from './media-types';\n+import type {\n+ AssignMediaServerIDToMessagePayload,\n+ AssignMediaServerURIToMessagePayload,\n+} from './media-types';\nexport type BaseAppState<NavInfo: BaseNavInfo> = {\nnavInfo: NavInfo,\n@@ -639,6 +642,9 @@ export type BaseAction =\n|} | {|\ntype: \"ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE\",\npayload: AssignMediaServerIDToMessagePayload,\n+ |} | {|\n+ type: \"ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE\",\n+ payload: AssignMediaServerURIToMessagePayload,\n|};\nexport type ActionPayload\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -22,6 +22,7 @@ import { connect } from 'lib/utils/redux-utils';\nimport {\nuploadMultimedia,\nassignMediaServerIDToMessageActionType,\n+ assignMediaServerURIToMessageActionType,\n} from 'lib/actions/upload-actions';\nimport ChatMessageList from './chat-message-list.react';\n@@ -212,6 +213,21 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n});\nawait preloadImage(result.uri);\n+\n+ const uploadAfterPreload =\n+ this.state.pendingUploads[threadID][upload.localID];\n+ if (!uploadAfterPreload || uploadAfterPreload.messageID) {\n+ this.props.dispatchActionPayload(\n+ assignMediaServerURIToMessageActionType,\n+ {\n+ messageID: uploadAfterPreload.messageID,\n+ mediaID: uploadAfterPreload.serverID\n+ ? uploadAfterPreload.serverID\n+ : uploadAfterPreload.localID,\n+ serverURI: result.uri,\n+ },\n+ );\n+ }\n}\nhandleAbortCallback(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | assignMediaServerURIToMessageActionType
Necessary for updating local URIs to global ones after preload. |
129,187 | 09.01.2019 17:36:56 | 18,000 | fd166e5c191cb03a0bc5927082da5d42cc2b6420 | [web] Handle send-after-upload scenario | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -214,10 +214,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nawait preloadImage(result.uri);\n- const uploadAfterPreload =\n- this.state.pendingUploads[threadID][upload.localID];\n- if (!uploadAfterPreload || uploadAfterPreload.messageID) {\n- this.props.dispatchActionPayload(\n+ const replaceURI = upload => this.props.dispatchActionPayload(\nassignMediaServerURIToMessageActionType,\n{\nmessageID: uploadAfterPreload.messageID,\n@@ -227,6 +224,45 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nserverURI: result.uri,\n},\n);\n+\n+ const uploadAfterPreload =\n+ this.state.pendingUploads[threadID][upload.localID];\n+ if (!uploadAfterPreload || uploadAfterPreload.messageID) {\n+ replaceURI(uploadAfterPreload);\n+ } else {\n+ this.setState(prevState => {\n+ const uploads = prevState.pendingUploads[threadID];\n+ const currentUpload = uploads[upload.localID];\n+ if (!currentUpload) {\n+ replaceURI(currentUpload);\n+ return {};\n+ }\n+ let newUploads;\n+ if (currentUpload.messageID) {\n+ // If the messageID is already set, then there is no need to keep\n+ // tracking this upload. The above action dispatch should ensure no\n+ // pointers to this localID exist.\n+ newUploads = _omit([ upload.localID ])(uploads);\n+ replaceURI(currentUpload);\n+ } else {\n+ // Otherwise, the message hasn't been sent yet, so the uploads are still\n+ // pending. We'll mark the serverID in our local state.\n+ newUploads = {\n+ ...uploads,\n+ [upload.localID]: {\n+ ...currentUpload,\n+ uri: result.uri,\n+ uriIsReal: true,\n+ },\n+ };\n+ }\n+ return {\n+ pendingUploads: {\n+ ...prevState.pendingUploads,\n+ [threadID]: newUploads,\n+ },\n+ };\n+ });\n}\n}\n@@ -269,7 +305,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nconst upload = uploads[localUploadID];\nif (!upload) {\n// The upload has been cancelled before it failed\n- return;\n+ return {};\n}\nreturn {\npendingUploads: {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Handle send-after-upload scenario |
129,187 | 09.01.2019 17:37:28 | 18,000 | 5edb08b3903e7558d4b9c8b87de9c2942788b372 | [web] Revoke local URL after replacing it in MultimediaPreview | [
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "@@ -24,6 +24,15 @@ class MultimediaPreview extends React.PureComponent<Props> {\nremove: PropTypes.func.isRequired,\n};\n+ componentDidUpdate(prevProps: Props) {\n+ if (\n+ this.props.pendingUpload.uri !== prevProps.pendingUpload.uri &&\n+ !prevProps.pendingUpload.uriIsReal\n+ ) {\n+ URL.revokeObjectURL(prevProps.pendingUpload.uri);\n+ }\n+ }\n+\nrender() {\nconst { uri, progressPercent } = this.props.pendingUpload;\nconst removeButton = progressPercent === 0\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Revoke local URL after replacing it in MultimediaPreview |
129,187 | 09.01.2019 18:04:45 | 18,000 | 4f4ded3aeadf78740fa7f90bc64add4367d99cd1 | [web] Update react-hot-loader and Webpack config for webpack-dev-server | [
{
"change_type": "MODIFY",
"old_path": "web/package.json",
"new_path": "web/package.json",
"diff": "\"react-dnd-html5-backend\": \"^7.0.2\",\n\"react-dom\": \"^16.2.0\",\n\"react-feather\": \"^1.1.4\",\n- \"react-hot-loader\": \"^4.2.0\",\n+ \"react-hot-loader\": \"^4.6.3\",\n\"react-linkify\": \"^0.2.2\",\n\"react-redux\": \"^5.0.5\",\n\"react-router\": \"^4.1.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "web/root.js",
"new_path": "web/root.js",
"diff": "@@ -7,7 +7,7 @@ import React from 'react';\nimport { Provider } from 'react-redux';\nimport { createStore, applyMiddleware } from 'redux';\nimport { Router, Route } from 'react-router';\n-import { hot } from 'react-hot-loader';\n+import { hot } from 'react-hot-loader/root';\nimport thunk from 'redux-thunk';\nimport {\ncomposeWithDevTools,\n@@ -44,7 +44,7 @@ const RootComponent = () => (\n<Socket />\n</React.Fragment>\n);\n-const RootHMR = hot(module)(RootComponent);\n+const RootHMR = hot(RootComponent);\nconst RootProvider = () => (\n<Provider store={store}>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/webpack.config.js",
"new_path": "web/webpack.config.js",
"diff": "@@ -98,14 +98,6 @@ module.exports = function(env) {\nbrowserConfig = {\n...browserConfig,\nmode: \"development\",\n- entry: {\n- browser: [\n- 'react-hot-loader/patch',\n- 'webpack-dev-server/client?http://localhost:8080',\n- 'webpack/hot/only-dev-server',\n- ...browserConfig.entry.browser,\n- ],\n- },\noutput: {\n...browserConfig.output,\nfilename: 'dev.build.js',\n@@ -138,6 +130,11 @@ module.exports = function(env) {\n},\n},\nbrowserConfig.module.rules[1],\n+ {\n+ test: /\\.jsx?$/,\n+ include: /node_modules/,\n+ use: ['react-hot-loader/webpack'],\n+ },\n{\ntest: /\\.css$/,\nexclude: /node_modules\\/.*\\.css$/,\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -10197,17 +10197,20 @@ react-hot-loader@^3.1.3:\nredbox-react \"^1.3.6\"\nsource-map \"^0.6.1\"\n-react-hot-loader@^4.2.0:\n- version \"4.3.12\"\n- resolved \"https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.3.12.tgz#0d56688884e7330c63a00a17217866280616b07a\"\n- integrity sha512-GMM4TsqUVss2QPe+Y33NlgydA5/+7tAVQxR0rZqWvBpapM8JhD7p6ymMwSZzr5yxjoXXlK/6P6qNQBOqm1dqdg==\n+react-hot-loader@^4.6.3:\n+ version \"4.6.3\"\n+ resolved \"https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.6.3.tgz#d9c8923c45b35fd51538ba4297081a00be6bccb1\"\n+ integrity sha512-FUvRO8dwbeLnc3mgLn8ARuSh8NnLBYJyiRjFn+grY/5GupSyPqv0U7ixgwXro77hwDplhm8z9wU7FlJ8kZqiAQ==\ndependencies:\nfast-levenshtein \"^2.0.6\"\nglobal \"^4.3.0\"\nhoist-non-react-statics \"^2.5.0\"\n+ loader-utils \"^1.1.0\"\n+ lodash.merge \"^4.6.1\"\nprop-types \"^15.6.1\"\nreact-lifecycles-compat \"^3.0.4\"\nshallowequal \"^1.0.2\"\n+ source-map \"^0.7.3\"\nreact-html-email@^3.0.0:\nversion \"3.0.0\"\n@@ -11612,6 +11615,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:\nresolved \"https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263\"\nintegrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==\n+source-map@^0.7.3:\n+ version \"0.7.3\"\n+ resolved \"https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383\"\n+ integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==\n+\nsourcemapped-stacktrace@^1.1.6:\nversion \"1.1.9\"\nresolved \"https://registry.yarnpkg.com/sourcemapped-stacktrace/-/sourcemapped-stacktrace-1.1.9.tgz#c744a99936b33b6891409f4d45c3d2b28ecded4a\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Update react-hot-loader and Webpack config for webpack-dev-server |
129,187 | 09.01.2019 18:07:22 | 18,000 | f5e3e7ee306b5272be3895003ca1c18b8da2eede | [web] Update to React 16.7 | [
{
"change_type": "MODIFY",
"old_path": "web/package.json",
"new_path": "web/package.json",
"diff": "\"lib\": \"0.0.1\",\n\"lodash\": \"^4.17.5\",\n\"prop-types\": \"^15.6.0\",\n- \"react\": \"^16.2.0\",\n+ \"react\": \"^16.7.0\",\n\"react-circular-progressbar\": \"^1.0.0\",\n\"react-color\": \"^2.13.0\",\n\"react-dnd\": \"^7.0.2\",\n\"react-dnd-html5-backend\": \"^7.0.2\",\n- \"react-dom\": \"^16.2.0\",\n+ \"react-dom\": \"^16.7.0\",\n\"react-feather\": \"^1.1.4\",\n\"react-hot-loader\": \"^4.6.3\",\n\"react-linkify\": \"^0.2.2\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -10181,6 +10181,16 @@ react-dom@^16.2.0:\nprop-types \"^15.6.2\"\nscheduler \"^0.10.0\"\n+react-dom@^16.7.0:\n+ version \"16.7.0\"\n+ resolved \"https://registry.yarnpkg.com/react-dom/-/react-dom-16.7.0.tgz#a17b2a7ca89ee7390bc1ed5eb81783c7461748b8\"\n+ integrity sha512-D0Ufv1ExCAmF38P2Uh1lwpminZFRXEINJe53zRAbm4KPwSyd6DY/uDoS0Blj9jvPpn1+wivKpZYc8aAAN/nAkg==\n+ dependencies:\n+ loose-envify \"^1.1.0\"\n+ object-assign \"^4.1.1\"\n+ prop-types \"^15.6.2\"\n+ scheduler \"^0.12.0\"\n+\nreact-feather@^1.1.4:\nversion \"1.1.4\"\nresolved \"https://registry.yarnpkg.com/react-feather/-/react-feather-1.1.4.tgz#d0143da95f9d52843cf13a553091573a7c617897\"\n@@ -10571,6 +10581,16 @@ react@^16.2.0, react@^16.5.2:\nprop-types \"^15.6.2\"\nscheduler \"^0.10.0\"\n+react@^16.7.0:\n+ version \"16.7.0\"\n+ resolved \"https://registry.yarnpkg.com/react/-/react-16.7.0.tgz#b674ec396b0a5715873b350446f7ea0802ab6381\"\n+ integrity sha512-StCz3QY8lxTb5cl2HJxjwLFOXPIFQp+p+hxQfc8WE0QiLfCtIlKj8/+5tjjKm8uSTlAW+fCPaavGFS06V9Ar3A==\n+ dependencies:\n+ loose-envify \"^1.1.0\"\n+ object-assign \"^4.1.1\"\n+ prop-types \"^15.6.2\"\n+ scheduler \"^0.12.0\"\n+\nreactcss@^1.2.0:\nversion \"1.2.3\"\nresolved \"https://registry.yarnpkg.com/reactcss/-/reactcss-1.2.3.tgz#c00013875e557b1cf0dfd9a368a1c3dab3b548dd\"\n@@ -11269,6 +11289,14 @@ scheduler@^0.11.0:\nloose-envify \"^1.1.0\"\nobject-assign \"^4.1.1\"\n+scheduler@^0.12.0:\n+ version \"0.12.0\"\n+ resolved \"https://registry.yarnpkg.com/scheduler/-/scheduler-0.12.0.tgz#8ab17699939c0aedc5a196a657743c496538647b\"\n+ integrity sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw==\n+ dependencies:\n+ loose-envify \"^1.1.0\"\n+ object-assign \"^4.1.1\"\n+\nschema-utils@^0.4.4:\nversion \"0.4.7\"\nresolved \"https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Update to React 16.7 |
129,187 | 09.01.2019 18:25:56 | 18,000 | 356ad3b95c898990bc450f714f21de1cdebb96c8 | [web] Use instead of react-hot-loader/webpack | [
{
"change_type": "MODIFY",
"old_path": "web/package.json",
"new_path": "web/package.json",
"diff": "\"@babel/preset-env\": \"^7.2.3\",\n\"@babel/preset-flow\": \"^7.0.0\",\n\"@babel/preset-react\": \"^7.0.0\",\n+ \"@hot-loader/react-dom\": \"^16.7.0\",\n\"assets-webpack-plugin\": \"^3.9.7\",\n\"babel-plugin-transform-remove-console\": \"^6.8.4\",\n\"concurrently\": \"^3.5.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "web/webpack.config.js",
"new_path": "web/webpack.config.js",
"diff": "@@ -130,11 +130,6 @@ module.exports = function(env) {\n},\n},\nbrowserConfig.module.rules[1],\n- {\n- test: /\\.jsx?$/,\n- include: /node_modules/,\n- use: ['react-hot-loader/webpack'],\n- },\n{\ntest: /\\.css$/,\nexclude: /node_modules\\/.*\\.css$/,\n@@ -175,6 +170,13 @@ module.exports = function(env) {\ncontentBase: __dirname,\nheaders: { 'Access-Control-Allow-Origin': '*' },\n},\n+ resolve: {\n+ ...browserConfig.resolve,\n+ alias: {\n+ ...browserConfig.resolve.alias,\n+ 'react-dom': '@hot-loader/react-dom',\n+ },\n+ },\n};\n} else {\nbrowserConfig = {\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "through2 \"^2.0.0\"\nxdg-basedir \"^3.0.0\"\n+\"@hot-loader/react-dom@^16.7.0\":\n+ version \"16.7.0\"\n+ resolved \"https://registry.yarnpkg.com/@hot-loader/react-dom/-/react-dom-16.7.0.tgz#892e9f13a4eff04bf9164870d0082ce2a69bee69\"\n+ integrity sha512-4MEXzIaKgCIaPSl4vRfmiD/WgTyhNWBPxYD5E5hnsn7V+K3L4fkysI21jcgV3gH2ILqVpwkqN0oZNVkiDiWNYQ==\n+ dependencies:\n+ loose-envify \"^1.1.0\"\n+ object-assign \"^4.1.1\"\n+ prop-types \"^15.6.2\"\n+ scheduler \"^0.12.0\"\n+\n\"@mrmlnc/readdir-enhanced@^2.2.1\":\nversion \"2.2.1\"\nresolved \"https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use @hot-loader/react-dom instead of react-hot-loader/webpack |
129,187 | 09.01.2019 18:32:59 | 18,000 | 9c4e79a1a183bfe8ecd41486bbe589c6ff8cee51 | [web] Fix bug with initial upload | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -119,7 +119,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nconst prevUploads = prevState.pendingUploads[threadID];\nconst mergedUploads = prevUploads\n? { ...prevUploads, ...newUploadsObject }\n- : newUploads;\n+ : newUploadsObject;\nreturn {\npendingUploads: {\n...prevState.pendingUploads,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix bug with initial upload |
129,187 | 09.01.2019 18:46:47 | 18,000 | 6475f4d9b91542f8eec3c428f2f565a6e99f0499 | [web] Allow upload removal during upload | [
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "@@ -35,9 +35,6 @@ class MultimediaPreview extends React.PureComponent<Props> {\nrender() {\nconst { uri, progressPercent } = this.props.pendingUpload;\n- const removeButton = progressPercent === 0\n- ? <XCircleIcon onClick={this.remove} className={css.removeUpload} />\n- : null;\nlet progressIndicator = null;\nif (progressPercent !== 0 && progressPercent !== 1) {\nconst outOfHundred = progressPercent * 100;\n@@ -56,7 +53,7 @@ class MultimediaPreview extends React.PureComponent<Props> {\n<span className={css.preview}>\n<span className={css.previewImage}>\n<img src={uri} />\n- {removeButton}\n+ <XCircleIcon onClick={this.remove} className={css.removeUpload} />\n</span>\n{progressIndicator}\n</span>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Allow upload removal during upload |
129,187 | 09.01.2019 18:47:14 | 18,000 | 0d4f743d87898f101d47a733572f55eae1128be9 | [lib] Fix bug in multimedia upload
`uploadBlob` expects an array of multimedia, not a single one. | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/upload-actions.js",
"new_path": "lib/actions/upload-actions.js",
"diff": "@@ -11,7 +11,7 @@ async function uploadMultimedia(\n): Promise<UploadMultimediaResult> {\nconst response = await fetchJSON(\n'upload_multimedia',\n- { multimedia },\n+ { multimedia: [ multimedia ] },\n{ blobUpload: true, onProgress, abortHandler },\n);\nreturn { id: response.id, uri: response.uri };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Fix bug in multimedia upload
`uploadBlob` expects an array of multimedia, not a single one. |
129,187 | 09.01.2019 18:48:03 | 18,000 | 040f9862570a953931210cd96c59cc848b7421a9 | Move server upload endpoint to upload_multimedia | [
{
"change_type": "MODIFY",
"old_path": "lib/types/message-types.js",
"new_path": "lib/types/message-types.js",
"diff": "@@ -661,8 +661,6 @@ export type SendTextMessageRequest = {|\ntext: string,\n|};\n-export type SendMultimediaMessageResponse = SendMessageResult;\n-\n// Used for the message info included in log-in type actions\nexport type GenericMessagesResult = {|\nmessageInfos: RawMessageInfo[],\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -18,10 +18,7 @@ import './cron';\nimport { jsonEndpoints } from './endpoints';\nimport { websiteResponder } from './responders/website-responders';\nimport { errorReportDownloadResponder } from './responders/report-responders';\n-import {\n- multerProcessor,\n- multimediaMessageCreationResponder,\n-} from './uploads/uploads';\n+import { multerProcessor, multimediaUploadResponder } from './uploads/uploads';\nconst { baseRoutePath } = urlFacts;\n@@ -69,9 +66,9 @@ if (cluster.isMaster) {\nrouter.get('*', htmlHandler(websiteResponder));\nrouter.post(\n- '/create_multimedia_message',\n+ '/upload_multimedia',\nmulterProcessor,\n- uploadHandler(multimediaMessageCreationResponder),\n+ uploadHandler(multimediaUploadResponder),\n);\nserver.use(baseRoutePath, router);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/uploads/uploads.js",
"new_path": "server/src/uploads/uploads.js",
"diff": "import type { Viewer } from '../session/viewer';\nimport type { $Request } from 'express';\n-import type { SendMultimediaMessageResponse } from 'lib/types/message-types';\n+import type { UploadMultimediaResult } from 'lib/types/media-types';\nimport multer from 'multer';\nimport fileType from 'file-type';\n@@ -22,11 +22,10 @@ type MulterFile = {|\nsize: number,\n|};\n-async function multimediaMessageCreationResponder(\n+async function multimediaUploadResponder(\nviewer: Viewer,\nreq: $Request & { files?: $ReadOnlyArray<MulterFile> },\n-): Promise<SendMultimediaMessageResponse> {\n- console.log(req.body);\n+): Promise<UploadMultimediaResult> {\nconst { files } = req;\nif (!files) {\nthrow new ServerError('invalid_parameters');\n@@ -39,10 +38,10 @@ async function multimediaMessageCreationResponder(\nthrow new ServerError('invalid_parameters');\n}\nconsole.log(multerFilesWithInfos);\n- return { id: \"test\", time: 5 };\n+ return { id: \"test\", uri: \"fake\" };\n}\nexport {\nmulterProcessor,\n- multimediaMessageCreationResponder,\n+ multimediaUploadResponder,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Move server upload endpoint to upload_multimedia |
129,187 | 10.01.2019 11:50:33 | 18,000 | f7d6a55c427ac8e0c82ee5869bfcff6df837dcf3 | [native] Don't show save button if save isn't possible | [
{
"change_type": "MODIFY",
"old_path": "native/calendar/entry.react.js",
"new_path": "native/calendar/entry.react.js",
"diff": "@@ -213,6 +213,13 @@ class InternalEntry extends React.Component<Props, State> {\n) {\nthis.save();\n}\n+\n+ if (\n+ this.state.editing && prevState.editing &&\n+ (this.state.text.trim() === \"\") !== (prevState.text.trim() === \"\")\n+ ) {\n+ LayoutAnimation.easeInEaseOut();\n+ }\n}\ncomponentDidMount() {\n@@ -242,8 +249,9 @@ class InternalEntry extends React.Component<Props, State> {\nconst actionLinksColor = darkColor ? '#D3D3D3' : '#404040';\nconst actionLinksTextStyle = { color: actionLinksColor };\nconst actionLinksUnderlayColor = darkColor ? \"#AAAAAA88\" : \"#CCCCCCDD\";\n- let editButtonContent;\n- if (editing) {\n+ let editButtonContent = null;\n+ if (editing && this.state.text.trim() === \"\") {\n+ } else if (editing) {\neditButtonContent = (\n<React.Fragment>\n<Icon\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Don't show save button if save isn't possible |
129,187 | 10.01.2019 15:10:10 | 18,000 | b8afe1df295c5779b5c67d447cdc50f6421f1b14 | [lib] Cap upload filename length | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/media-utils.js",
"new_path": "lib/utils/media-utils.js",
"diff": "@@ -17,7 +17,10 @@ function fileInfoFromData(\nreturn null;\n}\nconst [ readableFileName, extension ] = fileName.split('.');\n- return { name: `${readableFileName}.${ext}`, mime };\n+ const maxReadableLength = 255 - ext.length - 1;\n+ const fixedFileName =\n+ `${readableFileName.substring(0, maxReadableLength)}.${ext}`;\n+ return { name: fixedFileName, mime };\n}\nconst mimeTypesToMediaTypes = {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Cap upload filename length |
129,187 | 10.01.2019 16:44:21 | 18,000 | cb370a4a120ad1efda5f2e70416000c39578f05b | Store uploaded photos in MySQL | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/upload-actions.js",
"new_path": "lib/actions/upload-actions.js",
"diff": "@@ -14,7 +14,8 @@ async function uploadMultimedia(\n{ multimedia: [ multimedia ] },\n{ blobUpload: true, onProgress, abortHandler },\n);\n- return { id: response.id, uri: response.uri };\n+ const [ uploadResult ] = response.results;\n+ return { id: uploadResult.id, uri: uploadResult.uri };\n}\nconst assignMediaServerIDToMessageActionType =\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/media-utils.js",
"new_path": "lib/utils/media-utils.js",
"diff": "// @flow\n+import type { MediaType } from '../types/media-types';\n+\nimport fileType from 'file-type';\n-type FileInfo = {| name: string, mime: string |};\n+type FileInfo = {| name: string, mime: string, mediaType: MediaType |};\nfunction fileInfoFromData(\ndata: Uint8Array | Buffer,\nfileName: string,\n@@ -20,7 +22,7 @@ function fileInfoFromData(\nconst maxReadableLength = 255 - ext.length - 1;\nconst fixedFileName =\n`${readableFileName.substring(0, maxReadableLength)}.${ext}`;\n- return { name: fixedFileName, mime };\n+ return { name: fixedFileName, mime, mediaType };\n}\nconst mimeTypesToMediaTypes = {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/creators/upload-creator.js",
"diff": "+// @flow\n+\n+import type { MediaType, UploadMultimediaResult } from 'lib/types/media-types';\n+import type { Viewer } from '../session/viewer';\n+\n+import crypto from 'crypto';\n+\n+import { ServerError } from 'lib/utils/errors';\n+\n+import { dbQuery, SQL } from '../database';\n+import createIDs from './id-creator';\n+import urlFacts from '../../facts/url';\n+\n+const { baseDomain, basePath } = urlFacts;\n+\n+type UploadInput = {|\n+ name: string,\n+ mime: string,\n+ mediaType: MediaType,\n+ buffer: Buffer,\n+|};\n+async function createUploads(\n+ viewer: Viewer,\n+ uploadInfos: $ReadOnlyArray<UploadInput>,\n+): Promise<UploadMultimediaResult[]> {\n+ if (!viewer.loggedIn) {\n+ throw new ServerError('not_logged_in');\n+ }\n+\n+ const ids = await createIDs(\"uploads\", uploadInfos.length);\n+ const secret = crypto.randomBytes(8).toString('hex');\n+ const uploadRows = uploadInfos.map(uploadInfo => [\n+ ids.shift(),\n+ viewer.userID,\n+ uploadInfo.mediaType,\n+ uploadInfo.name,\n+ uploadInfo.mime,\n+ uploadInfo.buffer,\n+ secret,\n+ ]);\n+\n+ const insertQuery = SQL`\n+ INSERT INTO uploads(id, uploader, type, filename, mime, content, secret)\n+ VALUES ${uploadRows}\n+ `;\n+ await dbQuery(insertQuery);\n+\n+ return uploadRows.map(row => ({\n+ id: row[0],\n+ uri: getUploadURL(row[0], row[6]),\n+ }));\n+}\n+\n+function getUploadURL(id: string, secret: string) {\n+ return `${baseDomain}${basePath}upload/${id}/${secret}`;\n+}\n+\n+export default createUploads;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/uploads/uploads.js",
"new_path": "server/src/uploads/uploads.js",
"diff": "@@ -10,6 +10,8 @@ import fileType from 'file-type';\nimport { fileInfoFromData } from 'lib/utils/media-utils';\nimport { ServerError } from 'lib/utils/errors';\n+import createUploads from '../creators/upload-creator';\n+\nconst upload = multer();\nconst multerProcessor = upload.array('multimedia');\n@@ -22,23 +24,30 @@ type MulterFile = {|\nsize: number,\n|};\n+type MultimediaUploadResult = {|\n+ results: UploadMultimediaResult[],\n+|};\nasync function multimediaUploadResponder(\nviewer: Viewer,\nreq: $Request & { files?: $ReadOnlyArray<MulterFile> },\n-): Promise<UploadMultimediaResult> {\n+): Promise<MultimediaUploadResult> {\nconst { files } = req;\nif (!files) {\nthrow new ServerError('invalid_parameters');\n}\n- const multerFilesWithInfos = files.map(multerFile => ({\n- multerFile,\n- fileInfo: fileInfoFromData(multerFile.buffer, multerFile.originalname),\n- })).filter(Boolean);\n- if (multerFilesWithInfos.length === 0) {\n+ const uploadInfos = files.map(multerFile => {\n+ const { buffer, originalname } = multerFile;\n+ const fileInfo = fileInfoFromData(buffer, originalname);\n+ if (!fileInfo) {\n+ return null;\n+ }\n+ return { ...fileInfo, buffer };\n+ }).filter(Boolean);\n+ if (uploadInfos.length === 0) {\nthrow new ServerError('invalid_parameters');\n}\n- console.log(multerFilesWithInfos);\n- return { id: \"test\", uri: \"fake\" };\n+ const results = await createUploads(viewer, uploadInfos);\n+ return { results };\n}\nexport {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Store uploaded photos in MySQL |
129,187 | 11.01.2019 12:05:41 | 18,000 | cd69dba4fb23e1d974f07430a4bf75710e24a31d | [server] Endpoint to download uploads | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/fetchers/upload-fetchers.js",
"diff": "+// @flow\n+\n+import type { Viewer } from '../session/viewer';\n+\n+import { dbQuery, SQL } from '../database';\n+import { ServerError } from 'lib/utils/errors';\n+\n+type UploadInfo = {|\n+ content: Buffer,\n+ mime: string,\n+|};\n+async function fetchUpload(\n+ viewer: Viewer,\n+ id: string,\n+ secret: string,\n+): Promise<UploadInfo> {\n+ const query = SQL`\n+ SELECT content, mime\n+ FROM uploads\n+ WHERE id = ${id} AND secret = ${secret}\n+ `;\n+ const [ result ] = await dbQuery(query);\n+\n+ if (result.length === 0) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ const [ row ] = result;\n+ const { content, mime } = row;\n+ return { content, mime };\n+}\n+\n+export {\n+ fetchUpload,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -18,7 +18,11 @@ import './cron';\nimport { jsonEndpoints } from './endpoints';\nimport { websiteResponder } from './responders/website-responders';\nimport { errorReportDownloadResponder } from './responders/report-responders';\n-import { multerProcessor, multimediaUploadResponder } from './uploads/uploads';\n+import {\n+ multerProcessor,\n+ multimediaUploadResponder,\n+ uploadDownloadResponder,\n+} from './uploads/uploads';\nconst { baseRoutePath } = urlFacts;\n@@ -61,6 +65,11 @@ if (cluster.isMaster) {\n'/download_error_report/:reportID',\ndownloadHandler(errorReportDownloadResponder),\n);\n+ router.get(\n+ '/upload/:uploadID/:secret',\n+ downloadHandler(uploadDownloadResponder),\n+ );\n+\n// $FlowFixMe express-ws has side effects that can't be typed\nrouter.ws('/ws', onConnection);\nrouter.get('*', htmlHandler(websiteResponder));\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/uploads/uploads.js",
"new_path": "server/src/uploads/uploads.js",
"diff": "@@ -11,6 +11,7 @@ import { fileInfoFromData } from 'lib/utils/media-utils';\nimport { ServerError } from 'lib/utils/errors';\nimport createUploads from '../creators/upload-creator';\n+import { fetchUpload } from '../fetchers/upload-fetchers';\nconst upload = multer();\nconst multerProcessor = upload.array('multimedia');\n@@ -50,7 +51,22 @@ async function multimediaUploadResponder(\nreturn { results };\n}\n+async function uploadDownloadResponder(\n+ viewer: Viewer,\n+ req: $Request,\n+ res: $Response,\n+): Promise<void> {\n+ const { uploadID, secret } = req.params;\n+ if (!uploadID || !secret) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ const { content, mime } = await fetchUpload(viewer, uploadID, secret);\n+ res.set(\"Content-Type\", mime);\n+ res.send(content);\n+}\n+\nexport {\nmulterProcessor,\nmultimediaUploadResponder,\n+ uploadDownloadResponder,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Endpoint to download uploads |
129,187 | 11.01.2019 12:07:57 | 18,000 | c857f92787fffec332acd18573f1d7bc99391a8c | [web] Clear abort function on successful upload | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -201,6 +201,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n[upload.localID]: {\n...currentUpload,\nserverID: result.id,\n+ abort: null,\n},\n};\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Clear abort function on successful upload |
129,187 | 11.01.2019 12:26:39 | 18,000 | b26d5ffe30a74ec1300ac9df95183fbb675cd274 | Delete uploads if they are cancelled after already being uploaded | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/upload-actions.js",
"new_path": "lib/actions/upload-actions.js",
"diff": "@@ -23,8 +23,16 @@ const assignMediaServerIDToMessageActionType =\nconst assignMediaServerURIToMessageActionType =\n\"ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE\";\n+async function deleteUpload(\n+ fetchJSON: FetchJSON,\n+ id: string,\n+): Promise<void> {\n+ await fetchJSON('delete_upload', { id });\n+}\n+\nexport {\nuploadMultimedia,\nassignMediaServerIDToMessageActionType,\nassignMediaServerURIToMessageActionType,\n+ deleteUpload,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/endpoints.js",
"new_path": "lib/types/endpoints.js",
"diff": "@@ -73,6 +73,7 @@ const socketSafeEndpoints = Object.freeze({\nREQUEST_ACCESS: 'request_access',\nCREATE_REPORT: 'create_report',\nCREATE_MULTIMEDIA_MESSAGE: 'create_multimedia_message',\n+ DELETE_UPLOAD: 'delete_upload',\n});\ntype SocketSafeEndpoint = $Values<typeof socketSafeEndpoints>;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -34,3 +34,7 @@ export type AssignMediaServerURIToMessagePayload = {|\nmediaID: string,\nserverURI: string,\n|};\n+\n+export type UploadDeletionRequest = {|\n+ id: string,\n+|};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/deleters/upload-deleters.js",
"diff": "+// @flow\n+\n+import type { Viewer } from '../session/viewer';\n+\n+import { dbQuery, SQL } from '../database';\n+import { ServerError } from 'lib/utils/errors';\n+\n+async function deleteUpload(\n+ viewer: Viewer,\n+ id: string,\n+): Promise<void> {\n+ if (!viewer.loggedIn) {\n+ throw new ServerError('not_logged_in');\n+ }\n+\n+ const fetchQuery = SQL`\n+ SELECT uploader, container\n+ FROM uploads\n+ WHERE id = ${id}\n+ `;\n+ const [ result ] = await dbQuery(fetchQuery);\n+\n+ if (result.length === 0) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ const [ row ] = result;\n+ const { uploader, container } = row;\n+\n+ if (uploader.toString() !== viewer.userID || container !== null) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+\n+ const deleteQuery = SQL`\n+ DELETE u, i\n+ FROM uploads u\n+ LEFT JOIN ids i ON i.id = u.id\n+ WHERE u.id = ${id}\n+ `;\n+ await dbQuery(deleteQuery);\n+}\n+\n+export {\n+ deleteUpload,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/endpoints.js",
"new_path": "server/src/endpoints.js",
"diff": "@@ -48,6 +48,7 @@ import {\nreportCreationResponder,\nerrorReportFetchInfosResponder,\n} from './responders/report-responders';\n+import { uploadDeletionResponder } from './uploads/uploads';\nconst jsonEndpoints: {[id: Endpoint]: JSONResponder} = {\n'update_activity': updateActivityResponder,\n@@ -84,6 +85,7 @@ const jsonEndpoints: {[id: Endpoint]: JSONResponder} = {\n'fetch_error_report_infos': errorReportFetchInfosResponder,\n'request_access': requestAccessResponder,\n'update_calendar_query': calendarQueryUpdateResponder,\n+ 'delete_upload': uploadDeletionResponder,\n};\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/uploads/uploads.js",
"new_path": "server/src/uploads/uploads.js",
"diff": "import type { Viewer } from '../session/viewer';\nimport type { $Request } from 'express';\n-import type { UploadMultimediaResult } from 'lib/types/media-types';\n+import type {\n+ UploadMultimediaResult,\n+ UploadDeletionRequest,\n+} from 'lib/types/media-types';\nimport multer from 'multer';\nimport fileType from 'file-type';\n@@ -12,6 +15,7 @@ import { ServerError } from 'lib/utils/errors';\nimport createUploads from '../creators/upload-creator';\nimport { fetchUpload } from '../fetchers/upload-fetchers';\n+import { deleteUpload } from '../deleters/upload-deleters';\nconst upload = multer();\nconst multerProcessor = upload.array('multimedia');\n@@ -65,8 +69,17 @@ async function uploadDownloadResponder(\nres.send(content);\n}\n+async function uploadDeletionResponder(\n+ viewer: Viewer,\n+ request: UploadDeletionRequest,\n+): Promise<void> {\n+ const { id } = request;\n+ await deleteUpload(viewer, id);\n+}\n+\nexport {\nmulterProcessor,\nmultimediaUploadResponder,\nuploadDownloadResponder,\n+ uploadDeletionResponder,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -23,6 +23,7 @@ import {\nuploadMultimedia,\nassignMediaServerIDToMessageActionType,\nassignMediaServerURIToMessageActionType,\n+ deleteUpload,\n} from 'lib/actions/upload-actions';\nimport ChatMessageList from './chat-message-list.react';\n@@ -41,6 +42,7 @@ type Props = {|\nonProgress: (percent: number) => void,\nabortHandler: (abort: () => void) => void,\n) => Promise<UploadMultimediaResult>,\n+ deleteUpload: (id: string) => Promise<void>,\n|};\ntype State = {|\npendingUploads:\n@@ -53,6 +55,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nactiveChatThreadID: PropTypes.string,\ndispatchActionPayload: PropTypes.func.isRequired,\nuploadMultimedia: PropTypes.func.isRequired,\n+ deleteUpload: PropTypes.func.isRequired,\n};\nstate = {\npendingUploads: {},\n@@ -343,7 +346,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nabortRequest = pendingUpload.abort;\n}\nif (pendingUpload.serverID) {\n- // TODO delete upload\n+ this.props.deleteUpload(pendingUpload.serverID);\n}\nconst newPendingUploads = _omit([ localUploadID ])(currentPendingUploads);\nreturn {\n@@ -449,5 +452,5 @@ export default connect(\n(state: AppState) => ({\nactiveChatThreadID: state.navInfo.activeChatThreadID,\n}),\n- { uploadMultimedia },\n+ { uploadMultimedia, deleteUpload },\n)(ChatInputStateContainer);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Delete uploads if they are cancelled after already being uploaded |
129,187 | 11.01.2019 13:39:00 | 18,000 | 6e513b8444093ec7826b8ae37f7f65411c0d79dd | [web] Handle upload failure in MultimediaPreview | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -319,6 +319,7 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\n[localUploadID]: {\n...upload,\nfailed,\n+ progressPercent: 0,\nabort: null,\n},\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -223,6 +223,18 @@ span.preview > span.previewImage > svg.removeUpload {\nspan.preview:hover > span.previewImage > svg.removeUpload {\ndisplay: inherit;\n}\n+span.preview > svg.uploadError {\n+ position: absolute;\n+ top: 0;\n+ bottom: 0;\n+ left: 0;\n+ right: 0;\n+ margin: auto auto;\n+ color: white;\n+ border-radius: 50%;\n+ box-shadow: inset 0px 0px 5px rgba(0,0,0,0.5);\n+ background-color: #DD2222;\n+}\nspan.preview > svg.progressIndicator {\nposition: absolute;\ntop: 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "@@ -8,6 +8,7 @@ import {\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport XCircleIcon from 'react-feather/dist/icons/x-circle';\n+import AlertCircleIcon from 'react-feather/dist/icons/alert-circle';\nimport CircularProgressbar from 'react-circular-progressbar';\nimport 'react-circular-progressbar/dist/styles.css';\n@@ -34,7 +35,8 @@ class MultimediaPreview extends React.PureComponent<Props> {\n}\nrender() {\n- const { uri, progressPercent } = this.props.pendingUpload;\n+ const { uri, progressPercent, failed } = this.props.pendingUpload;\n+\nlet progressIndicator = null;\nif (progressPercent !== 0 && progressPercent !== 1) {\nconst outOfHundred = progressPercent * 100;\n@@ -49,6 +51,17 @@ class MultimediaPreview extends React.PureComponent<Props> {\n/>\n);\n}\n+\n+ let errorIndicator = null;\n+ if (failed) {\n+ errorIndicator = (\n+ <AlertCircleIcon\n+ className={css.uploadError}\n+ size={36}\n+ />\n+ );\n+ }\n+\nreturn (\n<span className={css.preview}>\n<span className={css.previewImage}>\n@@ -56,6 +69,7 @@ class MultimediaPreview extends React.PureComponent<Props> {\n<XCircleIcon onClick={this.remove} className={css.removeUpload} />\n</span>\n{progressIndicator}\n+ {errorIndicator}\n</span>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Handle upload failure in MultimediaPreview |
129,187 | 11.01.2019 19:21:49 | 18,000 | 0be1124763490769f675adbb956125fa195e5cfe | [lib] Disable timeout for uploadBlob
Continue to allow it to be overriden, but use XMLHttpRequest native features for that. | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/fetch-json.js",
"new_path": "lib/utils/fetch-json.js",
"diff": "@@ -26,7 +26,8 @@ import { uploadBlob } from './upload-blob';\nimport { fetchJSONTimeout } from '../shared/timeouts';\nexport type FetchJSONOptions = $Shape<{|\n- timeout: number, // in milliseconds\n+ // null timeout means no timeout, which is the default for uploadBlob\n+ timeout: ?number, // in milliseconds\nblobUpload: bool,\n// the rest (onProgress, abortHandler) only work with blobUpload\nonProgress: (percent: number) => void,\n@@ -105,9 +106,9 @@ async function fetchJSON(\nconst url = urlPrefix ? `${urlPrefix}/${endpoint}` : endpoint;\n- let jsonPromise;\n+ let json;\nif (options && options.blobUpload) {\n- jsonPromise = uploadBlob(url, cookie, sessionID, input, options);\n+ json = await uploadBlob(url, cookie, sessionID, input, options);\n} else {\nconst mergedData: RequestData = { input };\nif (getConfig().setCookieOnRequest) {\n@@ -126,7 +127,7 @@ async function fetchJSON(\n// not logged in on web.\nmergedData.sessionID = sessionID ? sessionID : null;\n}\n- jsonPromise = (async (): Promise<FetchJSONServerResponse> => {\n+ const fetchPromise = (async (): Promise<FetchJSONServerResponse> => {\nconst response = await fetch(url, {\nmethod: 'POST',\n// This is necessary to allow cookie headers to get passed down to us\n@@ -145,16 +146,20 @@ async function fetchJSON(\nthrow e;\n}\n})();\n- }\nconst timeout = options && options.timeout\n? options.timeout\n: fetchJSONTimeout;\n+ if (!timeout) {\n+ json = await fetchPromise;\n+ } else {\nconst rejectPromise = (async () => {\nawait sleep(timeout);\nthrow new FetchTimeout(`fetchJSON timed out call to ${endpoint}`, endpoint);\n})();\n- const json = await Promise.race([ jsonPromise, rejectPromise ]);\n+ json = await Promise.race([ fetchPromise, rejectPromise ]);\n+ }\n+ }\nconst { cookieChange, error, payload } = json;\nconst sessionChange: ?ServerSessionChange = cookieChange;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/upload-blob.js",
"new_path": "lib/utils/upload-blob.js",
"diff": "@@ -58,9 +58,13 @@ function uploadBlob(\nxhr.withCredentials = true;\nxhr.setRequestHeader('Accept', 'application/json');\n+ if (options && options.timeout) {\n+ xhr.timeout = options.timeout;\n+ }\n+\nif (options && options.onProgress) {\nconst { onProgress } = options;\n- xhr.onprogress = ({ loaded, total }) => {\n+ xhr.upload.onprogress = ({ loaded, total }) => {\nonProgress(loaded / total);\n};\n}\n@@ -87,6 +91,12 @@ function uploadBlob(\nfailed = true;\nreject(event);\n};\n+ if (options && options.timeout) {\n+ xhr.ontimeout = (event) => {\n+ failed = true;\n+ reject(event);\n+ };\n+ }\nif (options && options.abortHandler) {\noptions.abortHandler(() => {\nfailed = true;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Disable timeout for uploadBlob
Continue to allow it to be overriden, but use XMLHttpRequest native features for that. |
129,187 | 11.01.2019 19:25:30 | 18,000 | d99b6ee29726e3abe3ede300a69317396da63f0e | [web] Math.floor the percent | [
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": "web/chat/multimedia-preview.react.js",
"diff": "@@ -39,7 +39,7 @@ class MultimediaPreview extends React.PureComponent<Props> {\nlet progressIndicator = null;\nif (progressPercent !== 0 && progressPercent !== 1) {\n- const outOfHundred = progressPercent * 100;\n+ const outOfHundred = Math.floor(progressPercent * 100);\nconst text = `${outOfHundred}%`;\nprogressIndicator = (\n<CircularProgressbar\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Math.floor the percent |
129,187 | 11.01.2019 19:59:02 | 18,000 | b1306942113e4117b9684a1cdff90061c7431d6b | [native] Handle empty password correctly in DeleteThread | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/delete-thread.react.js",
"new_path": "native/chat/settings/delete-thread.react.js",
"diff": "@@ -207,7 +207,10 @@ class InnerDeleteThread extends React.PureComponent<Props, State> {\ntry {\nreturn await this.props.deleteThread(threadInfo.id, this.state.password);\n} catch (e) {\n- if (e.message === 'invalid_credentials') {\n+ if (\n+ e.message === 'invalid_credentials' ||\n+ e.message === 'invalid_parameters'\n+ ) {\nAlert.alert(\n\"Incorrect password\",\n\"The password you entered is incorrect\",\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Handle empty password correctly in DeleteThread |
129,187 | 14.01.2019 10:37:56 | 18,000 | 7b3b9a91581048458af9bc85f98fa8533cfd8cf9 | Move message action type constants to message-actions | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/message-actions.js",
"new_path": "lib/actions/message-actions.js",
"diff": "@@ -98,6 +98,8 @@ async function sendMultimediaMessage(\n}\nconst saveMessagesActionType = \"SAVE_MESSAGES\";\n+const processMessagesActionType = \"PROCESS_MESSAGES\";\n+const messageStorePruneActionType = \"MESSAGE_STORE_PRUNE\";\nexport {\nfetchMessagesBeforeCursorActionTypes,\n@@ -109,4 +111,6 @@ export {\nsendMultimediaMessageActionTypes,\nsendMultimediaMessage,\nsaveMessagesActionType,\n+ processMessagesActionType,\n+ messageStorePruneActionType,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/message-reducer.js",
"new_path": "lib/reducers/message-reducer.js",
"diff": "@@ -10,8 +10,6 @@ import {\nmessageTruncationStatus,\nmessageTypes,\ndefaultNumberPerThread,\n- processMessagesActionType,\n- messageStorePruneActionType,\n} from '../types/message-types';\nimport type { BaseAction } from '../types/redux-types';\nimport { type RawThreadInfo, threadPermissions } from '../types/thread-types';\n@@ -72,6 +70,8 @@ import {\nfetchMostRecentMessagesActionTypes,\nsendTextMessageActionTypes,\nsaveMessagesActionType,\n+ processMessagesActionType,\n+ messageStorePruneActionType,\n} from '../actions/message-actions';\nimport threadWatcher from '../shared/thread-watcher';\nimport {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/message-handler.react.js",
"new_path": "lib/socket/message-handler.react.js",
"diff": "@@ -5,7 +5,7 @@ import {\nserverSocketMessageTypes,\ntype SocketListener,\n} from '../types/socket-types';\n-import { processMessagesActionType } from '../types/message-types';\n+import { processMessagesActionType } from '../actions/message-actions';\nimport type { DispatchActionPayload } from '../utils/action-utils';\nimport * as React from 'react';\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/message-types.js",
"new_path": "lib/types/message-types.js",
"diff": "@@ -678,9 +678,7 @@ export type MessagesResultWithUserInfos = {|\nmessagesResult: MessagesResponse,\nuserInfos: $ReadOnlyArray<UserInfo>,\n|};\n-export const processMessagesActionType = \"PROCESS_MESSAGES\";\n-export const messageStorePruneActionType = \"MESSAGE_STORE_PRUNE\";\nexport type MessageStorePrunePayload = {|\nthreadIDs: $ReadOnlyArray<string>,\n|};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-store-pruner.react.js",
"new_path": "native/chat/message-store-pruner.react.js",
"diff": "// @flow\nimport type { AppState } from '../redux-setup';\n-import { messageStorePruneActionType } from 'lib/types/message-types';\n+import { messageStorePruneActionType } from 'lib/actions/message-actions';\nimport type { DispatchActionPayload } from 'lib/utils/action-utils';\nimport * as React from 'react';\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Move message action type constants to message-actions |
129,187 | 23.01.2019 15:36:07 | 28,800 | 87ceef21e1ba93045a02ab5a32f95e5d43083791 | MultimediaPreview -> Multimedia
We'll use the new `Multimedia` from within `MultimediaMessage`. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -53,7 +53,7 @@ import css from './chat-message-list.css';\nimport LoadingIndicator from '../loading-indicator.react';\nimport { nonThreadCalendarQuery } from '../selectors/nav-selectors';\nimport { allowedMimeTypeString } from '../utils/media-utils';\n-import MultimediaPreview from './multimedia-preview.react';\n+import Multimedia from './multimedia.react';\ntype Props = {|\nthreadInfo: ThreadInfo,\n@@ -165,11 +165,12 @@ class ChatInputBar extends React.PureComponent<Props> {\n);\n}\n- const { pendingUploads } = this.props.chatInputState;\n+ const { pendingUploads, cancelPendingUpload } = this.props.chatInputState;\nconst multimediaPreviews = pendingUploads.map(pendingUpload => (\n- <MultimediaPreview\n+ <Multimedia\n+ uri={pendingUpload.uri}\npendingUpload={pendingUpload}\n- remove={this.props.chatInputState.cancelPendingUpload}\n+ remove={cancelPendingUpload}\nkey={pendingUpload.localID}\n/>\n));\n"
},
{
"change_type": "DELETE",
"old_path": "web/chat/multimedia-preview.react.js",
"new_path": null,
"diff": "-// @flow\n-\n-import {\n- type PendingMultimediaUpload,\n- pendingMultimediaUploadPropType,\n-} from './chat-input-state';\n-\n-import * as React from 'react';\n-import PropTypes from 'prop-types';\n-import XCircleIcon from 'react-feather/dist/icons/x-circle';\n-import AlertCircleIcon from 'react-feather/dist/icons/alert-circle';\n-import CircularProgressbar from 'react-circular-progressbar';\n-import 'react-circular-progressbar/dist/styles.css';\n-\n-import css from './chat-message-list.css';\n-\n-type Props = {|\n- pendingUpload: PendingMultimediaUpload,\n- remove: (uploadID: string) => void,\n-|};\n-class MultimediaPreview extends React.PureComponent<Props> {\n-\n- static propTypes = {\n- pendingUpload: pendingMultimediaUploadPropType.isRequired,\n- remove: PropTypes.func.isRequired,\n- };\n-\n- componentDidUpdate(prevProps: Props) {\n- if (\n- this.props.pendingUpload.uri !== prevProps.pendingUpload.uri &&\n- !prevProps.pendingUpload.uriIsReal\n- ) {\n- URL.revokeObjectURL(prevProps.pendingUpload.uri);\n- }\n- }\n-\n- render() {\n- const { uri, progressPercent, failed } = this.props.pendingUpload;\n-\n- let progressIndicator = null;\n- if (progressPercent !== 0 && progressPercent !== 1) {\n- const outOfHundred = Math.floor(progressPercent * 100);\n- const text = `${outOfHundred}%`;\n- progressIndicator = (\n- <CircularProgressbar\n- percentage={outOfHundred}\n- text={text}\n- background\n- backgroundPadding={6}\n- className={css.progressIndicator}\n- />\n- );\n- }\n-\n- let errorIndicator = null;\n- if (failed) {\n- errorIndicator = (\n- <AlertCircleIcon\n- className={css.uploadError}\n- size={36}\n- />\n- );\n- }\n-\n- return (\n- <span className={css.preview}>\n- <span className={css.previewImage}>\n- <img src={uri} />\n- <XCircleIcon onClick={this.remove} className={css.removeUpload} />\n- </span>\n- {progressIndicator}\n- {errorIndicator}\n- </span>\n- );\n- }\n-\n- remove = () => {\n- this.props.remove(this.props.pendingUpload.localID);\n- }\n-\n-}\n-\n-export default MultimediaPreview;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/chat/multimedia.react.js",
"diff": "+// @flow\n+\n+import {\n+ type PendingMultimediaUpload,\n+ pendingMultimediaUploadPropType,\n+} from './chat-input-state';\n+\n+import * as React from 'react';\n+import PropTypes from 'prop-types';\n+import invariant from 'invariant';\n+import XCircleIcon from 'react-feather/dist/icons/x-circle';\n+import AlertCircleIcon from 'react-feather/dist/icons/alert-circle';\n+import CircularProgressbar from 'react-circular-progressbar';\n+import 'react-circular-progressbar/dist/styles.css';\n+\n+import css from './chat-message-list.css';\n+\n+type Props = {|\n+ uri: string,\n+ pendingUpload?: PendingMultimediaUpload,\n+ remove?: (uploadID: string) => void,\n+|};\n+class Multimedia extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ uri: PropTypes.string.isRequired,\n+ pendingUpload: pendingMultimediaUploadPropType,\n+ remove: PropTypes.func,\n+ };\n+\n+ componentDidUpdate(prevProps: Props) {\n+ const { uri, pendingUpload } = this.props;\n+ if (uri === prevProps.uri) {\n+ return;\n+ }\n+ if (\n+ (!pendingUpload || pendingUpload.uriIsReal) &&\n+ (!prevProps.pendingUpload || !prevProps.pendingUpload.uriIsReal)\n+ ) {\n+ URL.revokeObjectURL(prevProps.uri);\n+ }\n+ }\n+\n+ render() {\n+ let progressIndicator, errorIndicator, removeButton;\n+\n+ const { pendingUpload, remove } = this.props;\n+ if (pendingUpload) {\n+ const { progressPercent, failed } = pendingUpload;\n+\n+ if (progressPercent !== 0 && progressPercent !== 1) {\n+ const outOfHundred = Math.floor(progressPercent * 100);\n+ const text = `${outOfHundred}%`;\n+ progressIndicator = (\n+ <CircularProgressbar\n+ percentage={outOfHundred}\n+ text={text}\n+ background\n+ backgroundPadding={6}\n+ className={css.progressIndicator}\n+ />\n+ );\n+ }\n+\n+ if (failed) {\n+ errorIndicator = (\n+ <AlertCircleIcon\n+ className={css.uploadError}\n+ size={36}\n+ />\n+ );\n+ }\n+\n+ if (remove) {\n+ removeButton = (\n+ <XCircleIcon onClick={this.remove} className={css.removeUpload} />\n+ );\n+ }\n+ }\n+\n+ return (\n+ <span className={css.preview}>\n+ <span className={css.previewImage}>\n+ <img src={this.props.uri} />\n+ {removeButton}\n+ </span>\n+ {progressIndicator}\n+ {errorIndicator}\n+ </span>\n+ );\n+ }\n+\n+ remove = () => {\n+ const { remove, pendingUpload } = this.props;\n+ invariant(\n+ remove && pendingUpload,\n+ \"Multimedia cannot be removed as either remove or pendingUpload \" +\n+ \"are unspecified\",\n+ );\n+ remove(pendingUpload.localID);\n+ }\n+\n+}\n+\n+export default Multimedia;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | MultimediaPreview -> Multimedia
We'll use the new `Multimedia` from within `MultimediaMessage`. |
129,187 | 23.01.2019 16:15:13 | 28,800 | 3a388623e9d81fbaead261ded58789cacc5da6ca | [web] Render Multimedia from within MultimediaMessage
Also passes down `ChatInputState` to `MultimediaMessage`. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -156,7 +156,8 @@ class ChatMessageList extends React.PureComponent<Props, State> {\n</div>\n);\n}\n- const threadInfo = this.props.threadInfo;\n+ const { threadInfo, chatInputState } = this.props;\n+ invariant(chatInputState, \"ChatInputState should be set\");\ninvariant(threadInfo, \"ThreadInfo should be set if messageListData is\");\nconst focused =\nmessageKey(item.messageInfo) === this.state.focusedMessageKey;\n@@ -166,6 +167,7 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nthreadInfo={threadInfo}\nfocused={focused}\ntoggleFocus={this.toggleMessageFocus}\n+ chatInputState={chatInputState}\nkey={ChatMessageList.keyExtractor(item)}\n/>\n);\n@@ -190,9 +192,9 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nif (!messageListData) {\nreturn <div className={css.container} />;\n}\n- const messages = messageListData.map(this.renderItem);\ninvariant(threadInfo, \"ThreadInfo should be set if messageListData is\");\ninvariant(chatInputState, \"ChatInputState should be set\");\n+ const messages = messageListData.map(this.renderItem);\nconst containerStyle = classNames({\n[css.container]: true,\n[css.activeContainer]: isActive,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message.react.js",
"new_path": "web/chat/message.react.js",
"diff": "@@ -6,6 +6,10 @@ import {\n} from 'lib/selectors/chat-selectors';\nimport { messageTypes } from 'lib/types/message-types';\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import {\n+ chatInputStatePropType,\n+ type ChatInputState,\n+} from './chat-input-state';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n@@ -22,6 +26,7 @@ type Props = {|\nthreadInfo: ThreadInfo,\nfocused: bool,\ntoggleFocus: (messageKey: string) => void,\n+ chatInputState: ChatInputState,\n|};\nclass Message extends React.PureComponent<Props> {\n@@ -30,6 +35,7 @@ class Message extends React.PureComponent<Props> {\nthreadInfo: threadInfoPropType.isRequired,\nfocused: PropTypes.bool.isRequired,\ntoggleFocus: PropTypes.func.isRequired,\n+ chatInputState: chatInputStatePropType.isRequired,\n};\nrender() {\n@@ -55,6 +61,7 @@ class Message extends React.PureComponent<Props> {\n<MultimediaMessage\nitem={this.props.item}\ntoggleFocus={this.props.toggleFocus}\n+ chatInputState={this.props.chatInputState}\n/>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -5,6 +5,10 @@ import {\nchatMessageItemPropType,\n} from 'lib/selectors/chat-selectors';\nimport { messageTypes } from 'lib/types/message-types';\n+import {\n+ chatInputStatePropType,\n+ type ChatInputState,\n+} from './chat-input-state';\nimport * as React from 'react';\nimport invariant from 'invariant';\n@@ -13,16 +17,19 @@ import PropTypes from 'prop-types';\nimport { messageKey } from 'lib/shared/message-utils';\nimport css from './chat-message-list.css';\n+import Multimedia from './multimedia.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\ntoggleFocus: (messageKey: string) => void,\n+ chatInputState: ChatInputState,\n|};\nclass MultimediaMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\ntoggleFocus: PropTypes.func.isRequired,\n+ chatInputState: chatInputStatePropType.isRequired,\n};\nconstructor(props: Props) {\n@@ -45,9 +52,25 @@ class MultimediaMessage extends React.PureComponent<Props> {\nthis.props.item.messageInfo.type === messageTypes.MULTIMEDIA,\n\"MultimediaMessage should only be used for messageTypes.MULTIMEDIA\",\n);\n+ const { localID, media } = this.props.item.messageInfo;\n+ const pendingUploads = localID\n+ ? this.props.chatInputState.assignedUploads[localID]\n+ : [];\n+ const multimedia = media.map(singleMedia => {\n+ const pendingUpload = pendingUploads.find(\n+ upload => upload.localID === singleMedia.id,\n+ );\n+ return (\n+ <Multimedia\n+ uri={singleMedia.uri}\n+ pendingUpload={pendingUpload}\n+ key={singleMedia.id}\n+ />\n+ );\n+ });\nreturn (\n<div className={css.robotext} onClick={this.onClick}>\n- Blah blah image\n+ <div className={css.previews}>{multimedia}</div>\n</div>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Render Multimedia from within MultimediaMessage
Also passes down `ChatInputState` to `MultimediaMessage`. |
129,187 | 23.01.2019 16:16:25 | 28,800 | 7f03029db9c4b970da98772358a86cf1df913bbc | [lib] Add support for messageTypes.MULTIMEDIA to message-utils | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/message-utils.js",
"new_path": "lib/shared/message-utils.js",
"diff": "@@ -6,6 +6,7 @@ import {\ntype RobotextMessageInfo,\ntype PreviewableMessageInfo,\ntype TextMessageInfo,\n+ type MultimediaMessageInfo,\ntype MessageData,\ntype MessageType,\ntype MessageTruncationStatus,\n@@ -26,7 +27,7 @@ import { contentStringForMediaArray } from './media-utils';\n// Prefers localID\nfunction messageKey(messageInfo: MessageInfo | RawMessageInfo): string {\n- if (messageInfo.type === 0 && messageInfo.localID) {\n+ if (messageInfo.localID) {\nreturn messageInfo.localID;\n}\ninvariant(messageInfo.id, \"localID should exist if ID does not\");\n@@ -38,7 +39,6 @@ function messageID(messageInfo: MessageInfo | RawMessageInfo): string {\nif (messageInfo.id) {\nreturn messageInfo.id;\n}\n- invariant(messageInfo.type === 0, \"only MessageType.TEXT can have localID\");\ninvariant(messageInfo.localID, \"localID should exist if ID does not\");\nreturn messageInfo.localID;\n}\n@@ -76,8 +76,9 @@ function robotextForMessageInfo(\nthreadInfo: ThreadInfo,\n): string {\ninvariant(\n- messageInfo.type !== messageTypes.TEXT,\n- \"robotext is no substitute for human text!\",\n+ messageInfo.type !== messageTypes.TEXT &&\n+ messageInfo.type !== messageTypes.MULTIMEDIA,\n+ `robotext is not supported for ${messageInfo.type}!`,\n);\nconst creator = robotextForUser(messageInfo.creator);\nif (messageInfo.type === messageTypes.CREATE_THREAD) {\n@@ -414,6 +415,25 @@ function createMessageInfo(\nrobotext: rawMessageInfo.robotext,\nunsupportedMessageInfo: rawMessageInfo.unsupportedMessageInfo,\n};\n+ } else if (rawMessageInfo.type === messageTypes.MULTIMEDIA) {\n+ const messageInfo: MultimediaMessageInfo = {\n+ type: messageTypes.MULTIMEDIA,\n+ threadID: rawMessageInfo.threadID,\n+ creator: {\n+ id: rawMessageInfo.creatorID,\n+ username: creatorInfo.username,\n+ isViewer: rawMessageInfo.creatorID === viewerID,\n+ },\n+ time: rawMessageInfo.time,\n+ media: rawMessageInfo.media,\n+ };\n+ if (rawMessageInfo.id) {\n+ messageInfo.id = rawMessageInfo.id;\n+ }\n+ if (rawMessageInfo.localID) {\n+ messageInfo.localID = rawMessageInfo.localID;\n+ }\n+ return messageInfo;\n}\ninvariant(false, `we're not aware of messageType ${rawMessageInfo.type}`);\n}\n@@ -502,6 +522,8 @@ function rawMessageInfoFromMessageData(\ndate: messageData.date,\ntext: messageData.text,\n};\n+ } else if (messageData.type === messageTypes.MULTIMEDIA) {\n+ return { ...messageData, id };\n} else {\ninvariant(false, `we're not aware of messageType ${messageData.type}`);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Add support for messageTypes.MULTIMEDIA to message-utils |
129,187 | 23.01.2019 16:31:46 | 28,800 | cfffd46ce37ecf2e40aaf4c330fe48a2ab8c4cbb | [web] Don't allow expansion of already-expanded messages | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -102,14 +102,15 @@ div.robotext {\ncolor: #333333;\npadding: 6px 0;\nmargin: 0 24px 5px 24px;\n- font-Size: 15px;\n+ font-size: 15px;\n+}\n+div.expandableMessage {\ncursor: pointer;\n}\ndiv.textMessage {\npadding: 6px 12px;\nmargin: 0 4px 0 12px;\n- cursor: pointer;\n}\ndiv.normalTextMessage {\nfont-size: 16px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -13,6 +13,7 @@ import {\nimport * as React from 'react';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\n+import classNames from 'classnames';\nimport { messageKey } from 'lib/shared/message-utils';\n@@ -68,11 +69,22 @@ class MultimediaMessage extends React.PureComponent<Props> {\n/>\n);\n});\n+ if (this.props.item.startsConversation) {\nreturn (\n- <div className={css.robotext} onClick={this.onClick}>\n+ <div className={css.robotext}>\n<div className={css.previews}>{multimedia}</div>\n</div>\n);\n+ } else {\n+ return (\n+ <div\n+ className={classNames(css.robotext, css.expandableMessage)}\n+ onClick={this.onClick}\n+ >\n+ <div className={css.previews}>{multimedia}</div>\n+ </div>\n+ );\n+ }\n}\nonClick = (event: SyntheticEvent<HTMLAnchorElement>) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -18,6 +18,7 @@ import * as React from 'react';\nimport invariant from 'invariant';\nimport Linkify from 'react-linkify';\nimport PropTypes from 'prop-types';\n+import classNames from 'classnames';\nimport {\nmessageKey,\n@@ -56,11 +57,22 @@ class RobotextMessage extends React.PureComponent<Props> {\n}\nrender() {\n+ if (this.props.item.startsConversation) {\nreturn (\n- <div className={css.robotext} onClick={this.onClick}>\n+ <div className={css.robotext}>\n{this.linkedRobotext()}\n</div>\n);\n+ } else {\n+ return (\n+ <div\n+ className={classNames(css.robotext, css.expandableMessage)}\n+ onClick={this.onClick}\n+ >\n+ {this.linkedRobotext()}\n+ </div>\n+ );\n+ }\n}\nlinkedRobotext() {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/text-message.react.js",
"new_path": "web/chat/text-message.react.js",
"diff": "@@ -64,6 +64,7 @@ class TextMessage extends React.PureComponent<Props> {\nconst onlyEmoji = onlyEmojiRegex.test(text);\nconst messageClassName = classNames({\n[css.textMessage]: true,\n+ [css.expandableMessage]: !this.props.item.startsConversation,\n[css.normalTextMessage]: !onlyEmoji,\n[css.emojiOnlyTextMessage]: onlyEmoji,\n});\n@@ -133,19 +134,31 @@ class TextMessage extends React.PureComponent<Props> {\n);\n}\n- return (\n- <React.Fragment>\n- {failedSendInfo}\n- <div className={contentClassName}>\n+ const linkifiedText = <Linkify>{text}</Linkify>;\n+ let message;\n+ if (this.props.item.startsConversation) {\n+ message = (\n+ <div className={messageClassName} style={messageStyle}>\n+ {linkifiedText}\n+ </div>\n+ );\n+ } else {\n+ message = (\n<div\nonClick={this.onClick}\nclassName={messageClassName}\nstyle={messageStyle}\n>\n- <Linkify>\n- {text}\n- </Linkify>\n+ {linkifiedText}\n</div>\n+ );\n+ }\n+\n+ return (\n+ <React.Fragment>\n+ {failedSendInfo}\n+ <div className={contentClassName}>\n+ {message}\n{deliveryIcon}\n</div>\n{authorName}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Don't allow expansion of already-expanded messages |
129,187 | 29.01.2019 17:48:58 | 18,000 | 1f3f8fc2ea4121b9a24b68c706aaef7eef6b1c0e | Move flow-mono-cli to native | [
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"babel-plugin-transform-remove-console\": \"^6.8.5\",\n\"babel-plugin-transform-remove-strict-mode\": \"0.0.2\",\n\"flow-bin\": \"^0.78.0\",\n+ \"flow-mono-cli\": \"^1.4.3\",\n\"get-yarn-workspaces\": \"^1.0.2\",\n\"jest\": \"^23.6.0\",\n\"metro-react-native-babel-preset\": \"^0.45.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"native\",\n\"server\"\n],\n- \"devDependencies\": {\n- \"flow-mono-cli\": \"^1.4.2\"\n- },\n\"scripts\": {\n\"clean\": \"rm -rf node_modules/ && rm -rf lib/node_modules/ && rm -rf web/node_modules/ && rm -rf native/node_modules/ && rm -rf server/node_modules/ && rm -rf web/dist/ && rm -rf server/dist/\",\n\"cleaninstall\": \"npm run clean && yarn\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Move flow-mono-cli to native |
129,187 | 29.01.2019 18:34:05 | 18,000 | 719c1d60b5950ec676869b1df23494c7bdc59c69 | [native] react-native-gesture-handler@^1.0.15 | [
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"react-native-exit-app\": \"^1.0.0\",\n\"react-native-fcm\": \"git+https://git@github.com/ashoat/react-native-fcm.git\",\n\"react-native-floating-action\": \"^1.9.0\",\n- \"react-native-gesture-handler\": \"^1.0.10\",\n+ \"react-native-gesture-handler\": \"^1.0.15\",\n\"react-native-hyperlink\": \"git+https://git@github.com/ashoat/react-native-hyperlink.git#both\",\n\"react-native-in-app-notification\": \"^2.1.0\",\n\"react-native-keychain\": \"^3.0.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -10378,10 +10378,10 @@ react-native-gesture-handler@^1.0.0:\ninvariant \"^2.2.2\"\nprop-types \"^15.5.10\"\n-react-native-gesture-handler@^1.0.10:\n- version \"1.0.10\"\n- resolved \"https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.0.10.tgz#160e55e4886471931b7f7d52e22d94007540ab83\"\n- integrity sha512-GNVZ+rbwfi147qOxIvWyfHcTswr+CRT/bSy/Gr5Dz17/tWmomf9D6tGr1yJhyW8IhEZ307KLBWRCXLBM9Q2YQg==\n+react-native-gesture-handler@^1.0.15:\n+ version \"1.0.15\"\n+ resolved \"https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.0.15.tgz#7e0d0a457820a3c9325a3d492daaed14400508a6\"\n+ integrity sha512-BePn+YOKcspHb1xPkUdJs+H6jiaECrT2c98txADBYWHwuUeundE+uUJG0r3FQLFvM2MoGeiJeD96sePzk+WSvQ==\ndependencies:\nhoist-non-react-statics \"^2.3.1\"\ninvariant \"^2.2.2\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] react-native-gesture-handler@^1.0.15 |
129,187 | 29.01.2019 18:42:18 | 18,000 | eca007a32532cf94177e93794353c9dddbd3e61a | [native] Remove CenterCropDrawable from android
I don't think I ever used this? | [
{
"change_type": "DELETE",
"old_path": "native/android/app/src/main/java/org/squadcal/CenterCropDrawable.java",
"new_path": null,
"diff": "-package org.squadcal;\n-\n-import android.graphics.Canvas;\n-import android.graphics.ColorFilter;\n-import android.graphics.Matrix;\n-import android.graphics.Rect;\n-import android.graphics.RectF;\n-import android.graphics.drawable.Drawable;\n-import android.support.annotation.IntRange;\n-import android.support.annotation.NonNull;\n-import android.support.annotation.Nullable;\n-\n-/**\n- * Drawable decorator which draws the target drawable similarly to an ImageView with scaleType=centerCrop\n- *\n- * Example usage:\n- * final Drawable bg = getResources().getDrawable(R.drawable.screen);\n- * getWindow().setBackgroundDrawable(new CenterCropDrawable(bg));\n- */\n-public class CenterCropDrawable extends Drawable {\n-\n- @NonNull\n- private final Drawable target;\n-\n- public CenterCropDrawable(@NonNull Drawable target) {\n- this.target = target;\n- }\n-\n- @Override\n- public void setBounds(@NonNull Rect bounds) {\n- super.setBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);\n- }\n-\n- @Override\n- public void setBounds(int left, int top, int right, int bottom) {\n- final RectF sourceRect = new RectF(0, 0, target.getIntrinsicWidth(), target.getIntrinsicHeight());\n- final RectF screenRect = new RectF(left, top, right, bottom);\n-\n- final Matrix matrix = new Matrix();\n- matrix.setRectToRect(screenRect, sourceRect, Matrix.ScaleToFit.CENTER);\n-\n- final Matrix inverse = new Matrix();\n- matrix.invert(inverse);\n- inverse.mapRect(sourceRect);\n-\n- target.setBounds(Math.round(sourceRect.left), Math.round(sourceRect.top),\n- Math.round(sourceRect.right), Math.round(sourceRect.bottom));\n-\n- super.setBounds(left, top, right, bottom);\n- }\n-\n- @Override\n- public void draw(@NonNull Canvas canvas) {\n- canvas.save(Canvas.CLIP_SAVE_FLAG);\n- canvas.clipRect(getBounds());\n- target.draw(canvas);\n- canvas.restore();\n- }\n-\n- @Override\n- public void setAlpha(@IntRange(from = 0, to = 255) int alpha) {\n- target.setAlpha(alpha);\n- }\n-\n- @Override\n- public void setColorFilter(@Nullable ColorFilter colorFilter) {\n- target.setColorFilter(colorFilter);\n- }\n-\n- @Override\n- public int getOpacity() {\n- return target.getOpacity();\n- }\n-}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Remove CenterCropDrawable from android
I don't think I ever used this? |
129,187 | 30.01.2019 11:09:37 | 18,000 | 8eba2f2f341c5b98a4da1b97621249149aca957c | [native] Fix Flow types for | [
{
"change_type": "MODIFY",
"old_path": "native/components/thread-list.react.js",
"new_path": "native/components/thread-list.react.js",
"diff": "@@ -70,7 +70,7 @@ class ThreadList extends React.PureComponent<Props, State> {\n}\n}\n- static listData(props: Props, state: State) {\n+ static listData(props: Props, state: State): $ReadOnlyArray<ThreadInfo> {\nif (!state.searchText) {\nreturn props.threadInfos;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/account-selectors.js",
"new_path": "native/selectors/account-selectors.js",
"diff": "@@ -9,7 +9,7 @@ import { logInExtraInfoSelector } from 'lib/selectors/account-selectors';\nimport { calendarActiveSelector } from './nav-selectors';\n-const nativeLogInExtraInfoSelector = createSelector(\n+const nativeLogInExtraInfoSelector = createSelector<*, *, *, *, *>(\nlogInExtraInfoSelector,\ncalendarActiveSelector,\n(\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/calendar-selectors.js",
"new_path": "native/selectors/calendar-selectors.js",
"diff": "@@ -32,7 +32,7 @@ export type CalendarItem =\nentryInfo: EntryInfo,\n|};\n-const calendarListData = createSelector(\n+const calendarListData = createSelector<*, *, *, *, *>(\n(state: AppState) => !!(state.currentUserInfo &&\n!state.currentUserInfo.anonymous && true),\ncurrentDaysToEntries,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/message-selectors.js",
"new_path": "native/selectors/message-selectors.js",
"diff": "@@ -9,7 +9,7 @@ import { activeThreadSelector } from './nav-selectors';\nconst msInHour = 60 * 60 * 1000;\n-const nextMessagePruneTimeSelector = createSelector(\n+const nextMessagePruneTimeSelector = createSelector<*, *, *, *>(\n(state: AppState) => state.messageStore.threads,\n(threadMessageInfos: {[id: string]: ThreadMessageInfo}): ?number => {\nconst now = Date.now();\n@@ -28,7 +28,7 @@ const nextMessagePruneTimeSelector = createSelector(\n},\n);\n-const pruneThreadIDsSelector = createSelector(\n+const pruneThreadIDsSelector = createSelector<*, *, *, *, *>(\n(state: AppState) => state.messageStore.threads,\nactiveThreadSelector,\n(\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/nav-selectors.js",
"new_path": "native/selectors/nav-selectors.js",
"diff": "@@ -28,27 +28,30 @@ import {\ngetThreadIDFromParams,\n} from '../utils/navigation-utils';\n-const baseCreateIsForegroundSelector = (routeName: string) => createSelector(\n+const baseCreateIsForegroundSelector =\n+ (routeName: string) => createSelector<*, *, *, *>(\n(state: AppState) => state.navInfo.navigationState,\n(navigationState: NavigationState) =>\nnavigationState.routes[navigationState.index].routeName === routeName,\n);\n-const createIsForegroundSelector = _memoize(baseCreateIsForegroundSelector);\n+const createIsForegroundSelector =\n+ _memoize<*, *>(baseCreateIsForegroundSelector);\n-const appLoggedInSelector = createSelector(\n+const appLoggedInSelector = createSelector<*, *, *, *>(\n(state: AppState) => state.navInfo.navigationState,\n(navigationState: NavigationState) => !accountModals.includes(\nnavigationState.routes[navigationState.index].routeName,\n),\n);\n-const foregroundKeySelector = createSelector(\n+const foregroundKeySelector = createSelector<*, *, *, *>(\n(state: AppState) => state.navInfo.navigationState,\n(navigationState: NavigationState) =>\nnavigationState.routes[navigationState.index].key,\n);\n-const baseCreateActiveTabSelector = (routeName: string) => createSelector(\n+const baseCreateActiveTabSelector =\n+ (routeName: string) => createSelector<*, *, *, *>(\n(state: AppState) => state.navInfo.navigationState,\n(navigationState: NavigationState) => {\nconst currentRoute = navigationState.routes[navigationState.index];\n@@ -59,9 +62,9 @@ const baseCreateActiveTabSelector = (routeName: string) => createSelector(\nreturn appRoute.routes[appRoute.index].routeName === routeName;\n},\n);\n-const createActiveTabSelector = _memoize(baseCreateActiveTabSelector);\n+const createActiveTabSelector = _memoize<*, *>(baseCreateActiveTabSelector);\n-const activeThreadSelector = createSelector(\n+const activeThreadSelector = createSelector<*, *, *, *>(\n(state: AppState) => state.navInfo.navigationState,\n(navigationState: NavigationState): ?string => {\nconst currentRoute = navigationState.routes[navigationState.index];\n@@ -85,7 +88,7 @@ const activeThreadSelector = createSelector(\n},\n);\n-const appCanRespondToBackButtonSelector = createSelector(\n+const appCanRespondToBackButtonSelector = createSelector<*, *, *, *>(\n(state: AppState) => state.navInfo.navigationState,\n(navigationState: NavigationState): bool => {\nconst currentRoute = navigationState.routes[navigationState.index];\n@@ -103,14 +106,14 @@ const appCanRespondToBackButtonSelector = createSelector(\nconst calendarTabActiveSelector = createActiveTabSelector(CalendarRouteName);\nconst threadPickerActiveSelector =\ncreateIsForegroundSelector(ThreadPickerModalRouteName);\n-const calendarActiveSelector = createSelector(\n+const calendarActiveSelector = createSelector<*, *, *, *, *>(\ncalendarTabActiveSelector,\nthreadPickerActiveSelector,\n(calendarTabActive: bool, threadPickerActive: bool) =>\ncalendarTabActive || threadPickerActive,\n);\n-const nativeCalendarQuery = createSelector(\n+const nativeCalendarQuery = createSelector<*, *, *, *, *>(\ncurrentCalendarQuery,\ncalendarActiveSelector,\n(\n@@ -119,7 +122,7 @@ const nativeCalendarQuery = createSelector(\n) => () => calendarQuery(calendarActive),\n);\n-const nonThreadCalendarQuery = createSelector(\n+const nonThreadCalendarQuery = createSelector<*, *, *, *, *>(\nnativeCalendarQuery,\nnonThreadCalendarFiltersSelector,\n(\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/socket-selectors.js",
"new_path": "native/selectors/socket-selectors.js",
"diff": "@@ -17,7 +17,7 @@ import {\nimport { calendarActiveSelector } from './nav-selectors';\n-const openSocketSelector = createSelector(\n+const openSocketSelector = createSelector<*, *, *, *, *>(\n(state: AppState) => state.urlPrefix,\n// We don't actually use the cookie in the socket open function, but we do use\n// it in the initial message, and when the cookie changes the socket needs to\n@@ -28,12 +28,12 @@ const openSocketSelector = createSelector(\ncreateOpenSocketFunction,\n);\n-const sessionIdentificationSelector = createSelector(\n+const sessionIdentificationSelector = createSelector<*, *, *, *>(\n(state: AppState) => state.cookie,\n(cookie: ?string): SessionIdentification => ({ cookie }),\n);\n-const nativeGetClientResponsesSelector = createSelector(\n+const nativeGetClientResponsesSelector = createSelector<*, *, *, *, *>(\ngetClientResponsesSelector,\ncalendarActiveSelector,\n(\n@@ -46,7 +46,7 @@ const nativeGetClientResponsesSelector = createSelector(\ngetClientResponsesFunc(calendarActive, serverRequests),\n);\n-const nativeSessionStateFuncSelector = createSelector(\n+const nativeSessionStateFuncSelector = createSelector<*, *, *, *, *>(\nsessionStateFuncSelector,\ncalendarActiveSelector,\n(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix Flow types for flow-bin@0.86.0 |
129,187 | 30.01.2019 11:13:38 | 18,000 | aac7b34483d0772a144a243050620a347dd2997f | Fix type of createStore result | [
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -28,7 +28,11 @@ import {\nimport React from 'react';\nimport invariant from 'invariant';\nimport thunk from 'redux-thunk';\n-import { createStore as defaultCreateStore, applyMiddleware } from 'redux';\n+import {\n+ createStore as defaultCreateStore,\n+ applyMiddleware,\n+ type Store,\n+} from 'redux';\nimport { composeWithDevTools } from 'redux-devtools-extension';\nimport { persistStore, persistReducer, REHYDRATE } from 'redux-persist';\nimport PropTypes from 'prop-types';\n@@ -391,7 +395,7 @@ const reactNavigationMiddleware = createReactNavigationReduxMiddleware(\n\"root\",\n(state: AppState) => state.navInfo.navigationState,\n);\n-const store = createStore(\n+const store: Store<AppState, *> = createStore(\npersistReducer(persistConfig, reducer),\ndefaultState,\ncomposeWithDevTools(\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "import type { $Response, $Request } from 'express';\nimport type { AppState, Action } from 'web/redux-setup';\n-import type { Store } from 'redux';\nimport { defaultCalendarFilters } from 'lib/types/filter-types';\nimport { threadPermissions } from 'lib/types/thread-types';\nimport { defaultConnectionInfo } from 'lib/types/socket-types';\nimport html from 'common-tags/lib/html';\n-import { createStore } from 'redux';\n+import { createStore, type Store } from 'redux';\nimport ReactDOMServer from 'react-dom/server';\nimport ReactHotLoader from 'react-hot-loader';\nimport ReactRedux from 'react-redux';\n"
},
{
"change_type": "MODIFY",
"old_path": "web/root.js",
"new_path": "web/root.js",
"diff": "// @flow\n-import type { Store } from 'redux';\nimport type { AppState, Action } from './redux-setup';\nimport React from 'react';\nimport { Provider } from 'react-redux';\n-import { createStore, applyMiddleware } from 'redux';\n+import { createStore, applyMiddleware, type Store } from 'redux';\nimport { Router, Route } from 'react-router';\nimport { hot } from 'react-hot-loader/root';\nimport thunk from 'redux-thunk';\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Fix type of createStore result |
129,187 | 30.01.2019 11:52:59 | 18,000 | 0b9de771d52da6ede114683e663338617eefba5b | [web] Temporarily fix react-router/history libdefs
Upstream PR: | [
{
"change_type": "MODIFY",
"old_path": "web/flow-typed/npm/history_v4.x.x.js",
"new_path": "web/flow-typed/npm/history_v4.x.x.js",
"diff": "@@ -27,8 +27,8 @@ declare module \"history/createBrowserHistory\" {\ngoBack(): void,\ngoForward(): void,\nlisten: Function,\n- block(message: string): typeof Unblock,\n- block((location: BrowserLocation, action: Action) => string): typeof Unblock,\n+ +block: (message: string) => typeof Unblock,\n+ +block: ((location: BrowserLocation, action: Action) => string | bool) => typeof Unblock,\n}\ndeclare export type BrowserHistory = IBrowserHistory;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/flow-typed/npm/react-router_v4.x.x.js",
"new_path": "web/flow-typed/npm/react-router_v4.x.x.js",
"diff": "@@ -9,8 +9,8 @@ declare module \"react-router\" {\npathname: string,\nsearch: string,\nhash: string,\n- state?: any,\n- key?: string\n+ +state?: any,\n+ +key?: string\n};\ndeclare export type LocationShape = {\n@@ -24,7 +24,7 @@ declare module \"react-router\" {\ndeclare export type RouterHistory = {\nlength: number,\n- location: Location,\n+ +location: Location,\naction: HistoryAction,\nlisten(\ncallback: (location: Location, action: HistoryAction) => void\n@@ -35,9 +35,9 @@ declare module \"react-router\" {\ngoBack(): void,\ngoForward(): void,\ncanGo?: (n: number) => boolean,\n- block(\n+ +block: (\ncallback: (location: Location, action: HistoryAction) => boolean\n- ): void,\n+ ) => () => void,\n// createMemoryHistory\nindex?: number,\nentries?: Array<Location>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Temporarily fix react-router/history libdefs
Upstream PR: https://github.com/flow-typed/flow-typed/pull/3110 |
129,187 | 30.01.2019 12:19:55 | 18,000 | 91b9f588b06be6a5a6fe14895cd70c3a5918ffa4 | [web] Display error message when attempting to upload invalid file type | [
{
"change_type": "MODIFY",
"old_path": "web/app.react.js",
"new_path": "web/app.react.js",
"diff": "@@ -250,7 +250,7 @@ class App extends React.PureComponent<Props, State> {\n);\n} else if (this.props.navInfo.tab === \"chat\") {\nmainContent = (\n- <Chat />\n+ <Chat setModal={this.setModal} />\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -28,10 +28,12 @@ import {\nimport ChatMessageList from './chat-message-list.react';\nimport { validateFile, preloadImage } from '../utils/media-utils';\n+import InvalidUploadModal from '../modals/chat/invalid-upload.react';\nlet nextLocalUploadID = 0;\ntype Props = {|\n+ setModal: (modal: ?React.Node) => void,\n// Redux state\nactiveChatThreadID: ?string,\n// Redux dispatch functions\n@@ -52,6 +54,7 @@ type State = {|\nclass ChatInputStateContainer extends React.PureComponent<Props, State> {\nstatic propTypes = {\n+ setModal: PropTypes.func.isRequired,\nactiveChatThreadID: PropTypes.string,\ndispatchActionPayload: PropTypes.func.isRequired,\nuploadMultimedia: PropTypes.func.isRequired,\n@@ -102,6 +105,8 @@ class ChatInputStateContainer extends React.PureComponent<Props, State> {\nconst validationResult = await Promise.all(files.map(validateFile));\nconst validatedFileInfo = validationResult.filter(Boolean);\nif (validatedFileInfo.length === 0) {\n+ const { setModal } = this.props;\n+ setModal(<InvalidUploadModal setModal={setModal} />);\nreturn;\n}\nconst newUploads = validatedFileInfo.map(({ file, mediaType }) => ({\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat.react.js",
"new_path": "web/chat/chat.react.js",
"diff": "// @flow\nimport * as React from 'react';\n+import PropTypes from 'prop-types';\nimport ChatThreadList from './chat-thread-list.react';\nimport ChatInputStateContainer from './chat-input-state-container.react';\ntype Props = {|\n+ setModal: (modal: ?React.Node) => void,\n|};\nclass Chat extends React.PureComponent<Props> {\n+ static propTypes = {\n+ setModal: PropTypes.func.isRequired,\n+ };\n+\nrender() {\nreturn (\n<React.Fragment>\n<ChatThreadList />\n- <ChatInputStateContainer />\n+ <ChatInputStateContainer setModal={this.props.setModal} />\n</React.Fragment>\n);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/modals/chat/invalid-upload.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+import PropTypes from 'prop-types';\n+\n+import Modal from '../modal.react';\n+import css from '../../style.css';\n+\n+type Props = {|\n+ setModal: (modal: ?React.Node) => void,\n+|};\n+class InvalidUploadModal extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ setModal: PropTypes.func.isRequired,\n+ };\n+\n+ render() {\n+ return (\n+ <Modal name=\"Invalid upload\" onClose={this.clearModal}>\n+ <div className={css['modal-body']}>\n+ <p>\n+ We don't support that file type yet :(\n+ </p>\n+ </div>\n+ </Modal>\n+ );\n+ }\n+\n+ clearModal = () => {\n+ this.props.setModal(null);\n+ }\n+\n+}\n+\n+export default InvalidUploadModal;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Display error message when attempting to upload invalid file type |
129,187 | 30.01.2019 12:51:52 | 18,000 | 30e9964ae244b43671ad494fc2af413a613f2399 | [web] Handle file copy-paste as file upload | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -89,7 +89,8 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nstate = {\nfocusedMessageKey: null,\n};\n- messageContainer: ?HTMLDivElement = null;\n+ container: ?HTMLDivElement;\n+ messageContainer: ?HTMLDivElement;\nloadingFromScroll = false;\ncomponentDidMount() {\n@@ -200,7 +201,7 @@ class ChatMessageList extends React.PureComponent<Props, State> {\n[css.activeContainer]: isActive,\n});\nreturn connectDropTarget(\n- <div className={containerStyle}>\n+ <div className={containerStyle} ref={this.containerRef}>\n<div className={css.messageContainer} ref={this.messageContainerRef}>\n{messages}\n</div>\n@@ -212,6 +213,32 @@ class ChatMessageList extends React.PureComponent<Props, State> {\n);\n}\n+ containerRef = (container: ?HTMLDivElement) => {\n+ if (container) {\n+ container.addEventListener('paste', this.onPaste);\n+ } else if (this.container && this.container !== container) {\n+ this.container.removeEventListener('paste', this.onPaste);\n+ }\n+ this.container = container;\n+ }\n+\n+ onPaste = (e: ClipboardEvent) => {\n+ const { chatInputState } = this.props;\n+ if (!chatInputState) {\n+ return;\n+ }\n+ const { clipboardData } = e;\n+ if (!clipboardData) {\n+ return;\n+ }\n+ const { files } = clipboardData;\n+ if (files.length === 0) {\n+ return;\n+ }\n+ e.preventDefault();\n+ chatInputState.appendFiles([...files]);\n+ }\n+\nmessageContainerRef = (messageContainer: ?HTMLDivElement) => {\nthis.messageContainer = messageContainer;\n// In case we already have all the most recent messages,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Handle file copy-paste as file upload |
129,187 | 31.01.2019 17:56:40 | 18,000 | 938357e46dd1b25a0062d2bc3b3c20525f9fff14 | [web] Detect Message mouseover instead of using toggling for timestamp
UI (via tooltip) coming in next commit. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -104,9 +104,6 @@ div.robotext {\nmargin: 0 24px 5px 24px;\nfont-size: 15px;\n}\n-div.expandableMessage {\n- cursor: pointer;\n-}\ndiv.textMessage {\npadding: 6px 12px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "import type { AppState } from '../redux-setup';\nimport {\ntype ChatMessageItem,\n+ type ChatMessageInfoItem,\nchatMessageItemPropType,\n} from 'lib/selectors/chat-selectors';\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n@@ -40,7 +41,7 @@ import { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport { webMessageListData } from '../selectors/chat-selectors';\nimport ChatInputBar from './chat-input-bar.react';\n-import Message from './message.react';\n+import Message, { type MessagePositionInfo } from './message.react';\nimport LoadingIndicator from '../loading-indicator.react';\nimport css from './chat-message-list.css';\n@@ -66,13 +67,12 @@ type ReactDnDProps = {|\nisActive: bool,\nconnectDropTarget: ConnectDropTarget,\n|};\n-\ntype Props = {|\n...PassedProps,\n...ReactDnDProps,\n|};\ntype State = {|\n- focusedMessageKey: ?string,\n+ messageMouseover: ?MessagePositionInfo,\n|};\nclass ChatMessageList extends React.PureComponent<Props, State> {\n@@ -87,7 +87,7 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nfetchMostRecentMessages: PropTypes.func.isRequired,\n};\nstate = {\n- focusedMessageKey: null,\n+ messageMouseover: null,\n};\ncontainer: ?HTMLDivElement;\nmessageContainer: ?HTMLDivElement;\n@@ -160,26 +160,31 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nconst { threadInfo, chatInputState } = this.props;\ninvariant(chatInputState, \"ChatInputState should be set\");\ninvariant(threadInfo, \"ThreadInfo should be set if messageListData is\");\n- const focused =\n- messageKey(item.messageInfo) === this.state.focusedMessageKey;\nreturn (\n<Message\nitem={item}\nthreadInfo={threadInfo}\n- focused={focused}\n- toggleFocus={this.toggleMessageFocus}\n+ onMouseOver={this.showTimestamp}\nchatInputState={chatInputState}\nkey={ChatMessageList.keyExtractor(item)}\n/>\n);\n}\n- toggleMessageFocus = (key: string) => {\n- if (this.state.focusedMessageKey === key) {\n- this.setState({ focusedMessageKey: null });\n- } else {\n- this.setState({ focusedMessageKey: key });\n+ showTimestamp = (messagePositionInfo: MessagePositionInfo) => {\n+ if (!this.messageContainer) {\n+ return;\n}\n+ const containerTop = this.messageContainer.getBoundingClientRect().top;\n+ const messageMouseover = {\n+ ...messagePositionInfo,\n+ messagePosition: {\n+ ...messagePositionInfo.messagePosition,\n+ top: messagePositionInfo.messagePosition.top - containerTop,\n+ bottom: messagePositionInfo.messagePosition.bottom - containerTop,\n+ },\n+ };\n+ this.setState({ messageMouseover });\n}\nrender() {\n@@ -243,13 +248,23 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nthis.messageContainer = messageContainer;\n// In case we already have all the most recent messages,\n// but they're not enough\n- this.onScroll();\n+ this.possiblyLoadMoreMessages();\nif (messageContainer) {\nmessageContainer.addEventListener(\"scroll\", this.onScroll);\n}\n}\nonScroll = () => {\n+ if (!this.messageContainer) {\n+ return;\n+ }\n+ if (this.state.messageMouseover) {\n+ this.setState({ messageMouseover: null });\n+ }\n+ this.possiblyLoadMoreMessages();\n+ }\n+\n+ possiblyLoadMoreMessages() {\nif (!this.messageContainer) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message.react.js",
"new_path": "web/chat/message.react.js",
"diff": "@@ -21,11 +21,21 @@ import RobotextMessage from './robotext-message.react';\nimport MultimediaMessage from './multimedia-message.react';\nimport css from './chat-message-list.css';\n+export type MessagePositionInfo = {|\n+ item: ChatMessageInfoItem,\n+ messagePosition: {|\n+ top: number,\n+ bottom: number,\n+ left: number,\n+ right: number,\n+ height: number,\n+ width: number,\n+ |},\n+|};\ntype Props = {|\nitem: ChatMessageInfoItem,\nthreadInfo: ThreadInfo,\n- focused: bool,\n- toggleFocus: (messageKey: string) => void,\n+ onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchatInputState: ChatInputState,\n|};\nclass Message extends React.PureComponent<Props> {\n@@ -33,14 +43,13 @@ class Message extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n- focused: PropTypes.bool.isRequired,\n- toggleFocus: PropTypes.func.isRequired,\n+ onMouseOver: PropTypes.func.isRequired,\nchatInputState: chatInputStatePropType.isRequired,\n};\nrender() {\nlet conversationHeader = null;\n- if (this.props.focused || this.props.item.startsConversation) {\n+ if (this.props.item.startsConversation) {\nconversationHeader = (\n<div className={css.conversationHeader}>\n{longAbsoluteDate(this.props.item.messageInfo.time)}\n@@ -53,14 +62,14 @@ class Message extends React.PureComponent<Props> {\n<TextMessage\nitem={this.props.item}\nthreadInfo={this.props.threadInfo}\n- toggleFocus={this.props.toggleFocus}\n+ onMouseOver={this.props.onMouseOver}\n/>\n);\n} else if (this.props.item.messageInfo.type === messageTypes.MULTIMEDIA) {\nmessage = (\n<MultimediaMessage\nitem={this.props.item}\n- toggleFocus={this.props.toggleFocus}\n+ onMouseOver={this.props.onMouseOver}\nchatInputState={this.props.chatInputState}\n/>\n);\n@@ -68,7 +77,7 @@ class Message extends React.PureComponent<Props> {\nmessage = (\n<RobotextMessage\nitem={this.props.item}\n- toggleFocus={this.props.toggleFocus}\n+ onMouseOver={this.props.onMouseOver}\n/>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -9,6 +9,7 @@ import {\nchatInputStatePropType,\ntype ChatInputState,\n} from './chat-input-state';\n+import type { MessagePositionInfo } from './message.react';\nimport * as React from 'react';\nimport invariant from 'invariant';\n@@ -22,14 +23,14 @@ import Multimedia from './multimedia.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\n- toggleFocus: (messageKey: string) => void,\n+ onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchatInputState: ChatInputState,\n|};\nclass MultimediaMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\n- toggleFocus: PropTypes.func.isRequired,\n+ onMouseOver: PropTypes.func.isRequired,\nchatInputState: chatInputStatePropType.isRequired,\n};\n@@ -69,27 +70,11 @@ class MultimediaMessage extends React.PureComponent<Props> {\n/>\n);\n});\n- if (this.props.item.startsConversation) {\nreturn (\n<div className={css.robotext}>\n<div className={css.previews}>{multimedia}</div>\n</div>\n);\n- } else {\n- return (\n- <div\n- className={classNames(css.robotext, css.expandableMessage)}\n- onClick={this.onClick}\n- >\n- <div className={css.previews}>{multimedia}</div>\n- </div>\n- );\n- }\n- }\n-\n- onClick = (event: SyntheticEvent<HTMLAnchorElement>) => {\n- event.stopPropagation();\n- this.props.toggleFocus(messageKey(this.props.item.messageInfo));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -13,6 +13,7 @@ import {\nupdateNavInfoActionType,\n} from '../redux-setup';\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { MessagePositionInfo } from './message.react';\nimport * as React from 'react';\nimport invariant from 'invariant';\n@@ -32,13 +33,13 @@ import css from './chat-message-list.css';\ntype Props = {|\nitem: ChatMessageInfoItem,\n- toggleFocus: (messageKey: string) => void,\n+ onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n|};\nclass RobotextMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\n- toggleFocus: PropTypes.func.isRequired,\n+ onMouseOver: PropTypes.func.isRequired,\n};\nconstructor(props: Props) {\n@@ -57,22 +58,13 @@ class RobotextMessage extends React.PureComponent<Props> {\n}\nrender() {\n- if (this.props.item.startsConversation) {\nreturn (\n<div className={css.robotext}>\n+ <span onMouseOver={this.onMouseOver}>\n{this.linkedRobotext()}\n+ </span>\n</div>\n);\n- } else {\n- return (\n- <div\n- className={classNames(css.robotext, css.expandableMessage)}\n- onClick={this.onClick}\n- >\n- {this.linkedRobotext()}\n- </div>\n- );\n- }\n}\nlinkedRobotext() {\n@@ -111,9 +103,12 @@ class RobotextMessage extends React.PureComponent<Props> {\n);\n}\n- onClick = (event: SyntheticEvent<HTMLAnchorElement>) => {\n- event.stopPropagation();\n- this.props.toggleFocus(messageKey(this.props.item.messageInfo));\n+ onMouseOver = (event: SyntheticEvent<HTMLDivElement>) => {\n+ const { item } = this.props;\n+ const rect = event.currentTarget.getBoundingClientRect();\n+ const { top, bottom, left, right, height, width } = rect;\n+ const messagePosition = { top, bottom, left, right, height, width };\n+ this.props.onMouseOver({ item, messagePosition });\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/text-message.react.js",
"new_path": "web/chat/text-message.react.js",
"diff": "@@ -6,6 +6,7 @@ import {\n} from 'lib/selectors/chat-selectors';\nimport { messageTypes } from 'lib/types/message-types';\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import type { MessagePositionInfo } from './message.react';\nimport * as React from 'react';\nimport invariant from 'invariant';\n@@ -27,14 +28,14 @@ import FailedSend from './failed-send.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\nthreadInfo: ThreadInfo,\n- toggleFocus: (messageKey: string) => void,\n+ onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n|};\nclass TextMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n- toggleFocus: PropTypes.func.isRequired,\n+ onMouseOver: PropTypes.func.isRequired,\n};\nconstructor(props: Props) {\n@@ -64,7 +65,6 @@ class TextMessage extends React.PureComponent<Props> {\nconst onlyEmoji = onlyEmojiRegex.test(text);\nconst messageClassName = classNames({\n[css.textMessage]: true,\n- [css.expandableMessage]: !this.props.item.startsConversation,\n[css.normalTextMessage]: !onlyEmoji,\n[css.emojiOnlyTextMessage]: onlyEmoji,\n});\n@@ -134,31 +134,17 @@ class TextMessage extends React.PureComponent<Props> {\n);\n}\n- const linkifiedText = <Linkify>{text}</Linkify>;\n- let message;\n- if (this.props.item.startsConversation) {\n- message = (\n- <div className={messageClassName} style={messageStyle}>\n- {linkifiedText}\n- </div>\n- );\n- } else {\n- message = (\n+ return (\n+ <React.Fragment>\n+ {failedSendInfo}\n+ <div className={contentClassName}>\n<div\n- onClick={this.onClick}\nclassName={messageClassName}\nstyle={messageStyle}\n+ onMouseOver={this.onMouseOver}\n>\n- {linkifiedText}\n+ <Linkify>{text}</Linkify>\n</div>\n- );\n- }\n-\n- return (\n- <React.Fragment>\n- {failedSendInfo}\n- <div className={contentClassName}>\n- {message}\n{deliveryIcon}\n</div>\n{authorName}\n@@ -166,9 +152,12 @@ class TextMessage extends React.PureComponent<Props> {\n);\n}\n- onClick = (event: SyntheticEvent<HTMLAnchorElement>) => {\n- event.stopPropagation();\n- this.props.toggleFocus(messageKey(this.props.item.messageInfo));\n+ onMouseOver = (event: SyntheticEvent<HTMLDivElement>) => {\n+ const { item } = this.props;\n+ const rect = event.currentTarget.getBoundingClientRect();\n+ const { top, bottom, left, right, height, width } = rect;\n+ const messagePosition = { top, bottom, left, right, height, width };\n+ this.props.onMouseOver({ item, messagePosition });\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Detect Message mouseover instead of using toggling for timestamp
UI (via tooltip) coming in next commit. |
129,187 | 31.01.2019 18:28:44 | 18,000 | c29eb9cf479b48a71a4c57090f277b5a5af0fcb2 | [web] MessageTimestampTooltip
Still need to implement pointy triangle, as well as logic to determine tooltip position and pointy triangle direction. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -105,6 +105,16 @@ div.robotext {\nfont-size: 15px;\n}\n+div.messageTimestampTooltip {\n+ position: absolute;\n+ margin-bottom: 8px;\n+ background-color: black;\n+ color: white;\n+ padding: 5px;\n+ border-radius: 5px;\n+ font-size: 14px;\n+}\n+\ndiv.textMessage {\npadding: 6px 12px;\nmargin: 0 4px 0 12px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -43,6 +43,7 @@ import { webMessageListData } from '../selectors/chat-selectors';\nimport ChatInputBar from './chat-input-bar.react';\nimport Message, { type MessagePositionInfo } from './message.react';\nimport LoadingIndicator from '../loading-indicator.react';\n+import MessageTimestampTooltip from './message-timestamp-tooltip.react';\nimport css from './chat-message-list.css';\ntype PassedProps = {|\n@@ -209,6 +210,9 @@ class ChatMessageList extends React.PureComponent<Props, State> {\n<div className={containerStyle} ref={this.containerRef}>\n<div className={css.messageContainer} ref={this.messageContainerRef}>\n{messages}\n+ <MessageTimestampTooltip\n+ messagePositionInfo={this.state.messageMouseover}\n+ />\n</div>\n<ChatInputBar\nthreadInfo={threadInfo}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/chat/message-timestamp-tooltip.react.js",
"diff": "+// @flow\n+\n+import type { MessagePositionInfo } from './message.react';\n+\n+import * as React from 'react';\n+\n+import { longAbsoluteDate } from 'lib/utils/date-utils';\n+\n+import css from './chat-message-list.css';\n+\n+type Props = {|\n+ messagePositionInfo: ?MessagePositionInfo,\n+|};\n+function MessageTimestampTooltip(props: Props) {\n+ if (!props.messagePositionInfo) {\n+ return null;\n+ }\n+ const { item, messagePosition } = props.messagePositionInfo;\n+ const style = { left: messagePosition.left, top: messagePosition.top };\n+ return (\n+ <div className={css.messageTimestampTooltip} style={style}>\n+ {longAbsoluteDate(item.messageInfo.time)}\n+ </div>\n+ );\n+}\n+\n+export default MessageTimestampTooltip;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] MessageTimestampTooltip
Still need to implement pointy triangle, as well as logic to determine tooltip position and pointy triangle direction. |
129,187 | 01.02.2019 16:32:56 | 18,000 | 0f1d94444327a77deee247388cf28349a9be866c | Uppercase AM/PM | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/date-utils.js",
"new_path": "lib/utils/date-utils.js",
"diff": "@@ -85,7 +85,7 @@ function shortAbsoluteDate(timestamp: number) {\nconst now = Date.now();\nconst msSince = now - timestamp;\nif (msSince < millisecondsInDay) {\n- return dateFormat(timestamp, \"h:MM tt\");\n+ return dateFormat(timestamp, \"h:MM TT\");\n} else if (msSince < millisecondsInWeek) {\nreturn dateFormat(timestamp, \"ddd\");\n} else {\n@@ -98,11 +98,11 @@ function longAbsoluteDate(timestamp: number) {\nconst now = Date.now();\nconst msSince = now - timestamp;\nif (msSince < millisecondsInDay) {\n- return dateFormat(timestamp, \"h:MM tt\");\n+ return dateFormat(timestamp, \"h:MM TT\");\n} else if (msSince < millisecondsInWeek) {\n- return dateFormat(timestamp, \"ddd h:MM tt\");\n+ return dateFormat(timestamp, \"ddd h:MM TT\");\n} else {\n- return dateFormat(timestamp, \"mmmm d, h:MM tt\");\n+ return dateFormat(timestamp, \"mmmm d, h:MM TT\");\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Uppercase AM/PM |
129,187 | 01.02.2019 16:33:26 | 18,000 | 84420be2475fe396bb048fb921a495e72cecdedb | [web] Get rid of some calc CSS
Behaves inconsistently in Firefox and seems to hurt scroll perf.
Also an unrelated removal of an unneeded `removeEventListener`. JS should clean up any event listeners on an element when it gets GC'd. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -225,8 +225,6 @@ class ChatMessageList extends React.PureComponent<Props, State> {\ncontainerRef = (container: ?HTMLDivElement) => {\nif (container) {\ncontainer.addEventListener('paste', this.onPaste);\n- } else if (this.container && this.container !== container) {\n- this.container.removeEventListener('paste', this.onPaste);\n}\nthis.container = container;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -9,6 +9,7 @@ body {\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n+ margin-top: 62px;\n}\na {\ntext-decoration: none;\n@@ -107,8 +108,7 @@ div.chatBadge {\n}\ndiv.main-content-container {\n- margin-top: 62px;\n- height: calc(100% - 62px);\n+ height: 100%;\nposition: relative;\n}\ndiv.main-content {\n@@ -1133,11 +1133,11 @@ div.splash-bottom-container {\nflex-grow: 1;\n}\ndiv.splash-bottom {\n- margin-top: 790px;\n+ margin-top: 728px;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n- min-height: calc(100% - 61px);\n+ min-height: 100%;\ndisplay: flex;\nflex-direction: column;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Get rid of some calc CSS
Behaves inconsistently in Firefox and seems to hurt scroll perf.
Also an unrelated removal of an unneeded `removeEventListener`. JS should clean up any event listeners on an element when it gets GC'd. |
129,187 | 02.02.2019 19:21:21 | 18,000 | ed886f7f62a00b8796f9a95e5d572353d40e44c4 | [web] Fix scroll behavior on message insert for Firefox | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -21,7 +21,7 @@ div.messageContainer > div {\ntransform: translateZ(0);\n}\n-div.firefoxMessageContainer {\n+div.invertedMessageContainer {\nflex-grow: 1;\nflex: 1;\noverflow-y: auto;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -48,6 +48,7 @@ import MessageTimestampTooltip from './message-timestamp-tooltip.react';\nimport css from './chat-message-list.css';\nconst browser = detectBrowser();\n+const usingFlexDirectionColumnReverse = !browser || browser.name !== \"firefox\";\ntype PassedProps = {|\nactiveChatThreadID: ?string,\n@@ -117,27 +118,89 @@ class ChatMessageList extends React.PureComponent<Props, State> {\nthreadWatcher.removeID(threadInfo.id);\n}\n- componentDidUpdate(prevProps: Props) {\n- if (this.props.activeChatThreadID !== prevProps.activeChatThreadID) {\n- this.scrollToBottom();\n+ getSnapshotBeforeUpdate(prevProps: Props): ?number {\n+ if (usingFlexDirectionColumnReverse) {\n+ return null;\n}\n+\n+ const { messageListData } = this.props;\n+ const prevMessageListData = prevProps.messageListData;\n+ const { messageContainer } = this;\n+ if (\n+ !messageListData ||\n+ !prevMessageListData ||\n+ !messageContainer ||\n+ messageListData.length <= prevMessageListData.length\n+ ) {\n+ return null;\n+ }\n+\n+ // We only get here if new messages are being added. If they are being\n+ // appended, ie. the user scrolled up to load older messages, we should\n+ // always increase scroll position to compensate for the new height. On the\n+ // other hand, if they are being prepended because they are new messages,\n+ // we should only increase the scroll position if we were already scrolled\n+ // to the newest message.\n+ if (\n+ prevMessageListData.length > 0 &&\n+ ChatMessageList.keyExtractor(messageListData[0]) !==\n+ ChatMessageList.keyExtractor(prevMessageListData[0]) &&\n+ messageContainer.scrollTop !==\n+ (messageContainer.scrollHeight - messageContainer.offsetHeight)\n+ ) {\n+ return null;\n+ }\n+\n+ return messageContainer.scrollHeight;\n+ }\n+\n+ componentDidUpdate(prevProps: Props, prevState: State, snapshot: ?number) {\n+ const { messageListData } = this.props;\n+ const prevMessageListData = prevProps.messageListData;\n+\nif (\nthis.loadingFromScroll &&\n- this.props.messageListData &&\n+ messageListData &&\n(\n- !prevProps.messageListData ||\n- this.props.messageListData.length > prevProps.messageListData.length ||\n+ !prevMessageListData ||\n+ messageListData.length > prevMessageListData.length ||\nthis.props.startReached\n)\n) {\nthis.loadingFromScroll = false;\n}\n+\n+ const { messageContainer } = this;\nif (\n- this.messageContainer &&\n+ messageContainer &&\nprevProps.messageListData !== this.props.messageListData\n) {\nthis.onScroll();\n}\n+\n+ if (\n+ this.props.activeChatThreadID !== prevProps.activeChatThreadID ||\n+ (\n+ // This conditional evaluates to true when this client is the case of\n+ // a new message being prepended to the messageListData\n+ messageListData &&\n+ messageListData.length > 0 &&\n+ (!prevMessageListData ||\n+ prevMessageListData.length === 0 ||\n+ ChatMessageList.keyExtractor(prevMessageListData[0]) !==\n+ ChatMessageList.keyExtractor(messageListData[0])) &&\n+ messageListData[0].itemType === \"message\" &&\n+ messageListData[0].messageInfo.localID\n+ )\n+ ) {\n+ this.scrollToBottom();\n+ } else if (\n+ snapshot !== null &&\n+ snapshot !== undefined &&\n+ messageContainer\n+ ) {\n+ messageContainer.scrollTop += messageContainer.scrollHeight - snapshot;\n+ }\n}\nscrollToBottom() {\n@@ -217,9 +280,9 @@ class ChatMessageList extends React.PureComponent<Props, State> {\n);\nlet content;\n- if (browser && browser.name === \"firefox\") {\n+ if (!usingFlexDirectionColumnReverse) {\ncontent = (\n- <div className={css.firefoxMessageContainer} ref={this.messageContainerRef}>\n+ <div className={css.invertedMessageContainer} ref={this.messageContainerRef}>\n{[...messages].reverse()}\n{tooltip}\n</div>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix scroll behavior on message insert for Firefox |
129,187 | 02.02.2019 21:28:08 | 18,000 | 6ba8bbffaeaa69abdd09104afe295f7fe32ad98b | [web] Add an arrow to MessageTimestampTooltip | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -128,6 +128,34 @@ div.messageTimestampTooltip {\nborder-radius: 5px;\nfont-size: 14px;\n}\n+div.messageTimestampTooltip:after {\n+ content: \"\";\n+ position: absolute;\n+ width: 0;\n+ height: 0;\n+ border-width: 7px;\n+ border-style: solid;\n+}\n+div.messageTimestampLeftTooltip:after {\n+ top: 7px;\n+ right: -14px;\n+ border-color: transparent transparent transparent black;\n+}\n+div.messageTimestampRightTooltip:after {\n+ top: 7px;\n+ left: -14px;\n+ border-color: transparent black transparent transparent;\n+}\n+div.messageTimestampTopLeftTooltip:after {\n+ bottom: -14px;\n+ left: 4px;\n+ border-color: black transparent transparent transparent;\n+}\n+div.messageTimestampTopRightTooltip:after {\n+ bottom: -14px;\n+ right: 4px;\n+ border-color: black transparent transparent transparent;\n+}\ndiv.textMessage {\npadding: 6px 12px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message-timestamp-tooltip.react.js",
"new_path": "web/chat/message-timestamp-tooltip.react.js",
"diff": "// @flow\nimport type { MessagePositionInfo } from './message.react';\n+import { isComposableMessageType } from 'lib/types/message-types';\nimport * as React from 'react';\n+import invariant from 'invariant';\n+import classNames from 'classnames';\nimport { longAbsoluteDate } from 'lib/utils/date-utils';\n+import { calculateTextWidth } from '../utils/text-utils';\nimport css from './chat-message-list.css';\ntype Props = {|\n@@ -16,9 +20,64 @@ function MessageTimestampTooltip(props: Props) {\nreturn null;\n}\nconst { item, messagePosition } = props.messagePositionInfo;\n- const style = { left: messagePosition.left, top: messagePosition.top };\n+ const text = longAbsoluteDate(item.messageInfo.time);\n+\n+ const font =\n+ '14px -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", ' +\n+ '\"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", ' +\n+ '\"Helvetica Neue\", sans-serif';\n+ const textWidth = calculateTextWidth(text, font);\n+ const width = textWidth + 10; // 10px padding\n+ const widthWithArrow = width + 10; // 7px arrow + 3px extra\n+ const height = 27; // 17px line-height + 10px padding\n+ const heightWithArrow = height + 10; // 7px arrow + 3px extra\n+\n+ const { isViewer } = item.messageInfo.creator;\n+ const isComposed = isComposableMessageType(item.messageInfo.type);\n+ let align = isComposed && isViewer ? \"right\" : \"left\";\n+ if (align === \"right\" && messagePosition.right + width > window.innerWidth) {\n+ align = \"top-right\";\n+ } else if (align === \"left\" && messagePosition.left - width < 0) {\n+ align = \"top-left\";\n+ }\n+\n+ let style, className;\n+ if (align === \"left\") {\n+ const centerOfMessage = messagePosition.top + messagePosition.height / 2;\n+ const topOfTooltip = centerOfMessage - height / 2;\n+ style = {\n+ left: messagePosition.left - widthWithArrow,\n+ top: topOfTooltip,\n+ };\n+ className = css.messageTimestampLeftTooltip;\n+ } else if (align === \"right\") {\n+ const centerOfMessage = messagePosition.top + messagePosition.height / 2;\n+ const topOfTooltip = centerOfMessage - height / 2;\n+ style = {\n+ right: messagePosition.right + widthWithArrow,\n+ top: topOfTooltip,\n+ };\n+ className = css.messageTimestampRightTooltip;\n+ } else if (align === \"top-left\") {\n+ style = {\n+ left: messagePosition.left,\n+ top: messagePosition.top - heightWithArrow,\n+ };\n+ className = css.messageTimestampTopLeftTooltip;\n+ } else if (align === \"top-right\") {\n+ style = {\n+ left: messagePosition.right - width,\n+ top: messagePosition.top - heightWithArrow,\n+ };\n+ className = css.messageTimestampTopRightTooltip;\n+ }\n+ invariant(style, \"should be set\");\n+\nreturn (\n- <div className={css.messageTimestampTooltip} style={style}>\n+ <div\n+ className={classNames(css.messageTimestampTooltip, className)}\n+ style={style}\n+ >\n{longAbsoluteDate(item.messageInfo.time)}\n</div>\n);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/utils/text-utils.js",
"diff": "+// @flow\n+\n+let canvas;\n+\n+function calculateTextWidth(text: string, font: string): number {\n+ if (!canvas) {\n+ canvas = document.createElement(\"canvas\");\n+ }\n+ const context = canvas.getContext(\"2d\");\n+ context.font = font;\n+ const { width } = context.measureText(text);\n+ return width;\n+}\n+\n+export {\n+ calculateTextWidth,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Add an arrow to MessageTimestampTooltip |
129,187 | 03.02.2019 14:02:49 | 18,000 | c62f45a1ac01f4a57e819a131c5f6b3dce6b9cc7 | [web] Clear MessageTimestampTooltip on Message onMouseOut | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -42,7 +42,10 @@ import { registerFetchKey } from 'lib/reducers/loading-reducer';\nimport { webMessageListData } from '../selectors/chat-selectors';\nimport ChatInputBar from './chat-input-bar.react';\n-import Message, { type MessagePositionInfo } from './message.react';\n+import Message, {\n+ type MessagePositionInfo,\n+ type OnMessagePositionInfo,\n+} from './message.react';\nimport LoadingIndicator from '../loading-indicator.react';\nimport MessageTimestampTooltip from './message-timestamp-tooltip.react';\nimport css from './chat-message-list.css';\n@@ -77,7 +80,7 @@ type Props = {|\n...ReactDnDProps,\n|};\ntype State = {|\n- messageMouseover: ?MessagePositionInfo,\n+ messageMouseover: ?OnMessagePositionInfo,\n|};\nclass ChatMessageList extends React.PureComponent<Props, State> {\n@@ -231,17 +234,27 @@ class ChatMessageList extends React.PureComponent<Props, State> {\n<Message\nitem={item}\nthreadInfo={threadInfo}\n- onMouseOver={this.showTimestamp}\n+ setMouseOver={this.setTimestampTooltip}\nchatInputState={chatInputState}\nkey={ChatMessageList.keyExtractor(item)}\n/>\n);\n}\n- showTimestamp = (messagePositionInfo: MessagePositionInfo) => {\n+ setTimestampTooltip = (messagePositionInfo: MessagePositionInfo) => {\nif (!this.messageContainer) {\nreturn;\n}\n+ if (messagePositionInfo.type === \"off\") {\n+ if (\n+ this.state.messageMouseover &&\n+ ChatMessageList.keyExtractor(this.state.messageMouseover.item) ===\n+ ChatMessageList.keyExtractor(messagePositionInfo.item)\n+ ) {\n+ this.setState({ messageMouseover: null });\n+ }\n+ return;\n+ }\nconst containerTop = this.messageContainer.getBoundingClientRect().top;\nconst messageMouseover = {\n...messagePositionInfo,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message-timestamp-tooltip.react.js",
"new_path": "web/chat/message-timestamp-tooltip.react.js",
"diff": "// @flow\n-import type { MessagePositionInfo } from './message.react';\n+import type { OnMessagePositionInfo } from './message.react';\nimport { isComposableMessageType } from 'lib/types/message-types';\nimport * as React from 'react';\n@@ -13,7 +13,7 @@ import { calculateTextWidth } from '../utils/text-utils';\nimport css from './chat-message-list.css';\ntype Props = {|\n- messagePositionInfo: ?MessagePositionInfo,\n+ messagePositionInfo: ?OnMessagePositionInfo,\n|};\nfunction MessageTimestampTooltip(props: Props) {\nif (!props.messagePositionInfo) {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message.react.js",
"new_path": "web/chat/message.react.js",
"diff": "@@ -21,7 +21,8 @@ import RobotextMessage from './robotext-message.react';\nimport MultimediaMessage from './multimedia-message.react';\nimport css from './chat-message-list.css';\n-export type MessagePositionInfo = {|\n+export type OnMessagePositionInfo = {|\n+ type: \"on\",\nitem: ChatMessageInfoItem,\nmessagePosition: {|\ntop: number,\n@@ -32,10 +33,16 @@ export type MessagePositionInfo = {|\nwidth: number,\n|},\n|};\n+export type MessagePositionInfo =\n+ | OnMessagePositionInfo\n+ | {|\n+ type: \"off\",\n+ item: ChatMessageInfoItem,\n+ |};\ntype Props = {|\nitem: ChatMessageInfoItem,\nthreadInfo: ThreadInfo,\n- onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n+ setMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchatInputState: ChatInputState,\n|};\nclass Message extends React.PureComponent<Props> {\n@@ -43,7 +50,7 @@ class Message extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n- onMouseOver: PropTypes.func.isRequired,\n+ setMouseOver: PropTypes.func.isRequired,\nchatInputState: chatInputStatePropType.isRequired,\n};\n@@ -62,14 +69,14 @@ class Message extends React.PureComponent<Props> {\n<TextMessage\nitem={this.props.item}\nthreadInfo={this.props.threadInfo}\n- onMouseOver={this.props.onMouseOver}\n+ setMouseOver={this.props.setMouseOver}\n/>\n);\n} else if (this.props.item.messageInfo.type === messageTypes.MULTIMEDIA) {\nmessage = (\n<MultimediaMessage\nitem={this.props.item}\n- onMouseOver={this.props.onMouseOver}\n+ setMouseOver={this.props.setMouseOver}\nchatInputState={this.props.chatInputState}\n/>\n);\n@@ -77,7 +84,7 @@ class Message extends React.PureComponent<Props> {\nmessage = (\n<RobotextMessage\nitem={this.props.item}\n- onMouseOver={this.props.onMouseOver}\n+ setMouseOver={this.props.setMouseOver}\n/>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -23,14 +23,14 @@ import Multimedia from './multimedia.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\n- onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n+ setMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchatInputState: ChatInputState,\n|};\nclass MultimediaMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\n- onMouseOver: PropTypes.func.isRequired,\n+ setMouseOver: PropTypes.func.isRequired,\nchatInputState: chatInputStatePropType.isRequired,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -33,13 +33,13 @@ import css from './chat-message-list.css';\ntype Props = {|\nitem: ChatMessageInfoItem,\n- onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n+ setMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n|};\nclass RobotextMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\n- onMouseOver: PropTypes.func.isRequired,\n+ setMouseOver: PropTypes.func.isRequired,\n};\nconstructor(props: Props) {\n@@ -60,7 +60,7 @@ class RobotextMessage extends React.PureComponent<Props> {\nrender() {\nreturn (\n<div className={css.robotext}>\n- <span onMouseOver={this.onMouseOver}>\n+ <span onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut}>\n{this.linkedRobotext()}\n</span>\n</div>\n@@ -108,7 +108,12 @@ class RobotextMessage extends React.PureComponent<Props> {\nconst rect = event.currentTarget.getBoundingClientRect();\nconst { top, bottom, left, right, height, width } = rect;\nconst messagePosition = { top, bottom, left, right, height, width };\n- this.props.onMouseOver({ item, messagePosition });\n+ this.props.setMouseOver({ type: \"on\", item, messagePosition });\n+ }\n+\n+ onMouseOut = () => {\n+ const { item } = this.props;\n+ this.props.setMouseOver({ type: \"off\", item });\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/text-message.react.js",
"new_path": "web/chat/text-message.react.js",
"diff": "@@ -28,14 +28,14 @@ import FailedSend from './failed-send.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\nthreadInfo: ThreadInfo,\n- onMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n+ setMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\n|};\nclass TextMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\n- onMouseOver: PropTypes.func.isRequired,\n+ setMouseOver: PropTypes.func.isRequired,\n};\nconstructor(props: Props) {\n@@ -142,6 +142,7 @@ class TextMessage extends React.PureComponent<Props> {\nclassName={messageClassName}\nstyle={messageStyle}\nonMouseOver={this.onMouseOver}\n+ onMouseOut={this.onMouseOut}\n>\n<Linkify>{text}</Linkify>\n</div>\n@@ -157,7 +158,12 @@ class TextMessage extends React.PureComponent<Props> {\nconst rect = event.currentTarget.getBoundingClientRect();\nconst { top, bottom, left, right, height, width } = rect;\nconst messagePosition = { top, bottom, left, right, height, width };\n- this.props.onMouseOver({ item, messagePosition });\n+ this.props.setMouseOver({ type: \"on\", item, messagePosition });\n+ }\n+\n+ onMouseOut = () => {\n+ const { item } = this.props;\n+ this.props.setMouseOver({ type: \"off\", item });\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Clear MessageTimestampTooltip on Message onMouseOut |
129,187 | 03.02.2019 17:15:29 | 18,000 | f27312c48b477603d20e096694ce9c10a7705a78 | [web] Only use flex-direction: column-reverse on Chrome | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.react.js",
"new_path": "web/chat/chat-message-list.react.js",
"diff": "@@ -51,7 +51,7 @@ import MessageTimestampTooltip from './message-timestamp-tooltip.react';\nimport css from './chat-message-list.css';\nconst browser = detectBrowser();\n-const usingFlexDirectionColumnReverse = !browser || browser.name !== \"firefox\";\n+const usingFlexDirectionColumnReverse = browser && browser.name === \"chrome\";\ntype PassedProps = {|\nactiveChatThreadID: ?string,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Only use flex-direction: column-reverse on Chrome |
129,187 | 03.02.2019 17:31:10 | 18,000 | 4c2b1837c75b73aaf3308c97691308857b84e512 | [web] Fix align = "right" condition in MessageTimestampTooltip | [
{
"change_type": "MODIFY",
"old_path": "web/chat/message-timestamp-tooltip.react.js",
"new_path": "web/chat/message-timestamp-tooltip.react.js",
"diff": "@@ -54,7 +54,8 @@ function MessageTimestampTooltip(props: Props) {\nconst centerOfMessage = messagePosition.top + messagePosition.height / 2;\nconst topOfTooltip = centerOfMessage - height / 2;\nstyle = {\n- right: messagePosition.right + widthWithArrow,\n+ // 10 = 7px arrow + 3px extra\n+ left: messagePosition.left + messagePosition.width + 10,\ntop: topOfTooltip,\n};\nclassName = css.messageTimestampRightTooltip;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix align = "right" condition in MessageTimestampTooltip |
129,187 | 04.02.2019 19:29:11 | 18,000 | 6172b5252592bccc532de599f68cace48ab858a1 | Handle unsupervised background
If a background occurs without registering a `BACKGROUND` action (common on native), we will try to detect it when we come back and handle it gracefully. | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/connection-reducer.js",
"new_path": "lib/reducers/connection-reducer.js",
"diff": "@@ -14,6 +14,7 @@ import {\n} from '../types/socket-types';\nimport { defaultCalendarQuery } from '../types/entry-types';\nimport { queueActivityUpdatesActionType } from '../types/activity-types';\n+import { unsupervisedBackgroundActionType } from './foreground-reducer';\nimport { setNewSessionActionType } from '../utils/action-utils';\nimport {\n@@ -33,6 +34,8 @@ export default function reduceConnectionInfo(\n): ConnectionInfo {\nif (action.type === updateConnectionStatusActionType) {\nreturn { ...state, status: action.payload.status, lateResponses: [] };\n+ } else if (action.type === unsupervisedBackgroundActionType) {\n+ return { ...state, status: \"disconnected\", lateResponses: [] };\n} else if (action.type === queueActivityUpdatesActionType) {\nconst { activityUpdates } = action.payload;\nreturn {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/foreground-reducer.js",
"new_path": "lib/reducers/foreground-reducer.js",
"diff": "@@ -4,12 +4,16 @@ import type { BaseAction } from '../types/redux-types';\nexport const backgroundActionType = \"BACKGROUND\";\nexport const foregroundActionType = \"FOREGROUND\";\n+export const unsupervisedBackgroundActionType = \"UNSUPERVISED_BACKGROUND\";\nexport default function reduceForeground(\nstate: bool,\naction: BaseAction,\n): bool {\n- if (action.type === backgroundActionType) {\n+ if (\n+ action.type === backgroundActionType ||\n+ action.type === unsupervisedBackgroundActionType\n+ ) {\nreturn false;\n} else if (action.type === foregroundActionType) {\nreturn true;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/activity-handler.react.js",
"new_path": "lib/socket/activity-handler.react.js",
"diff": "@@ -45,6 +45,7 @@ class ActivityHandler extends React.PureComponent<Props> {\nactiveThreadLatestMessage: PropTypes.string,\ndispatchActionPayload: PropTypes.func.isRequired,\ndispatchActionPromise: PropTypes.func.isRequired,\n+ updateActivity: PropTypes.func.isRequired,\n};\ncomponentDidUpdate(prevProps: Props) {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -53,7 +53,7 @@ import {\n} from '../utils/action-utils';\nimport { socketAuthErrorResolutionAttempt } from '../actions/user-actions';\nimport { ServerError } from '../utils/errors';\n-import { pingFrequency } from '../shared/timeouts';\n+import { pingFrequency, serverRequestSocketTimeout } from '../shared/timeouts';\nimport { promiseAll } from '../utils/promises';\nimport { InflightRequests, SocketTimeout } from './inflight-requests';\nimport APIRequestHandler from './api-request-handler.react';\n@@ -64,8 +64,12 @@ import MessageHandler from './message-handler.react';\nimport CalendarQueryHandler from './calendar-query-handler.react';\nimport { logOutActionTypes } from '../actions/user-actions';\nimport { updateActivityActionTypes } from '../actions/activity-actions';\n+import { unsupervisedBackgroundActionType } from '../reducers/foreground-reducer';\ntype Props = {|\n+ detectUnsupervisedBackgroundRef?: (\n+ detectUnsupervisedBackground: (alreadyClosed: bool) => bool,\n+ ) => void,\n// Redux state\nactive: bool,\nopenSocket: () => WebSocket,\n@@ -93,8 +97,9 @@ type State = {|\nclass Socket extends React.PureComponent<Props, State> {\nstatic propTypes = {\n- openSocket: PropTypes.func.isRequired,\n+ detectUnsupervisedBackgroundRef: PropTypes.func,\nactive: PropTypes.bool.isRequired,\n+ openSocket: PropTypes.func.isRequired,\nqueuedClientResponses: PropTypes.arrayOf(clientResponsePropType).isRequired,\ngetClientResponses: PropTypes.func.isRequired,\nactiveThread: PropTypes.string,\n@@ -116,9 +121,17 @@ class Socket extends React.PureComponent<Props, State> {\nnextClientMessageID = 0;\nlisteners: Set<SocketListener> = new Set();\npingTimeoutID: ?TimeoutID;\n+ messageLastReceived: ?number;\ninitialPlatformDetailsSent = getConfig().platformDetails === \"web\";\nreopenConnectionAfterClosing = false;\n+ constructor(props: Props) {\n+ super(props);\n+ if (props.detectUnsupervisedBackgroundRef) {\n+ props.detectUnsupervisedBackgroundRef(this.detectUnsupervisedBackground);\n+ }\n+ }\n+\nopenSocket(newStatus: ConnectionStatus) {\nif (this.socket) {\nconst { status } = this.props.connection;\n@@ -153,7 +166,7 @@ class Socket extends React.PureComponent<Props, State> {\nsocket.onmessage = this.receiveMessage;\nsocket.onclose = (event: CloseEvent) => {\nif (this.socket === socket) {\n- this.onClose(event);\n+ this.onClose();\n}\n};\nthis.socket = socket;\n@@ -411,7 +424,7 @@ class Socket extends React.PureComponent<Props, State> {\nthis.listeners.delete(listener);\n}\n- onClose = (event: CloseEvent) => {\n+ onClose = () => {\nconst { status } = this.props.connection;\nthis.socket = null;\nthis.stopPing();\n@@ -419,7 +432,8 @@ class Socket extends React.PureComponent<Props, State> {\nthis.state.inflightRequests.rejectAll(new Error(\"socket closed\"));\nthis.setState({ inflightRequests: null });\n}\n- if (status !== \"disconnected\") {\n+ const handled = this.detectUnsupervisedBackground(true);\n+ if (!handled && status !== \"disconnected\") {\nthis.props.dispatchActionPayload(\nupdateConnectionStatusActionType,\n{ status: \"disconnected\" },\n@@ -581,6 +595,7 @@ class Socket extends React.PureComponent<Props, State> {\nresetPing() {\nthis.stopPing();\nconst socket = this.socket;\n+ this.messageLastReceived = Date.now();\nthis.pingTimeoutID = setTimeout(\n() => {\nif (this.socket === socket) {\n@@ -621,6 +636,35 @@ class Socket extends React.PureComponent<Props, State> {\n);\n}\n+ cleanUpServerTerminatedSocket() {\n+ if (this.socket && this.socket.readyState < 2) {\n+ this.socket.close();\n+ } else {\n+ this.onClose();\n+ }\n+ }\n+\n+ detectUnsupervisedBackground = (alreadyClosed: bool) => {\n+ // On native, sometimes the app is backgrounded without the proper callbacks\n+ // getting triggered. This leaves us in an incorrect state for two reasons:\n+ // (1) The connection is still considered to be active, causing API requests\n+ // to be processed via socket and failing.\n+ // (2) We rely on flipping foreground state in Redux to detect activity\n+ // changes, and thus won't think we need to update activity.\n+ if (\n+ this.props.connection.status !== \"connected\" ||\n+ !this.messageLastReceived ||\n+ this.messageLastReceived + serverRequestSocketTimeout >= Date.now()\n+ ) {\n+ return false;\n+ }\n+ if (!alreadyClosed) {\n+ this.cleanUpServerTerminatedSocket();\n+ }\n+ this.props.dispatchActionPayload(unsupervisedBackgroundActionType, null);\n+ return true;\n+ }\n+\n}\nexport default Socket;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -612,6 +612,9 @@ export type BaseAction =\n|} | {|\ntype: \"BACKGROUND\",\npayload?: void,\n+ |} | {|\n+ type: \"UNSUPERVISED_BACKGROUND\",\n+ payload?: void,\n|} | {|\ntype: \"PROCESS_UPDATES\",\npayload: UpdatesResultWithUserInfos,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/redux-logger.js",
"new_path": "lib/utils/redux-logger.js",
"diff": "@@ -8,7 +8,10 @@ import {\nimport { saveDraftActionType } from '../actions/miscellaneous-action-types';\n-const uninterestingActionTypes = new Set([ saveDraftActionType ]);\n+const uninterestingActionTypes = new Set([\n+ saveDraftActionType,\n+ \"Navigation/COMPLETE_TRANSITION\",\n+]);\nclass ReduxLogger {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -145,6 +145,7 @@ class AppWithNavigationState extends React.PureComponent<Props> {\ninitialAndroidNotifHandled = false;\nopenThreadOnceReceived: Set<string> = new Set();\nappStarted = 0;\n+ detectUnsupervisedBackground: ?((alreadyClosed: bool) => bool);\ncomponentDidMount() {\nthis.appStarted = Date.now();\n@@ -537,6 +538,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\niosNotificationOpened = (notification) => {\n+ if (this.detectUnsupervisedBackground) {\n+ this.detectUnsupervisedBackground(false);\n+ }\nconst threadID = notification.getData().threadID;\nif (!threadID) {\nconsole.log(\"Notification with missing threadID received!\");\n@@ -635,6 +639,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nconst inAppNotificationHeight = DeviceInfo.isIPhoneX_deprecated ? 104 : 80;\nreturn (\n<View style={styles.app}>\n+ <Socket\n+ detectUnsupervisedBackgroundRef={this.detectUnsupervisedBackgroundRef}\n+ />\n<ReduxifiedRootNavigator\nstate={this.props.navigationState}\ndispatch={this.props.dispatch}\n@@ -655,6 +662,12 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nthis.inAppNotification = inAppNotification;\n}\n+ detectUnsupervisedBackgroundRef = (\n+ detectUnsupervisedBackground: ?((alreadyClosed: bool) => bool),\n+ ) => {\n+ this.detectUnsupervisedBackground = detectUnsupervisedBackground;\n+ }\n+\n}\nconst styles = StyleSheet.create({\n@@ -687,7 +700,6 @@ const App = (props: {}) =>\n<Provider store={store}>\n<ErrorBoundary>\n<ConnectedAppWithNavigationState />\n- <Socket />\n</ErrorBoundary>\n</Provider>;\nAppRegistry.registerComponent('SquadCal', () => App);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux-setup.js",
"new_path": "native/redux-setup.js",
"diff": "@@ -43,7 +43,6 @@ import {\nimport { AppState as NativeAppState, Platform } from 'react-native';\nimport baseReducer from 'lib/reducers/master-reducer';\n-import { notificationPressActionType } from 'lib/shared/notif-utils';\nimport {\nsendTextMessageActionTypes,\nsaveMessagesActionType,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Handle unsupervised background
If a background occurs without registering a `BACKGROUND` action (common on native), we will try to detect it when we come back and handle it gracefully. |
129,187 | 04.02.2019 20:02:22 | 18,000 | eb35ace9c298eb8d8ec9deda6febeaf234a05d5b | [server] Include libdef for detect-browser
Used via web | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/flow-typed/npm/detect-browser_vx.x.x.js",
"diff": "+// flow-typed signature: 7d4d59cf48e607d12c556f74be5cd003\n+// flow-typed version: <<STUB>>/detect-browser_v^4.0.4/flow_v0.89.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'detect-browser'\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 'detect-browser' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+\n+\n+// Filename aliases\n+declare module 'detect-browser/index' {\n+ declare module.exports: $Exports<'detect-browser'>;\n+}\n+declare module 'detect-browser/index.js' {\n+ declare module.exports: $Exports<'detect-browser'>;\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Include libdef for detect-browser
Used via web |
129,187 | 05.02.2019 18:06:26 | 18,000 | 2a0b44d78f96acb665e5b4b9a72d9771b3439d04 | [lib] Don't clear queuedActivityUpdates on updateActivityActionTypes.failed | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/connection-reducer.js",
"new_path": "lib/reducers/connection-reducer.js",
"diff": "@@ -59,10 +59,7 @@ export default function reduceConnectionInfo(\n...activityUpdates,\n],\n};\n- } else if (\n- action.type === updateActivityActionTypes.success ||\n- action.type === updateActivityActionTypes.failed\n- ) {\n+ } else if (action.type === updateActivityActionTypes.success) {\nconst { payload } = action;\nreturn {\n...state,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/activity-handler.react.js",
"new_path": "lib/socket/activity-handler.react.js",
"diff": "@@ -97,19 +97,10 @@ class ActivityHandler extends React.PureComponent<Props> {\n}\nthis.props.dispatchActionPromise(\nupdateActivityActionTypes,\n- this.updateActivity(activityUpdates),\n+ this.props.updateActivity(activityUpdates),\n);\n}\n- async updateActivity(activityUpdates: $ReadOnlyArray<ActivityUpdate>) {\n- try {\n- return await this.props.updateActivity(activityUpdates);\n- } catch (e) {\n- e.activityUpdates = activityUpdates;\n- throw e;\n- }\n- }\n-\n}\nexport default connect(\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/activity-types.js",
"new_path": "lib/types/activity-types.js",
"diff": "@@ -30,9 +30,6 @@ export type ActivityUpdateSuccessPayload = {|\nactivityUpdates: $ReadOnlyArray<ActivityUpdate>,\nresult: UpdateActivityResult,\n|};\n-export type ActivityUpdateErrorExtras = {\n- activityUpdates: $ReadOnlyArray<ActivityUpdate>,\n-};\nexport const queueActivityUpdatesActionType = \"QUEUE_ACTIVITY_UPDATES\";\nexport type QueueActivityUpdatesPayload = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -68,7 +68,6 @@ import type {\nimport type { UpdatesResultWithUserInfos } from './update-types';\nimport type {\nActivityUpdateSuccessPayload,\n- ActivityUpdateErrorExtras,\nQueueActivityUpdatesPayload,\n} from './activity-types';\nimport type {\n@@ -502,7 +501,7 @@ export type BaseAction =\n|} | {|\ntype: \"UPDATE_ACTIVITY_FAILED\",\nerror: true,\n- payload: Error & ActivityUpdateErrorExtras,\n+ payload: Error,\nloadingInfo: LoadingInfo,\n|} | {|\ntype: \"UPDATE_ACTIVITY_SUCCESS\",\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Don't clear queuedActivityUpdates on updateActivityActionTypes.failed |
129,187 | 04.02.2019 19:50:22 | 18,000 | 689a8d6048a9b11a4f8acee0615c608498cde954 | [lib] Prevent race between final activity update and socket close | [
{
"change_type": "MODIFY",
"old_path": "lib/socket/api-request-handler.react.js",
"new_path": "lib/socket/api-request-handler.react.js",
"diff": "@@ -32,9 +32,24 @@ class APIRequestHandler extends React.PureComponent<Props> {\nconnection: connectionInfoPropType.isRequired,\n};\n- static isConnected(props: Props) {\n+ static isConnected(props: Props, request?: APIRequest) {\nconst { inflightRequests, connection } = props;\n- return inflightRequests && connection.status === \"connected\";\n+ if (!inflightRequests) {\n+ return false;\n+ }\n+ // This is a hack. We actually have a race condition between\n+ // ActivityHandler and Socket. Both of them respond to a backgrounding, but\n+ // we want ActivityHandler to go first. Once it sends its message, Socket\n+ // will wait for the response before shutting down. But if Socket starts\n+ // shutting down first, we'll have a problem. Note that this approach only\n+ // stops the race in fetchResponse below, and not in action-utils (which\n+ // happens earlier via the registerActiveSocket call below), but empircally\n+ // that hasn't been an issue.\n+ // The reason I didn't rewrite this to happen in a single component is\n+ // because I want to maintain separation of concerns. Upcoming React Hooks\n+ // will be a great way to rewrite them to be related but still separated.\n+ return connection.status === \"connected\" ||\n+ (request && request.endpoint === 'update_activity');\n}\nget registeredResponseFetcher() {\n@@ -64,7 +79,7 @@ class APIRequestHandler extends React.PureComponent<Props> {\n}\nfetchResponse = async (request: APIRequest): Promise<Object> => {\n- if (!APIRequestHandler.isConnected(this.props)) {\n+ if (!APIRequestHandler.isConnected(this.props, request)) {\nthrow new SocketOffline(\"socket_offline\");\n}\nconst { inflightRequests } = this.props;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/inflight-requests.js",
"new_path": "lib/socket/inflight-requests.js",
"diff": "@@ -228,10 +228,15 @@ class InflightRequests {\n}\n}\n- get allRequestsResolved(): bool {\n+ allRequestsResolvedExcept(excludeMessageID: ?number) {\nfor (let inflightRequest of this.data) {\nconst { expectedResponseType } = inflightRequest;\n- if (expectedResponseType !== serverSocketMessageTypes.PONG) {\n+ if (\n+ expectedResponseType !== serverSocketMessageTypes.PONG &&\n+ (excludeMessageID === null ||\n+ excludeMessageID === undefined ||\n+ excludeMessageID !== inflightRequest.messageID)\n+ ) {\nreturn false;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -190,7 +190,12 @@ class Socket extends React.PureComponent<Props, State> {\nthis.resetPing();\n}\n- closeSocket() {\n+ closeSocket(\n+ // This param is a hack. When closing a socket there is a race between this\n+ // function and the one to propagate the activity update. We make sure that\n+ // the activity update wins the race by passing in this param.\n+ activityUpdatePending: bool,\n+ ) {\nconst { status } = this.props.connection;\nif (status === \"disconnected\") {\nreturn;\n@@ -203,8 +208,10 @@ class Socket extends React.PureComponent<Props, State> {\nupdateConnectionStatusActionType,\n{ status: \"disconnecting\" },\n);\n+ if (!activityUpdatePending) {\nthis.finishClosingSocket();\n}\n+ }\nforceCloseSocket() {\nthis.stopPing();\n@@ -218,9 +225,12 @@ class Socket extends React.PureComponent<Props, State> {\nthis.finishClosingSocket();\n}\n- finishClosingSocket() {\n+ finishClosingSocket(receivedResponseTo?: ?number) {\nconst { inflightRequests } = this.state;\n- if (inflightRequests && !inflightRequests.allRequestsResolved) {\n+ if (\n+ inflightRequests &&\n+ !inflightRequests.allRequestsResolvedExcept(receivedResponseTo)\n+ ) {\nreturn;\n}\nif (this.socket && this.socket.readyState < 2) {\n@@ -255,7 +265,7 @@ class Socket extends React.PureComponent<Props, State> {\n}\ncomponentWillUnmount() {\n- this.closeSocket();\n+ this.closeSocket(false);\nthis.reconnect.cancel();\n}\n@@ -263,7 +273,7 @@ class Socket extends React.PureComponent<Props, State> {\nif (this.props.active && !prevProps.active) {\nthis.openSocket(\"connecting\");\n} else if (!this.props.active && prevProps.active) {\n- this.closeSocket();\n+ this.closeSocket(!!prevProps.activeThread);\n} else if (\nthis.props.active &&\nprevProps.openSocket !== this.props.openSocket\n@@ -371,7 +381,12 @@ class Socket extends React.PureComponent<Props, State> {\nthis.state.inflightRequests.resolveRequestsForMessage(message);\nconst { status } = this.props.connection;\nif (status === \"disconnecting\" || status === \"forcedDisconnecting\") {\n- this.finishClosingSocket();\n+ this.finishClosingSocket(\n+ // We do this for Flow\n+ message.responseTo !== undefined\n+ ? message.responseTo\n+ : null,\n+ );\n}\nfor (let listener of this.listeners) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Prevent race between final activity update and socket close |
129,187 | 06.02.2019 11:37:53 | 18,000 | be0a4bb8a40124c9f16db8fd8fabaa219da15971 | [server] Share inconsistency report validator shapes | [
{
"change_type": "MODIFY",
"old_path": "lib/types/report-types.js",
"new_path": "lib/types/report-types.js",
"diff": "@@ -32,16 +32,7 @@ export type FlatErrorData = {|\ncomponentStack?: ?string,\n|};\n-type ErrorReportCreationRequest = {|\n- type: 0,\n- platformDetails: PlatformDetails,\n- errors: $ReadOnlyArray<FlatErrorData>,\n- preloadedState: AppState,\n- currentState: AppState,\n- actions: $ReadOnlyArray<BaseAction>,\n-|};\n-export type ThreadInconsistencyReportCreationRequest = {|\n- type: 1,\n+export type ThreadInconsistencyReportShape = {|\nplatformDetails: PlatformDetails,\nbeforeAction: {[id: string]: RawThreadInfo},\naction: BaseAction,\n@@ -50,8 +41,7 @@ export type ThreadInconsistencyReportCreationRequest = {|\nlastActionTypes?: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\ntime?: number,\n|};\n-export type EntryInconsistencyReportCreationRequest = {|\n- type: 2,\n+export type EntryInconsistencyReportShape = {|\nplatformDetails: PlatformDetails,\nbeforeAction: {[id: string]: RawEntryInfo},\naction: BaseAction,\n@@ -61,6 +51,23 @@ export type EntryInconsistencyReportCreationRequest = {|\nlastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\ntime: number,\n|};\n+\n+type ErrorReportCreationRequest = {|\n+ type: 0,\n+ platformDetails: PlatformDetails,\n+ errors: $ReadOnlyArray<FlatErrorData>,\n+ preloadedState: AppState,\n+ currentState: AppState,\n+ actions: $ReadOnlyArray<BaseAction>,\n+|};\n+export type ThreadInconsistencyReportCreationRequest = {|\n+ ...ThreadInconsistencyReportShape,\n+ type: 1,\n+|};\n+export type EntryInconsistencyReportCreationRequest = {|\n+ ...EntryInconsistencyReportShape,\n+ type: 2,\n+|};\nexport type ReportCreationRequest =\n| ErrorReportCreationRequest\n| ThreadInconsistencyReportCreationRequest\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/request-types.js",
"new_path": "lib/types/request-types.js",
"diff": "@@ -21,6 +21,10 @@ import {\naccountUserInfoPropType,\ncurrentUserPropType,\n} from './user-types';\n+import type {\n+ ThreadInconsistencyReportShape,\n+ EntryInconsistencyReportShape,\n+} from './report-types';\nimport invariant from 'invariant';\nimport PropTypes from 'prop-types';\n@@ -72,14 +76,8 @@ type DeviceTokenClientResponse = {|\n|};\nexport type ThreadInconsistencyClientResponse = {|\n+ ...ThreadInconsistencyReportShape,\ntype: 2,\n- platformDetails: PlatformDetails,\n- beforeAction: {[id: string]: RawThreadInfo},\n- action: BaseAction,\n- pollResult: {[id: string]: RawThreadInfo},\n- pushResult: {[id: string]: RawThreadInfo},\n- lastActionTypes?: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n- time?: number,\n|};\ntype PlatformDetailsServerRequest = {|\n@@ -97,14 +95,7 @@ type InitialActivityUpdateClientResponse = {|\nexport type EntryInconsistencyClientResponse = {|\ntype: 5,\n- platformDetails: PlatformDetails,\n- beforeAction: {[id: string]: RawEntryInfo},\n- action: BaseAction,\n- calendarQuery: CalendarQuery,\n- pollResult: {[id: string]: RawEntryInfo},\n- pushResult: {[id: string]: RawEntryInfo},\n- lastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n- time: number,\n+ ...EntryInconsistencyReportShape,\n|};\nexport type CheckStateServerRequest = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/ping-responders.js",
"new_path": "server/src/responders/ping-responders.js",
"diff": "@@ -55,7 +55,6 @@ import {\n} from '../utils/validation-utils';\nimport {\nentryQueryInputValidator,\n- newEntryQueryInputValidator,\nnormalizeCalendarQuery,\nverifyCalendarQueryThreadIDs,\n} from './entry-responders';\n@@ -92,6 +91,10 @@ import {\n} from '../deleters/update-deleters';\nimport { activityUpdatesInputValidator } from './activity-responders';\nimport { SQL } from '../database';\n+import {\n+ threadInconsistencyReportValidatorShape,\n+ entryInconsistencyReportValidatorShape,\n+} from './report-responders';\nconst clientResponseInputValidator = t.union([\ntShape({\n@@ -109,31 +112,18 @@ const clientResponseInputValidator = t.union([\ndeviceToken: t.String,\n}),\ntShape({\n+ ...threadInconsistencyReportValidatorShape,\ntype: t.irreducible(\n'serverRequestTypes.THREAD_INCONSISTENCY',\nx => x === serverRequestTypes.THREAD_INCONSISTENCY,\n),\n- platformDetails: tPlatformDetails,\n- beforeAction: t.Object,\n- action: t.Object,\n- pollResult: t.Object,\n- pushResult: t.Object,\n- lastActionTypes: t.maybe(t.list(t.String)),\n- time: t.maybe(t.Number),\n}),\ntShape({\n+ ...entryInconsistencyReportValidatorShape,\ntype: t.irreducible(\n'serverRequestTypes.ENTRY_INCONSISTENCY',\nx => x === serverRequestTypes.ENTRY_INCONSISTENCY,\n),\n- platformDetails: tPlatformDetails,\n- beforeAction: t.Object,\n- action: t.Object,\n- calendarQuery: newEntryQueryInputValidator,\n- pollResult: t.Object,\n- pushResult: t.Object,\n- lastActionTypes: t.list(t.String),\n- time: t.Number,\n}),\ntShape({\ntype: t.irreducible(\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/report-responders.js",
"new_path": "server/src/responders/report-responders.js",
"diff": "@@ -27,6 +27,26 @@ import {\n} from '../fetchers/report-fetchers';\nimport { newEntryQueryInputValidator } from './entry-responders';\n+const threadInconsistencyReportValidatorShape = {\n+ platformDetails: tPlatformDetails,\n+ beforeAction: t.Object,\n+ action: t.Object,\n+ pollResult: t.Object,\n+ pushResult: t.Object,\n+ lastActionTypes: t.maybe(t.list(t.String)),\n+ time: t.maybe(t.Number),\n+};\n+const entryInconsistencyReportValidatorShape = {\n+ platformDetails: tPlatformDetails,\n+ beforeAction: t.Object,\n+ action: t.Object,\n+ calendarQuery: newEntryQueryInputValidator,\n+ pollResult: t.Object,\n+ pushResult: t.Object,\n+ lastActionTypes: t.list(t.String),\n+ time: t.Number,\n+};\n+\nconst reportCreationRequestInputValidator = t.union([\ntShape({\ntype: t.maybe(t.irreducible(\n@@ -47,31 +67,18 @@ const reportCreationRequestInputValidator = t.union([\nactions: t.list(t.Object),\n}),\ntShape({\n+ ...threadInconsistencyReportValidatorShape,\ntype: t.irreducible(\n'reportTypes.THREAD_INCONSISTENCY',\nx => x === reportTypes.THREAD_INCONSISTENCY,\n),\n- platformDetails: tPlatformDetails,\n- beforeAction: t.Object,\n- action: t.Object,\n- pollResult: t.Object,\n- pushResult: t.Object,\n- lastActionTypes: t.maybe(t.list(t.String)),\n- time: t.maybe(t.Number),\n}),\ntShape({\n+ ...entryInconsistencyReportValidatorShape,\ntype: t.irreducible(\n'reportTypes.ENTRY_INCONSISTENCY',\nx => x === reportTypes.ENTRY_INCONSISTENCY,\n),\n- platformDetails: tPlatformDetails,\n- beforeAction: t.Object,\n- action: t.Object,\n- calendarQuery: newEntryQueryInputValidator,\n- pollResult: t.Object,\n- pushResult: t.Object,\n- lastActionTypes: t.list(t.String),\n- time: t.Number,\n}),\n]);\n@@ -133,6 +140,8 @@ async function errorReportDownloadResponder(\n}\nexport {\n+ threadInconsistencyReportValidatorShape,\n+ entryInconsistencyReportValidatorShape,\nreportCreationResponder,\nerrorReportFetchInfosResponder,\nerrorReportDownloadResponder,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Share inconsistency report validator shapes |
129,187 | 06.02.2019 14:23:44 | 18,000 | 91a0024c8eb398de89a68df437266d1e1a279995 | Separate out ClientClientResponse and ClientClientSocketMessage
The double-`Client` variants are for the client to use, and only need to support the latest version of the shape. In contrast, the original variants support all versions of the shape, and are for use on the server. | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/report-actions.js",
"new_path": "lib/actions/report-actions.js",
"diff": "import type { FetchJSON } from '../utils/fetch-json';\nimport type {\n- ReportCreationRequest,\n+ ClientReportCreationRequest,\nReportCreationResponse,\n} from '../types/report-types';\n@@ -14,7 +14,7 @@ const sendReportActionTypes = Object.freeze({\nconst fetchJSONOptions = { timeout: 60000 };\nasync function sendReport(\nfetchJSON: FetchJSON,\n- request: ReportCreationRequest,\n+ request: ClientReportCreationRequest,\n): Promise<ReportCreationResponse> {\nconst response = await fetchJSON(\n'create_report',\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/entry-reducer.js",
"new_path": "lib/reducers/entry-reducer.js",
"diff": "@@ -14,7 +14,7 @@ import {\nprocessUpdatesActionType,\n} from '../types/update-types';\nimport {\n- type EntryInconsistencyClientResponse,\n+ type ClientEntryInconsistencyClientResponse,\ntype ServerRequest,\nserverRequestTypes,\nclearDeliveredClientResponsesActionType,\n@@ -723,7 +723,7 @@ function findInconsistencies(\noldResult: {[id: string]: RawEntryInfo},\nnewResult: {[id: string]: RawEntryInfo},\ncalendarQuery: CalendarQuery,\n-): EntryInconsistencyClientResponse[] {\n+): ClientEntryInconsistencyClientResponse[] {\n// We don't want to bother reporting an inconsistency if it's just because of\n// extraneous EntryInfos (not within the current calendarQuery) on either side\nconst filteredPollResult = filterRawEntryInfosByCalendarQuery(\n@@ -739,7 +739,7 @@ function findInconsistencies(\n}\nif (action.type === clearDeliveredClientResponsesActionType) {\n// We can get a memory leak if we include a previous\n- // EntryInconsistencyClientResponse in this one\n+ // ClientEntryInconsistencyClientResponse in this one\naction = {\ntype: \"CLEAR_DELIVERED_CLIENT_RESPONSES\",\npayload: {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/thread-reducer.js",
"new_path": "lib/reducers/thread-reducer.js",
"diff": "@@ -8,7 +8,7 @@ import {\nprocessUpdatesActionType,\n} from '../types/update-types';\nimport {\n- type ThreadInconsistencyClientResponse,\n+ type ClientThreadInconsistencyClientResponse,\nserverRequestTypes,\nclearDeliveredClientResponsesActionType,\nprocessServerRequestsActionType,\n@@ -106,13 +106,13 @@ function findInconsistencies(\naction: BaseAction,\noldResult: {[id: string]: RawThreadInfo},\nnewResult: {[id: string]: RawThreadInfo},\n-): ThreadInconsistencyClientResponse[] {\n+): ClientThreadInconsistencyClientResponse[] {\nif (_isEqual(oldResult)(newResult)) {\nreturn emptyArray;\n}\nif (action.type === clearDeliveredClientResponsesActionType) {\n// We can get a memory leak if we include a previous\n- // ThreadInconsistencyClientResponse in this one\n+ // ClientThreadInconsistencyClientResponse in this one\naction = {\ntype: \"CLEAR_DELIVERED_CLIENT_RESPONSES\",\npayload: {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/selectors/socket-selectors.js",
"new_path": "lib/selectors/socket-selectors.js",
"diff": "@@ -4,9 +4,9 @@ import type { AppState } from '../types/redux-types';\nimport {\nserverRequestTypes,\ntype ServerRequest,\n- type ClientResponse,\n- type ThreadInconsistencyClientResponse,\n- type EntryInconsistencyClientResponse,\n+ type ClientClientResponse,\n+ type ClientThreadInconsistencyClientResponse,\n+ type ClientEntryInconsistencyClientResponse,\n} from '../types/request-types';\nimport type { RawEntryInfo, CalendarQuery } from '../types/entry-types';\nimport type { CurrentUserInfo } from '../types/user-types';\n@@ -30,10 +30,10 @@ const queuedClientResponsesSelector = createSelector<*, *, *, *, *>(\n(state: AppState) => state.entryStore.inconsistencyResponses,\n(\nthreadInconsistencyResponses:\n- $ReadOnlyArray<ThreadInconsistencyClientResponse>,\n+ $ReadOnlyArray<ClientThreadInconsistencyClientResponse>,\nentryInconsistencyResponses:\n- $ReadOnlyArray<EntryInconsistencyClientResponse>,\n- ): $ReadOnlyArray<ClientResponse> => [\n+ $ReadOnlyArray<ClientEntryInconsistencyClientResponse>,\n+ ): $ReadOnlyArray<ClientClientResponse> => [\n...threadInconsistencyResponses,\n...entryInconsistencyResponses,\n],\n@@ -52,7 +52,7 @@ const getClientResponsesSelector = createSelector<*, *, *, *, *, *, *>(\n) => (\ncalendarActive: bool,\nserverRequests: $ReadOnlyArray<ServerRequest>,\n- ): $ReadOnlyArray<ClientResponse> => {\n+ ): $ReadOnlyArray<ClientClientResponse> => {\nconst clientResponses = [];\nconst serverRequestedPlatformDetails = serverRequests.some(\nrequest => request.type === serverRequestTypes.PLATFORM_DETAILS,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/request-response-handler.react.js",
"new_path": "lib/socket/request-response-handler.react.js",
"diff": "@@ -13,7 +13,7 @@ import {\nimport {\nclearDeliveredClientResponsesActionType,\nprocessServerRequestsActionType,\n- type ClientResponse,\n+ type ClientClientResponse,\ntype ServerRequest,\nclientResponsePropType,\n} from '../types/request-types';\n@@ -40,11 +40,11 @@ type Props = {|\nremoveListener: (listener: SocketListener) => void,\ngetClientResponses: (\nactiveServerRequests: $ReadOnlyArray<ServerRequest>,\n- ) => $ReadOnlyArray<ClientResponse>,\n+ ) => $ReadOnlyArray<ClientClientResponse>,\ncurrentCalendarQuery: () => CalendarQuery,\n// Redux state\nconnection: ConnectionInfo,\n- queuedClientResponses: $ReadOnlyArray<ClientResponse>,\n+ queuedClientResponses: $ReadOnlyArray<ClientClientResponse>,\n// Redux dispatch functions\ndispatchActionPayload: DispatchActionPayload,\n|};\n@@ -114,7 +114,7 @@ class RequestResponseHandler extends React.PureComponent<Props> {\n}\nsendAndHandleQueuedClientResponses(\n- clientResponses: $ReadOnlyArray<ClientResponse>,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\n) {\nif (clientResponses.length === 0) {\nreturn;\n@@ -124,7 +124,7 @@ class RequestResponseHandler extends React.PureComponent<Props> {\n}\nsendClientResponses(\n- clientResponses: $ReadOnlyArray<ClientResponse>,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\n): Promise<RequestsServerSocketMessage> {\nconst { inflightRequests } = this.props;\ninvariant(\n@@ -143,7 +143,7 @@ class RequestResponseHandler extends React.PureComponent<Props> {\nasync handleQueuedClientResponses(\npromise: Promise<RequestsServerSocketMessage>,\n- clientResponses: $ReadOnlyArray<ClientResponse>,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\nretriesLeft: number = 1,\n): Promise<void> {\ntry {\n@@ -183,7 +183,7 @@ class RequestResponseHandler extends React.PureComponent<Props> {\n}\nsendAndHandleClientResponsesToServerRequests(\n- clientResponses: $ReadOnlyArray<ClientResponse>,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\n) {\nif (clientResponses.length === 0) {\nreturn;\n@@ -194,7 +194,7 @@ class RequestResponseHandler extends React.PureComponent<Props> {\nasync handleClientResponsesToServerRequests(\npromise: Promise<RequestsServerSocketMessage>,\n- clientResponses: $ReadOnlyArray<ClientResponse>,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\nretriesLeft: number = 1,\n): Promise<void> {\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "import {\nserverRequestTypes,\n- type ClientResponse,\n+ type ClientClientResponse,\ntype ServerRequest,\nclearDeliveredClientResponsesActionType,\nclientResponsePropType,\n@@ -14,7 +14,7 @@ import {\n} from '../types/session-types';\nimport {\nclientSocketMessageTypes,\n- type ClientSocketMessage,\n+ type ClientClientSocketMessage,\nserverSocketMessageTypes,\ntype ServerSocketMessage,\nstateSyncPayloadTypes,\n@@ -23,8 +23,8 @@ import {\nupdateConnectionStatusActionType,\nconnectionInfoPropType,\ntype ConnectionInfo,\n- type InitialClientSocketMessage,\n- type ResponsesClientSocketMessage,\n+ type ClientInitialClientSocketMessage,\n+ type ClientResponsesClientSocketMessage,\ntype PingClientSocketMessage,\ntype AckUpdatesClientSocketMessage,\ntype APIRequestClientSocketMessage,\n@@ -73,10 +73,10 @@ type Props = {|\n// Redux state\nactive: bool,\nopenSocket: () => WebSocket,\n- queuedClientResponses: $ReadOnlyArray<ClientResponse>,\n+ queuedClientResponses: $ReadOnlyArray<ClientClientResponse>,\ngetClientResponses: (\nactiveServerRequests: $ReadOnlyArray<ServerRequest>,\n- ) => $ReadOnlyArray<ClientResponse>,\n+ ) => $ReadOnlyArray<ClientClientResponse>,\nactiveThread: ?string,\nsessionStateFunc: () => SessionState,\nsessionIdentification: SessionIdentification,\n@@ -333,9 +333,11 @@ class Socket extends React.PureComponent<Props, State> {\n// These conditions all do the same thing and the runtime checks are only\n// necessary for Flow\nif (message.type === clientSocketMessageTypes.INITIAL) {\n- this.sendMessage(({ ...message, id }: InitialClientSocketMessage));\n+ this.sendMessage(({ ...message, id }: ClientInitialClientSocketMessage));\n} else if (message.type === clientSocketMessageTypes.RESPONSES) {\n- this.sendMessage(({ ...message, id }: ResponsesClientSocketMessage));\n+ this.sendMessage(\n+ ({ ...message, id }: ClientResponsesClientSocketMessage),\n+ );\n} else if (message.type === clientSocketMessageTypes.PING) {\nthis.sendMessage(({ ...message, id }: PingClientSocketMessage));\n} else if (message.type === clientSocketMessageTypes.ACK_UPDATES) {\n@@ -346,7 +348,7 @@ class Socket extends React.PureComponent<Props, State> {\nreturn id;\n}\n- sendMessage(message: ClientSocketMessage) {\n+ sendMessage(message: ClientClientSocketMessage) {\nconst socket = this.socket;\ninvariant(socket, \"should be set\");\nsocket.send(JSON.stringify(message));\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/entry-types.js",
"new_path": "lib/types/entry-types.js",
"diff": "@@ -8,7 +8,7 @@ import {\ndefaultCalendarFilters,\n} from './filter-types';\nimport type { CreateUpdatesResponse } from './update-types';\n-import type { EntryInconsistencyClientResponse } from './request-types';\n+import type { ClientEntryInconsistencyClientResponse } from './request-types';\nimport type { Platform } from './device-types';\nimport PropTypes from 'prop-types';\n@@ -72,7 +72,8 @@ export type EntryStore = {|\nentryInfos: {[id: string]: RawEntryInfo},\ndaysToEntries: {[day: string]: string[]},\nlastUserInteractionCalendar: number,\n- inconsistencyResponses: $ReadOnlyArray<EntryInconsistencyClientResponse>,\n+ inconsistencyResponses:\n+ $ReadOnlyArray<ClientEntryInconsistencyClientResponse>,\n|};\nexport type CalendarQuery = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/report-types.js",
"new_path": "lib/types/report-types.js",
"diff": "@@ -73,6 +73,30 @@ export type ReportCreationRequest =\n| ThreadInconsistencyReportCreationRequest\n| EntryInconsistencyReportCreationRequest;\n+export type ClientThreadInconsistencyReportShape = {|\n+ platformDetails: PlatformDetails,\n+ beforeAction: {[id: string]: RawThreadInfo},\n+ action: BaseAction,\n+ pollResult: {[id: string]: RawThreadInfo},\n+ pushResult: {[id: string]: RawThreadInfo},\n+ lastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ time: number,\n+|};\n+export type ClientEntryInconsistencyReportShape = {|\n+ platformDetails: PlatformDetails,\n+ beforeAction: {[id: string]: RawEntryInfo},\n+ action: BaseAction,\n+ calendarQuery: CalendarQuery,\n+ pollResult: {[id: string]: RawEntryInfo},\n+ pushResult: {[id: string]: RawEntryInfo},\n+ lastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ time: number,\n+|};\n+export type ClientReportCreationRequest =\n+ | ErrorReportCreationRequest\n+ | {| ...ClientThreadInconsistencyReportShape, type: 1 |}\n+ | {| ...EntryInconsistencyReportShape, type: 2 |};\n+\nexport type ReportCreationResponse = {|\nid: string,\n|};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/request-types.js",
"new_path": "lib/types/request-types.js",
"diff": "@@ -24,6 +24,8 @@ import {\nimport type {\nThreadInconsistencyReportShape,\nEntryInconsistencyReportShape,\n+ ClientThreadInconsistencyReportShape,\n+ ClientEntryInconsistencyReportShape,\n} from './report-types';\nimport invariant from 'invariant';\n@@ -139,6 +141,27 @@ export type ClientResponse =\n| CheckStateClientResponse\n| InitialActivityUpdatesClientResponse;\n+// This is just the client variant of ClientResponse. The server needs to handle\n+// multiple client versions so the type supports old versions of certain client\n+// responses, but the client variant only need to support the latest version.\n+export type ClientThreadInconsistencyClientResponse = {|\n+ ...ClientThreadInconsistencyReportShape,\n+ type: 2,\n+|};\n+export type ClientEntryInconsistencyClientResponse = {|\n+ type: 5,\n+ ...ClientEntryInconsistencyReportShape,\n+|};\n+export type ClientClientResponse =\n+ | PlatformClientResponse\n+ | DeviceTokenClientResponse\n+ | ClientThreadInconsistencyClientResponse\n+ | PlatformDetailsClientResponse\n+ | InitialActivityUpdateClientResponse\n+ | ClientEntryInconsistencyClientResponse\n+ | CheckStateClientResponse\n+ | InitialActivityUpdatesClientResponse;\n+\nexport const clientResponsePropType = PropTypes.oneOfType([\nPropTypes.shape({\ntype: PropTypes.oneOf([ serverRequestTypes.PLATFORM ]).isRequired,\n@@ -157,8 +180,8 @@ export const clientResponsePropType = PropTypes.oneOfType([\naction: PropTypes.object.isRequired,\npollResult: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\npushResult: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n- lastActionTypes: PropTypes.arrayOf(PropTypes.string),\n- time: PropTypes.number,\n+ lastActionTypes: PropTypes.arrayOf(PropTypes.string).isRequired,\n+ time: PropTypes.number.isRequired,\n}),\nPropTypes.shape({\ntype: PropTypes.oneOf([ serverRequestTypes.PLATFORM_DETAILS ]).isRequired,\n@@ -196,7 +219,7 @@ export const clientResponsePropType = PropTypes.oneOfType([\nexport const clearDeliveredClientResponsesActionType =\n\"CLEAR_DELIVERED_CLIENT_RESPONSES\";\nexport type ClearDeliveredClientResponsesPayload = {|\n- clientResponses: $ReadOnlyArray<ClientResponse>,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\n|};\nexport const processServerRequestsActionType = \"PROCESS_SERVER_REQUESTS\";\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/socket-types.js",
"new_path": "lib/types/socket-types.js",
"diff": "// @flow\nimport type { SessionState, SessionIdentification } from './session-types';\n-import type { ServerRequest, ClientResponse } from './request-types';\n+import type {\n+ ServerRequest,\n+ ClientResponse,\n+ ClientClientResponse,\n+} from './request-types';\nimport type { RawThreadInfo } from './thread-types';\nimport type {\nMessagesResponse,\n@@ -92,8 +96,31 @@ export type ClientSocketMessage =\n| PingClientSocketMessage\n| AckUpdatesClientSocketMessage\n| APIRequestClientSocketMessage;\n+\n+export type ClientInitialClientSocketMessage = {|\n+ type: 0,\n+ id: number,\n+ payload: {|\n+ sessionIdentification: SessionIdentification,\n+ sessionState: SessionState,\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\n+ |},\n+|};\n+export type ClientResponsesClientSocketMessage = {|\n+ type: 1,\n+ id: number,\n+ payload: {|\n+ clientResponses: $ReadOnlyArray<ClientClientResponse>,\n+ |},\n+|};\n+export type ClientClientSocketMessage =\n+ | ClientInitialClientSocketMessage\n+ | ClientResponsesClientSocketMessage\n+ | PingClientSocketMessage\n+ | AckUpdatesClientSocketMessage\n+ | APIRequestClientSocketMessage;\nexport type ClientSocketMessageWithoutID =\n- $Diff<ClientSocketMessage, { id: number }>;\n+ $Diff<ClientClientSocketMessage, { id: number }>;\n// The types of messages that the server sends across the socket\nexport const serverSocketMessageTypes = Object.freeze({\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/thread-types.js",
"new_path": "lib/types/thread-types.js",
"diff": "@@ -12,7 +12,7 @@ import type {\nRawEntryInfo,\n} from './entry-types';\nimport type { UpdateInfo } from './update-types';\n-import type { ThreadInconsistencyClientResponse } from './request-types';\n+import type { ClientThreadInconsistencyClientResponse } from './request-types';\nimport PropTypes from 'prop-types';\nimport invariant from 'invariant';\n@@ -240,7 +240,8 @@ export type ServerThreadInfo = {|\nexport type ThreadStore = {|\nthreadInfos: {[id: string]: RawThreadInfo},\n- inconsistencyResponses: $ReadOnlyArray<ThreadInconsistencyClientResponse>,\n+ inconsistencyResponses:\n+ $ReadOnlyArray<ClientThreadInconsistencyClientResponse>,\n|};\nexport type ThreadDeletionRequest = {|\n"
},
{
"change_type": "MODIFY",
"old_path": "native/crash.react.js",
"new_path": "native/crash.react.js",
"diff": "// @flow\nimport {\n- type ReportCreationRequest,\n+ type ClientReportCreationRequest,\ntype ReportCreationResponse,\nreportTypes,\n} from 'lib/types/report-types';\n@@ -48,7 +48,7 @@ type Props = {\ndispatchActionPromise: DispatchActionPromise,\n// async functions that hit server APIs\nsendReport: (\n- request: ReportCreationRequest,\n+ request: ClientReportCreationRequest,\n) => Promise<ReportCreationResponse>,\nlogOut: () => Promise<LogOutResult>,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/selectors/socket-selectors.js",
"new_path": "native/selectors/socket-selectors.js",
"diff": "@@ -5,7 +5,10 @@ import type {\nSessionIdentification,\nSessionState,\n} from 'lib/types/session-types';\n-import type { ServerRequest, ClientResponse } from 'lib/types/request-types';\n+import type {\n+ ServerRequest,\n+ ClientClientResponse,\n+} from 'lib/types/request-types';\nimport { createSelector } from 'reselect';\n@@ -40,7 +43,7 @@ const nativeGetClientResponsesSelector = createSelector<*, *, *, *, *>(\ngetClientResponsesFunc: (\ncalendarActive: bool,\nserverRequests: $ReadOnlyArray<ServerRequest>,\n- ) => $ReadOnlyArray<ClientResponse>,\n+ ) => $ReadOnlyArray<ClientClientResponse>,\ncalendarActive: bool,\n) => (serverRequests: $ReadOnlyArray<ServerRequest>) =>\ngetClientResponsesFunc(calendarActive, serverRequests),\n"
},
{
"change_type": "MODIFY",
"old_path": "web/selectors/socket-selectors.js",
"new_path": "web/selectors/socket-selectors.js",
"diff": "@@ -5,7 +5,10 @@ import type {\nSessionIdentification,\nSessionState,\n} from 'lib/types/session-types';\n-import type { ServerRequest, ClientResponse } from 'lib/types/request-types';\n+import type {\n+ ServerRequest,\n+ ClientClientResponse,\n+} from 'lib/types/request-types';\nimport { createSelector } from 'reselect';\n@@ -32,7 +35,7 @@ const webGetClientResponsesSelector = createSelector<*, *, *, *, *>(\ngetClientResponsesFunc: (\ncalendarActive: bool,\nserverRequests: $ReadOnlyArray<ServerRequest>,\n- ) => $ReadOnlyArray<ClientResponse>,\n+ ) => $ReadOnlyArray<ClientClientResponse>,\ncalendarActive: bool,\n) => (serverRequests: $ReadOnlyArray<ServerRequest>) =>\ngetClientResponsesFunc(calendarActive, serverRequests),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Separate out ClientClientResponse and ClientClientSocketMessage
The double-`Client` variants are for the client to use, and only need to support the latest version of the shape. In contrast, the original variants support all versions of the shape, and are for use on the server. |
129,187 | 06.02.2019 14:51:09 | 18,000 | 77c46cd02470c767d03fe117938e2ba1dbc95f60 | lastActionTypes -> lastActions
Introducing `ActionSummary` type for more details when inconsistencies happen. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/flow-typed/npm/util-inspect_vx.x.x.js",
"diff": "+// flow-typed signature: 0f822d4822fa7a5e4d09904196646b58\n+// flow-typed version: <<STUB>>/util-inspect_v^0.1.8/flow_v0.89.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'util-inspect'\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 'util-inspect' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+\n+\n+// Filename aliases\n+declare module 'util-inspect/index' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n+declare module 'util-inspect/index.js' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/package.json",
"new_path": "lib/package.json",
"diff": "\"reselect\": \"^3.0.1\",\n\"string-hash\": \"^1.1.3\",\n\"tokenize-text\": \"^1.1.3\",\n+ \"util-inspect\": \"^0.1.8\",\n\"whatwg-fetch\": \"^2.0.3\"\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/entry-reducer.js",
"new_path": "lib/reducers/entry-reducer.js",
"diff": "@@ -756,7 +756,7 @@ function findInconsistencies(\ncalendarQuery,\npollResult: oldResult,\npushResult: newResult,\n- lastActionTypes: reduxLogger.interestingActionTypes,\n+ lastActions: reduxLogger.interestingActionSummaries,\ntime: Date.now(),\n}];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/thread-reducer.js",
"new_path": "lib/reducers/thread-reducer.js",
"diff": "@@ -128,7 +128,7 @@ function findInconsistencies(\naction: sanitizeAction(action),\npollResult: oldResult,\npushResult: newResult,\n- lastActionTypes: reduxLogger.interestingActionTypes,\n+ lastActions: reduxLogger.interestingActionSummaries,\ntime: Date.now(),\n}];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/report-types.js",
"new_path": "lib/types/report-types.js",
"diff": "@@ -32,6 +32,11 @@ export type FlatErrorData = {|\ncomponentStack?: ?string,\n|};\n+export type ActionSummary = {|\n+ type: $PropertyType<BaseAction, 'type'>,\n+ time: number,\n+ summary: string,\n+|};\nexport type ThreadInconsistencyReportShape = {|\nplatformDetails: PlatformDetails,\nbeforeAction: {[id: string]: RawThreadInfo},\n@@ -39,6 +44,7 @@ export type ThreadInconsistencyReportShape = {|\npollResult: {[id: string]: RawThreadInfo},\npushResult: {[id: string]: RawThreadInfo},\nlastActionTypes?: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ lastActions?: $ReadOnlyArray<ActionSummary>,\ntime?: number,\n|};\nexport type EntryInconsistencyReportShape = {|\n@@ -48,7 +54,8 @@ export type EntryInconsistencyReportShape = {|\ncalendarQuery: CalendarQuery,\npollResult: {[id: string]: RawEntryInfo},\npushResult: {[id: string]: RawEntryInfo},\n- lastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ lastActionTypes?: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ lastActions?: $ReadOnlyArray<ActionSummary>,\ntime: number,\n|};\n@@ -79,7 +86,7 @@ export type ClientThreadInconsistencyReportShape = {|\naction: BaseAction,\npollResult: {[id: string]: RawThreadInfo},\npushResult: {[id: string]: RawThreadInfo},\n- lastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ lastActions: $ReadOnlyArray<ActionSummary>,\ntime: number,\n|};\nexport type ClientEntryInconsistencyReportShape = {|\n@@ -89,7 +96,7 @@ export type ClientEntryInconsistencyReportShape = {|\ncalendarQuery: CalendarQuery,\npollResult: {[id: string]: RawEntryInfo},\npushResult: {[id: string]: RawEntryInfo},\n- lastActionTypes: $ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,\n+ lastActions: $ReadOnlyArray<ActionSummary>,\ntime: number,\n|};\nexport type ClientReportCreationRequest =\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/request-types.js",
"new_path": "lib/types/request-types.js",
"diff": "@@ -162,6 +162,11 @@ export type ClientClientResponse =\n| CheckStateClientResponse\n| InitialActivityUpdatesClientResponse;\n+const actionSummaryPropType = PropTypes.shape({\n+ type: PropTypes.string.isRequired,\n+ time: PropTypes.number.isRequired,\n+ summary: PropTypes.string.isRequired,\n+});\nexport const clientResponsePropType = PropTypes.oneOfType([\nPropTypes.shape({\ntype: PropTypes.oneOf([ serverRequestTypes.PLATFORM ]).isRequired,\n@@ -180,7 +185,7 @@ export const clientResponsePropType = PropTypes.oneOfType([\naction: PropTypes.object.isRequired,\npollResult: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\npushResult: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n- lastActionTypes: PropTypes.arrayOf(PropTypes.string).isRequired,\n+ lastActions: PropTypes.arrayOf(actionSummaryPropType).isRequired,\ntime: PropTypes.number.isRequired,\n}),\nPropTypes.shape({\n@@ -201,7 +206,7 @@ export const clientResponsePropType = PropTypes.oneOfType([\ncalendarQuery: calendarQueryPropType.isRequired,\npollResult: PropTypes.objectOf(rawEntryInfoPropType).isRequired,\npushResult: PropTypes.objectOf(rawEntryInfoPropType).isRequired,\n- lastActionTypes: PropTypes.arrayOf(PropTypes.string).isRequired,\n+ lastActions: PropTypes.arrayOf(actionSummaryPropType).isRequired,\ntime: PropTypes.number.isRequired,\n}),\nPropTypes.shape({\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/redux-logger.js",
"new_path": "lib/utils/redux-logger.js",
"diff": "@@ -5,35 +5,58 @@ import {\ntype BaseAction,\nrehydrateActionType,\n} from '../types/redux-types';\n+import type { ActionSummary } from '../types/report-types';\n+\n+import inspect from 'util-inspect';\nimport { saveDraftActionType } from '../actions/miscellaneous-action-types';\n+import { sanitizeAction } from './sanitization';\nconst uninterestingActionTypes = new Set([\nsaveDraftActionType,\n\"Navigation/COMPLETE_TRANSITION\",\n]);\n+const maxActionSummaryLength = 500;\nclass ReduxLogger {\n- static n = 20;\n+ static n = 30;\nlastNActions = [];\nlastNStates = [];\nget preloadedState(): AppState {\n- return this.lastNStates[0];\n+ return this.lastNStates[0].state;\n}\nget actions(): BaseAction[] {\n- return [...this.lastNActions];\n+ return this.lastNActions.map(({ action }) => action);\n+ }\n+\n+ get interestingActionSummaries(): ActionSummary[] {\n+ return this.lastNActions\n+ .filter(({ action }) => !uninterestingActionTypes.has(action.type))\n+ .map(({ action, time }) => ({\n+ type: action.type,\n+ time,\n+ summary: ReduxLogger.getSummaryForAction(action),\n+ }));\n}\n- get interestingActionTypes(): Array<$PropertyType<BaseAction, 'type'>> {\n- return this.actions\n- .map(action => action.type)\n- .filter(type => !uninterestingActionTypes.has(type));\n+ static getSummaryForAction(action: BaseAction): string {\n+ const sanitized = sanitizeAction(action);\n+ let summary, length, depth = 3;\n+ do {\n+ summary = inspect(action, { depth });\n+ length = summary.length;\n+ depth--;\n+ } while (length > maxActionSummaryLength && depth > 0);\n+ return summary;\n}\naddAction(action: BaseAction, state: AppState) {\n+ const time = Date.now();\n+ const actionWithTime = { action, time };\n+ const stateWithTime = { state, time };\nif (\nthis.lastNActions.length > 0 &&\nthis.lastNActions[this.lastNActions.length - 1].type\n@@ -48,8 +71,8 @@ class ReduxLogger {\nthis.lastNActions.shift();\nthis.lastNStates.shift();\n}\n- this.lastNActions.push(action);\n- this.lastNStates.push(state);\n+ this.lastNActions.push(actionWithTime);\n+ this.lastNStates.push(stateWithTime);\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/flow-typed/npm/util-inspect_vx.x.x.js",
"diff": "+// flow-typed signature: 0f822d4822fa7a5e4d09904196646b58\n+// flow-typed version: <<STUB>>/util-inspect_v^0.1.8/flow_v0.89.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'util-inspect'\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 'util-inspect' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+\n+\n+// Filename aliases\n+declare module 'util-inspect/index' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n+declare module 'util-inspect/index.js' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/flow-typed/npm/util-inspect_vx.x.x.js",
"diff": "+// flow-typed signature: 0f822d4822fa7a5e4d09904196646b58\n+// flow-typed version: <<STUB>>/util-inspect_v^0.1.8/flow_v0.89.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'util-inspect'\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 'util-inspect' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+\n+\n+// Filename aliases\n+declare module 'util-inspect/index' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n+declare module 'util-inspect/index.js' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/report-responders.js",
"new_path": "server/src/responders/report-responders.js",
"diff": "@@ -27,6 +27,11 @@ import {\n} from '../fetchers/report-fetchers';\nimport { newEntryQueryInputValidator } from './entry-responders';\n+const tActionSummary = tShape({\n+ type: t.String,\n+ time: t.Number,\n+ summary: t.String,\n+});\nconst threadInconsistencyReportValidatorShape = {\nplatformDetails: tPlatformDetails,\nbeforeAction: t.Object,\n@@ -34,6 +39,7 @@ const threadInconsistencyReportValidatorShape = {\npollResult: t.Object,\npushResult: t.Object,\nlastActionTypes: t.maybe(t.list(t.String)),\n+ lastActions: t.maybe(t.list(tActionSummary)),\ntime: t.maybe(t.Number),\n};\nconst entryInconsistencyReportValidatorShape = {\n@@ -43,7 +49,8 @@ const entryInconsistencyReportValidatorShape = {\ncalendarQuery: newEntryQueryInputValidator,\npollResult: t.Object,\npushResult: t.Object,\n- lastActionTypes: t.list(t.String),\n+ lastActionTypes: t.maybe(t.list(t.String)),\n+ lastActions: t.maybe(t.list(tActionSummary)),\ntime: t.Number,\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/flow-typed/npm/util-inspect_vx.x.x.js",
"diff": "+// flow-typed signature: 0f822d4822fa7a5e4d09904196646b58\n+// flow-typed version: <<STUB>>/util-inspect_v^0.1.8/flow_v0.89.0\n+\n+/**\n+ * This is an autogenerated libdef stub for:\n+ *\n+ * 'util-inspect'\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 'util-inspect' {\n+ declare module.exports: any;\n+}\n+\n+/**\n+ * We include stubs for each file inside this npm package in case you need to\n+ * require those files directly. Feel free to delete any files that aren't\n+ * needed.\n+ */\n+\n+\n+// Filename aliases\n+declare module 'util-inspect/index' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n+declare module 'util-inspect/index.js' {\n+ declare module.exports: $Exports<'util-inspect'>;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -1936,12 +1936,12 @@ array-flatten@^2.1.0:\nresolved \"https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.1.tgz#426bb9da84090c1838d812c8150af20a8331e296\"\nintegrity sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=\n-array-map@~0.0.0:\n+array-map@0.0.0, array-map@~0.0.0:\nversion \"0.0.0\"\nresolved \"https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662\"\nintegrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=\n-array-reduce@~0.0.0:\n+array-reduce@0.0.0, array-reduce@~0.0.0:\nversion \"0.0.0\"\nresolved \"https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b\"\nintegrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=\n@@ -5039,6 +5039,11 @@ for-own@^0.1.4:\ndependencies:\nfor-in \"^1.0.1\"\n+foreach@2.0.4:\n+ version \"2.0.4\"\n+ resolved \"https://registry.yarnpkg.com/foreach/-/foreach-2.0.4.tgz#cc5d0d8ae1d46cc9a555c2682f910977859935df\"\n+ integrity sha1-zF0NiuHUbMmlVcJoL5EJd4WZNd8=\n+\nforever-agent@~0.6.1:\nversion \"0.6.1\"\nresolved \"https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91\"\n@@ -7235,6 +7240,11 @@ json-stringify-safe@~5.0.1:\nresolved \"https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb\"\nintegrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=\n+json3@3.3.0:\n+ version \"3.3.0\"\n+ resolved \"https://registry.yarnpkg.com/json3/-/json3-3.3.0.tgz#0e9e7f6c5d270b758929af4d6fefdc84bd66e259\"\n+ integrity sha1-Dp5/bF0nC3WJKa9Nb+/chL1m4lk=\n+\njson3@^3.3.2:\nversion \"3.3.2\"\nresolved \"https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1\"\n@@ -8752,6 +8762,11 @@ object-copy@^0.1.0:\ndefine-property \"^0.2.5\"\nkind-of \"^3.0.3\"\n+object-keys@0.5.0:\n+ version \"0.5.0\"\n+ resolved \"https://registry.yarnpkg.com/object-keys/-/object-keys-0.5.0.tgz#09e211f3e00318afc4f592e36e7cdc10d9ad7293\"\n+ integrity sha1-CeIR8+ADGK/E9ZLjbnzcENmtcpM=\n+\nobject-keys@^1.0.12:\nversion \"1.0.12\"\nresolved \"https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2\"\n@@ -12757,6 +12772,19 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1:\nresolved \"https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf\"\nintegrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=\n+util-inspect@^0.1.8:\n+ version \"0.1.8\"\n+ resolved \"https://registry.yarnpkg.com/util-inspect/-/util-inspect-0.1.8.tgz#2b39dbcd2d921f2d8430923caff40f4b5cea5db1\"\n+ integrity sha1-KznbzS2SHy2EMJI8r/QPS1zqXbE=\n+ dependencies:\n+ array-map \"0.0.0\"\n+ array-reduce \"0.0.0\"\n+ foreach \"2.0.4\"\n+ indexof \"0.0.1\"\n+ isarray \"0.0.1\"\n+ json3 \"3.3.0\"\n+ object-keys \"0.5.0\"\n+\nutil.promisify@^1.0.0, util.promisify@~1.0.0:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | lastActionTypes -> lastActions
Introducing `ActionSummary` type for more details when inconsistencies happen. |
129,187 | 06.02.2019 19:05:40 | 18,000 | 2067c45dad98aa148cef677dcbe6569e741c733c | [lib] Don't attempt second initial message if first attempt throws SocketOffline | [
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -55,7 +55,11 @@ import { socketAuthErrorResolutionAttempt } from '../actions/user-actions';\nimport { ServerError } from '../utils/errors';\nimport { pingFrequency, serverRequestSocketTimeout } from '../shared/timeouts';\nimport { promiseAll } from '../utils/promises';\n-import { InflightRequests, SocketTimeout } from './inflight-requests';\n+import {\n+ InflightRequests,\n+ SocketTimeout,\n+ SocketOffline,\n+} from './inflight-requests';\nimport APIRequestHandler from './api-request-handler.react';\nimport ActivityHandler from './activity-handler.react';\nimport RequestResponseHandler from './request-response-handler.react';\n@@ -580,6 +584,7 @@ class Socket extends React.PureComponent<Props, State> {\nconst { status } = this.props.connection;\nif (\ne instanceof SocketTimeout ||\n+ e instanceof SocketOffline ||\n(status !== \"connecting\" && status !== \"reconnecting\")\n) {\n// This indicates that the socket will be closed. Do nothing, since the\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Don't attempt second initial message if first attempt throws SocketOffline |
129,187 | 06.02.2019 19:06:12 | 18,000 | 82101b0e7dd1e61eb500803f4ea97a9126ea10a9 | [lib] Don't attempt reconnect if an invalidation recovery is in progress
The invalidation recovery will cause a cookie change eventually, which will lead to a reconnect (unless the user is logged out). | [
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -128,6 +128,7 @@ class Socket extends React.PureComponent<Props, State> {\nmessageLastReceived: ?number;\ninitialPlatformDetailsSent = getConfig().platformDetails === \"web\";\nreopenConnectionAfterClosing = false;\n+ invalidationRecoveryInProgress = false;\nconstructor(props: Props) {\nsuper(props);\n@@ -288,7 +289,8 @@ class Socket extends React.PureComponent<Props, State> {\n} else if (\nthis.props.active &&\nthis.props.connection.status === \"disconnected\" &&\n- prevProps.connection.status !== \"disconnected\"\n+ prevProps.connection.status !== \"disconnected\" &&\n+ !this.invalidationRecoveryInProgress\n) {\nthis.reconnect();\n}\n@@ -409,6 +411,7 @@ class Socket extends React.PureComponent<Props, State> {\n} else if (message.type === serverSocketMessageTypes.AUTH_ERROR) {\nconst { sessionChange } = message;\nconst cookie = sessionChange ? sessionChange.cookie : this.props.cookie;\n+ this.invalidationRecoveryInProgress = true;\nconst recoverySessionChange = await fetchNewCookieFromNativeCredentials(\nthis.props.dispatch,\n@@ -434,6 +437,7 @@ class Socket extends React.PureComponent<Props, State> {\nthis.props.logOut(),\n);\n}\n+ this.invalidationRecoveryInProgress = false;\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Don't attempt reconnect if an invalidation recovery is in progress
The invalidation recovery will cause a cookie change eventually, which will lead to a reconnect (unless the user is logged out). |
129,187 | 06.02.2019 19:10:02 | 18,000 | e2abfc3e0236abd3e477e6abbcaa76ed0fad0c7f | [lib] Don't re-set connection status to disconnected in finishClosingSocket | [
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -244,10 +244,12 @@ class Socket extends React.PureComponent<Props, State> {\n}\nthis.socket = null;\nthis.stopPing();\n+ if (this.props.connection.status !== \"disconnected\") {\nthis.props.dispatchActionPayload(\nupdateConnectionStatusActionType,\n{ status: \"disconnected\" },\n);\n+ }\nthis.setState({ inflightRequests: null });\nif (this.reopenConnectionAfterClosing) {\nthis.reopenConnectionAfterClosing = false;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Don't re-set connection status to disconnected in finishClosingSocket |
129,187 | 06.02.2019 19:10:59 | 18,000 | d7d149b36d77db8a8aabc74a802359a129eca362 | [native] Wait until REHYDRATE concluded before setting device token | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -100,6 +100,7 @@ type NativeDispatch = Dispatch & ((action: NavigationAction) => boolean);\ntype Props = {\n// Redux state\n+ rehydrateConcluded: bool,\nnavigationState: NavigationState,\nactiveThread: ?string,\nappLoggedIn: bool,\n@@ -123,6 +124,7 @@ type Props = {\nclass AppWithNavigationState extends React.PureComponent<Props> {\nstatic propTypes = {\n+ rehydrateConcluded: PropTypes.bool.isRequired,\nnavigationState: PropTypes.object.isRequired,\nactiveThread: PropTypes.string,\nappLoggedIn: PropTypes.bool.isRequired,\n@@ -157,6 +159,13 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nNativeAppState.addEventListener('change', this.handleAppStateChange);\nthis.handleInitialURL();\nLinking.addEventListener('url', this.handleURLChange);\n+ if (this.props.rehydrateConcluded) {\n+ this.onReduxRehydrate();\n+ }\n+ }\n+\n+ onReduxRehydrate() {\n+ this.onForeground();\nif (Platform.OS === \"ios\") {\nNotificationsIOS.addEventListener(\n\"remoteNotificationsRegistered\",\n@@ -190,7 +199,6 @@ class AppWithNavigationState extends React.PureComponent<Props> {\nthis.registerPushPermissionsAndHandleInitialNotif,\n);\n}\n- this.onForeground();\n}\nonForeground() {\n@@ -338,7 +346,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\ncomponentDidUpdate(prevProps: Props) {\n- if (\n+ if (this.props.rehydrateConcluded && !prevProps.rehydrateConcluded) {\n+ this.onReduxRehydrate();\n+ } else if (\n(this.props.appLoggedIn && !prevProps.appLoggedIn) ||\n(!this.props.deviceToken && prevProps.deviceToken)\n) {\n@@ -680,6 +690,7 @@ const ConnectedAppWithNavigationState = connect(\n(state: AppState) => {\nconst appLoggedIn = appLoggedInSelector(state);\nreturn {\n+ rehydrateConcluded: state._persist && state._persist.rehydrated,\nnavigationState: state.navInfo.navigationState,\nactiveThread: activeThreadSelector(state),\nappLoggedIn,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Wait until REHYDRATE concluded before setting device token |
129,187 | 08.02.2019 09:56:46 | 18,000 | f33655e1f6cee527b729146e4b605635586b74f9 | [lib] On Socket reconnect re-send current activity | [
{
"change_type": "MODIFY",
"old_path": "lib/socket/activity-handler.react.js",
"new_path": "lib/socket/activity-handler.react.js",
"diff": "@@ -66,6 +66,23 @@ class ActivityHandler extends React.PureComponent<Props> {\n}\n}\n+ const { status } = this.props.connection;\n+ const prevStatus = prevProps.connection.status;\n+ if (\n+ status !== \"connected\" &&\n+ prevStatus === \"connected\" &&\n+ this.props.activeThread\n+ ) {\n+ // When the server closes a socket it also deletes any activity rows\n+ // associated with that socket's session. If that activity is still\n+ // ongoing, we should make sure that we clarify that with the server once\n+ // we reconnect.\n+ activityUpdates.push({\n+ focus: true,\n+ threadID: this.props.activeThread,\n+ });\n+ }\n+\nif (activityUpdates.length > 0) {\nthis.props.dispatchActionPayload(\nqueueActivityUpdatesActionType,\n@@ -73,11 +90,11 @@ class ActivityHandler extends React.PureComponent<Props> {\n);\n}\n- if (this.props.connection.status !== \"connected\") {\n+ if (status !== \"connected\") {\nreturn;\n}\n- if (prevProps.connection.status !== \"connected\") {\n+ if (prevStatus !== \"connected\") {\nconst { queuedActivityUpdates } = this.props.connection;\nthis.sendActivityUpdates(\n[ ...queuedActivityUpdates, ...activityUpdates ],\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] On Socket reconnect re-send current activity |
129,187 | 08.02.2019 09:57:20 | 18,000 | 5fce8e81050b1425efc5d4f6879c9e35df41743e | [lib] detectUnsupervisedBackground only counts when first action in a while
We want to prevent it from firing after `FOREGROUND` | [
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -69,6 +69,7 @@ import CalendarQueryHandler from './calendar-query-handler.react';\nimport { logOutActionTypes } from '../actions/user-actions';\nimport { updateActivityActionTypes } from '../actions/activity-actions';\nimport { unsupervisedBackgroundActionType } from '../reducers/foreground-reducer';\n+import { reduxLogger } from '../utils/redux-logger';\ntype Props = {|\ndetectUnsupervisedBackgroundRef?: (\n@@ -682,7 +683,9 @@ class Socket extends React.PureComponent<Props, State> {\nif (\nthis.props.connection.status !== \"connected\" ||\n!this.messageLastReceived ||\n- this.messageLastReceived + serverRequestSocketTimeout >= Date.now()\n+ this.messageLastReceived + serverRequestSocketTimeout >= Date.now() ||\n+ (reduxLogger.mostRecentActionTime &&\n+ reduxLogger.mostRecentActionTime + 3000 < Date.now())\n) {\nreturn false;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/redux-logger.js",
"new_path": "lib/utils/redux-logger.js",
"diff": "@@ -75,6 +75,13 @@ class ReduxLogger {\nthis.lastNStates.push(stateWithTime);\n}\n+ get mostRecentActionTime(): ?number {\n+ if (this.lastNActions.length === 0) {\n+ return null;\n+ }\n+ return this.lastNActions[this.lastNActions.length - 1].time;\n+ }\n+\n}\nconst reduxLogger = new ReduxLogger();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] detectUnsupervisedBackground only counts when first action in a while
We want to prevent it from firing after `FOREGROUND` |
129,187 | 08.02.2019 09:59:22 | 18,000 | 88b69bf8ce64f41d97a014ee7b6679d10450318c | [native] Use detectUnsupervisedBackground when receiving notif on Android too | [
{
"change_type": "MODIFY",
"old_path": "native/app.react.js",
"new_path": "native/app.react.js",
"diff": "@@ -624,6 +624,9 @@ class AppWithNavigationState extends React.PureComponent<Props> {\n}\n// We are here because notif was received, but hasn't been pressed yet\n+ if (this.detectUnsupervisedBackground) {\n+ this.detectUnsupervisedBackground(false);\n+ }\nthis.saveMessageInfos(customNotification.messageInfos);\nif (this.currentState === \"active\") {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Use detectUnsupervisedBackground when receiving notif on Android too |
129,187 | 08.02.2019 12:22:46 | 18,000 | 9b2165448420d111746dd5ad5e93ae259c4dcf7a | codeVersion -> 27 | [
{
"change_type": "MODIFY",
"old_path": "lib/facts/version.json",
"new_path": "lib/facts/version.json",
"diff": "{\n- \"currentCodeVersion\": 26\n+ \"currentCodeVersion\": 27\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -110,8 +110,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 26\n- versionName \"0.0.26\"\n+ versionCode 27\n+ versionName \"0.0.27\"\n}\nsplits {\nabi {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.26</string>\n+ <string>0.0.27</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>26</string>\n+ <string>27</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | codeVersion -> 27 |
129,187 | 08.02.2019 17:26:45 | 18,000 | 37e6a18c0d452e15f5ad9fc39cb5ff47570e0358 | [server] <!DOCTYPE html> | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -195,6 +195,7 @@ async function websiteResponder(viewer: Viewer, url: string): Promise<string> {\nhref=\"compiled/${assets.browser.css}\"\n/>`;\nlet result = html`\n+ <!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] <!DOCTYPE html> |
129,187 | 08.02.2019 18:09:54 | 18,000 | 5085a70146aa1c6f1ac113d963e79c05bad027ca | [web] Use rgba() instead of 8-digit hex
8-digit hex doesn't work with IE | [
{
"change_type": "MODIFY",
"old_path": "web/calendar/calendar.react.js",
"new_path": "web/calendar/calendar.react.js",
"diff": "@@ -174,7 +174,7 @@ class Calendar extends React.PureComponent<Props, State> {\nif (this.state.filterPanelOpen) {\nfilterPanel = <FilterPanel setModal={this.props.setModal} />;\ncalendarContentStyle = { marginLeft: \"300px\" };\n- filterButtonStyle = { backgroundColor: \"#000000AA\" };\n+ filterButtonStyle = { backgroundColor: \"rgba(0,0,0,0.67)\" };\n}\nreturn (\n"
},
{
"change_type": "MODIFY",
"old_path": "web/calendar/filter-panel.css",
"new_path": "web/calendar/filter-panel.css",
"diff": "@@ -11,7 +11,7 @@ div.container {\n}\ndiv.filters {\ncolor: #DDDDDD;\n- background-color: #000000E4;\n+ background-color: rgba(0,0,0,0.89);\noverflow-y: auto;\nheight: 100%;\n}\n@@ -102,13 +102,13 @@ div.optionDetails {\n}\ndiv.searchContainer {\npadding: 8px 10px;\n- background-color: #000000E4;\n+ background-color: rgba(0,0,0,0.89);\n}\ndiv.search {\ndisplay: flex;\nborder-radius: 5px;\npadding: 5px;\n- background-color: #FFFFFF44;\n+ background-color: rgba(255,255,255,0.27);\nalign-items: center;\n}\nsvg.searchVector {\n@@ -159,7 +159,7 @@ div.category {\nmargin: 5px 18px 8px 18px;\n}\ndiv.extras {\n- background-color: #000000E4;\n+ background-color: rgba(0,0,0,0.89);\ncolor: #DDDDDD;\npadding: 8px 20px;\nfont-size: 14px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -269,7 +269,7 @@ span.preview > span.previewImage > svg.removeUpload {\ncolor: white;\nborder-radius: 50%;\nbox-shadow: inset 0px 0px 5px rgba(0,0,0,0.5);\n- background-color: #222222AA;\n+ background-color: rgba(34,34,34,0.67);\n}\nspan.preview:hover > span.previewImage > svg.removeUpload {\ndisplay: inherit;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/text-message.react.js",
"new_path": "web/chat/text-message.react.js",
"diff": "@@ -80,7 +80,7 @@ class TextMessage extends React.PureComponent<Props> {\nmessageStyle.backgroundColor = `#${threadColor}`;\nmessageStyle.color = darkColor ? 'white' : 'black';\n} else {\n- messageStyle.backgroundColor = \"#DDDDDDBB\";\n+ messageStyle.backgroundColor = \"rgba(221,221,221,0.73)\";\nmessageStyle.color = 'black';\n}\nlet authorName = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -86,7 +86,7 @@ ul.nav-bar > li.current-tab > div > a {\ncolor: #444444;\n}\nul.nav-bar > li.current-tab > div {\n- background-color: #FFFFFFD5;\n+ background-color: rgba(255,255,255,0.84);\npadding: 18px 20px 19px 20px;\nheight: 25px;\n}\n@@ -112,7 +112,7 @@ div.main-content-container {\nposition: relative;\n}\ndiv.main-content {\n- background-color: #FFFFFFD5;\n+ background-color: rgba(255,255,255,0.84);\nmin-height: 100%;\noverflow-x: hidden;\n}\n@@ -359,7 +359,7 @@ a.calendar-filters-button {\nfont-weight: 600;\nfloat: left;\ncolor: white;\n- background-color: #444455AA;\n+ background-color: rgba(68,68,85,0.67);\npadding: 8px 18px;\nborder-radius: 18px;\nmargin: 0 15px 5px 15px;\n@@ -443,7 +443,7 @@ div.modal {\nposition: relative;\nbox-shadow: 0 4px 20px rgba(0, 0, 0, .3),\n0 0 0 1px rgba(0, 0, 0, .1);\n- background-color: #FFFFFFB5;\n+ background-color: rgba(255,255,255,0.71);\nborder-radius: 15px;\n}\nspan.modal-close {\n@@ -1142,7 +1142,7 @@ div.splash-bottom {\nflex-direction: column;\n}\ndiv.splash-header-rest {\n- background-color: #FFFFFFD5;\n+ background-color: rgba(255,255,255,0.84);\nflex-grow: 1;\n}\ndiv.splash-header-overscroll {\n@@ -1187,7 +1187,7 @@ input.splash-request-access-email {\npadding: 10px 10px 8px 10px;\nfont-size: 18px;\nborder-radius: 5px;\n- background-color: #77777722;\n+ background-color: rgba(119,119,119,0.13);\ncolor: black;\n}\ninput.splash-request-access-email::placeholder,\n@@ -1199,7 +1199,7 @@ button.splash-request-access-submit {\npadding: 10px 10px 8px 10px;\nfont-size: 18px;\nborder-radius: 5px;\n- background-color: #00AA0088;\n+ background-color: rgba(0,170,0,0.53);\ncolor: white;\nmargin-left: 15px;\ncursor: pointer;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use rgba() instead of 8-digit hex
8-digit hex doesn't work with IE |
129,187 | 08.02.2019 18:11:05 | 18,000 | 68125d96fdad876d77827fb232af2fada9a74a19 | [web] Use flexbox for arranging main content | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-thread-list.css",
"new_path": "web/chat/chat-thread-list.css",
"diff": "div.container {\n- position: fixed;\n+ position: absolute;\nwidth: 400px;\n- top: 62px;\n+ top: 0;\nbottom: 0;\noverflow-y: auto;\nbackground-color: white;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.react.js",
"new_path": "web/splash/splash.react.js",
"diff": "@@ -97,7 +97,7 @@ class Splash extends React.PureComponent<Props, State> {\n);\n}\nreturn (\n- <div className={css['splash-container']}>\n+ <React.Fragment>\n<div className={css['splash-header-container']}>\n<div className={css['splash-top']}>\n<header className={css['splash-header']}>\n@@ -193,7 +193,7 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n</div>\n{this.props.currentModal}\n- </div>\n+ </React.Fragment>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "padding: 0;\nmargin: 0;\n}\n+html {\n+ height: 100%;\n+}\nbody {\nfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\",\n\"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\",\n@@ -9,7 +12,8 @@ body {\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n- margin-top: 62px;\n+ height: 100%;\n+ overflow: hidden;\n}\na {\ntext-decoration: none;\n@@ -34,17 +38,17 @@ input[type='submit']::-moz-focus-inner {\nborder: 0;\npadding: 0;\n}\n+:global(#react-root) {\n+ display: flex;\n+ flex-direction: column;\n+ height: 100%;\n+}\nheader.header {\n- position: fixed;\n- top: 0;\n- width: 100%;\n+ flex: 0 1 auto;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n- z-index: 2;\n- display: flex;\n- flex-direction: column;\n}\ndiv.main-header {\nfont-family: 'Anaheim', sans-serif;\n@@ -108,12 +112,13 @@ div.chatBadge {\n}\ndiv.main-content-container {\n- height: 100%;\n+ flex: 1 0 0;\nposition: relative;\n+ min-height: 0;\n}\ndiv.main-content {\nbackground-color: rgba(255,255,255,0.84);\n- min-height: 100%;\n+ height: 100%;\noverflow-x: hidden;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use flexbox for arranging main content |
129,187 | 08.02.2019 18:17:12 | 18,000 | 5d051f71e021ed01d7cdff8e3fc014d27e4e7657 | [web] Move splash CSS to separate file | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/splash/splash.css",
"diff": "+div.header-container {\n+ position: fixed;\n+ top: 0;\n+ left: 0;\n+ right: 0;\n+ height: 61px;\n+ z-index: 3;\n+ background-image: url(../images/background.png);\n+ background-size: 3000px 2000px;\n+ background-attachment: fixed;\n+ padding: 0 10px;\n+}\n+div.top-container {\n+ position: fixed;\n+ top: 0;\n+ left: 0;\n+ right: 0;\n+ height: 100%;\n+ background-image: url(../images/background.png);\n+ background-size: 3000px 2000px;\n+ background-repeat-y: repeat;\n+ padding-top: 61px;\n+}\n+div.top {\n+ max-width: 1024px;\n+ margin: 0 auto;\n+}\n+div.header-contents {\n+ display: flex;\n+ justify-content: space-between;\n+ align-items: center;\n+ padding-top: 5px;\n+ padding-bottom: 7px;\n+}\n+div.action-links > * {\n+ padding-right: 15px;\n+ color: white;\n+ font-weight: 300;\n+}\n+div.action-links > *:last-child {\n+ padding-right: 0;\n+}\n+header.header h1 {\n+ font-family: 'Anaheim', sans-serif;\n+ color: white;\n+ font-size: 38px;\n+}\n+header.header span.request-access {\n+ padding: 10px 20px;\n+ border-radius: 20px;\n+ border: 1px solid white;\n+}\n+div.body {\n+ padding: 30px 0 20px 0;\n+}\n+div.intro {\n+ text-align: center;\n+ margin-bottom: 50px;\n+}\n+p.intro-header {\n+ color: white;\n+ font-size: 28px;\n+ font-weight: 300;\n+}\n+p.intro-description {\n+ color: white;\n+ font-size: 21px;\n+ font-weight: 300;\n+ padding-top: 5px;\n+}\n+div.devices {\n+ display: flex;\n+ justify-content: space-evenly;\n+}\n+div.bottom-container {\n+ z-index: 2;\n+ flex-grow: 1;\n+}\n+div.bottom {\n+ margin-top: 728px;\n+ background-image: url(../images/background.png);\n+ background-size: 3000px 2000px;\n+ background-attachment: fixed;\n+ min-height: 100%;\n+ display: flex;\n+ flex-direction: column;\n+}\n+div.header-rest {\n+ background-color: rgba(255,255,255,0.84);\n+ flex-grow: 1;\n+}\n+div.header-overscroll {\n+ position: fixed;\n+ top: 100%;\n+ left: 0;\n+ right: 0;\n+ height: 1000px;\n+ background-color: white;\n+}\n+div.prompt {\n+ margin: 0 auto;\n+ display: flex;\n+ flex-direction: column;\n+ align-items: center;\n+}\n+p.prompt-header {\n+ color: #282828;\n+ font-size: 21px;\n+ padding-top: 25px;\n+ text-align: center;\n+}\n+p.prompt-description {\n+ color: #282828;\n+ font-size: 18px;\n+ padding-top: 9px;\n+ text-align: center;\n+}\n+div.request-access-container {\n+ margin: 25px;\n+ display: flex;\n+ flex-direction: column;\n+ align-items: center;\n+}\n+form.request-access-form {\n+ display: flex;\n+ align-items: center;\n+}\n+input.request-access-email {\n+ width: 300px;\n+ border: 0;\n+ padding: 10px 10px 8px 10px;\n+ font-size: 18px;\n+ border-radius: 5px;\n+ background-color: rgba(119,119,119,0.13);\n+ color: black;\n+}\n+input.request-access-email::placeholder,\n+input.request-access-email::-ms-input-placeholder {\n+ color: #777777;\n+}\n+button.request-access-submit {\n+ border: 0px;\n+ padding: 10px 10px 8px 10px;\n+ font-size: 18px;\n+ border-radius: 5px;\n+ background-color: rgba(0,170,0,0.53);\n+ color: white;\n+ margin-left: 15px;\n+ cursor: pointer;\n+ width: 78px;\n+ height: 39px;\n+}\n+p.android-warning {\n+ font-size: 14px;\n+ padding: 5px;\n+}\n+p.request-access-error {\n+ font-size: 14px;\n+ padding: 10px;\n+ text-align: center;\n+ color: red;\n+}\n+p.request-access-success {\n+ font-size: 18px;\n+ padding: 20px;\n+ text-align: center;\n+}\n+\n+div.custom-select {\n+ position: relative;\n+ display: block;\n+ border: 1px solid #bbb;\n+ border-radius: .3em;\n+ background-color: #f5f5f5;\n+ margin-left: 15px;\n+}\n+div.custom-select::after {\n+ content: \" \";\n+ position: absolute;\n+ top: 50%;\n+ right: 1em;\n+ z-index: 2;\n+ pointer-events: none;\n+ display: none;\n+ width: 0;\n+ height: 0;\n+ border-left: 4px solid transparent;\n+ border-right: 4px solid transparent;\n+ border-top: 7px solid #666;\n+ margin-top: -3px;\n+}\n+div.custom-select select {\n+ width: 100%;\n+ margin: 0;\n+ outline: none;\n+ padding: .6em .8em .5em .8em;\n+ -webkit-box-sizing: border-box;\n+ -moz-box-sizing: border-box;\n+ box-sizing: border-box;\n+ font-size: 16px;\n+ font-family: sans-serif;\n+ color: #444;\n+ border-radius: .2em;\n+}\n+div.custom-select select:focus {\n+ color: #222;\n+ outline: none;\n+}\n+@supports (-webkit-appearance: none)\n+ or (appearance: none)\n+ or ((-moz-appearance: none) and (mask-type: alpha)) {\n+\n+ div.custom-select::after {\n+ display: block;\n+ }\n+ div.custom-select select {\n+ padding-right: 2em;\n+ background: none;\n+ border: 1px solid transparent;\n+ -webkit-appearance: none;\n+ -moz-appearance: none;\n+ appearance: none;\n+ }\n+ div.custom-select select:focus {\n+ border-color: #aaa;\n+ }\n+}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.react.js",
"new_path": "web/splash/splash.react.js",
"diff": "@@ -21,7 +21,7 @@ import {\n} from 'lib/actions/user-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import css from '../style.css';\n+import css from './splash.css';\nimport LoadingIndicator from '../loading-indicator.react';\nimport LogInModal from '../modals/account/log-in-modal.react';\n@@ -68,7 +68,7 @@ class Splash extends React.PureComponent<Props, State> {\nlet androidWarning = null;\nif (this.state.platform === \"android\") {\nandroidWarning = (\n- <p className={css['splash-android-warning']}>\n+ <p className={css['android-warning']}>\nMake sure this is the email you use to log in to the Google Play\nStore!\n</p>\n@@ -77,7 +77,7 @@ class Splash extends React.PureComponent<Props, State> {\nlet error = null\nif (this.state.error) {\nerror = (\n- <p className={css['splash-request-access-error']}>\n+ <p className={css['request-access-error']}>\n{this.state.error}\n</p>\n);\n@@ -85,7 +85,7 @@ class Splash extends React.PureComponent<Props, State> {\nlet success = null\nif (this.state.success) {\nsuccess = (\n- <p className={css['splash-request-access-success']}>\n+ <p className={css['request-access-success']}>\n{this.state.success}\n</p>\n);\n@@ -98,12 +98,12 @@ class Splash extends React.PureComponent<Props, State> {\n}\nreturn (\n<React.Fragment>\n- <div className={css['splash-header-container']}>\n- <div className={css['splash-top']}>\n- <header className={css['splash-header']}>\n- <div className={css['splash-header-contents']}>\n+ <div className={css['header-container']}>\n+ <div className={css['top']}>\n+ <header className={css['header']}>\n+ <div className={css['header-contents']}>\n<h1>SquadCal</h1>\n- <div className={css['splash-action-links']}>\n+ <div className={css['action-links']}>\n<a href=\"#\" onClick={this.onClickRequestAccess}>\n<span className={css['request-access']}>\nRequest access\n@@ -119,18 +119,18 @@ class Splash extends React.PureComponent<Props, State> {\n</header>\n</div>\n</div>\n- <div className={css['splash-top-container']}>\n- <div className={css['splash-top']}>\n- <div className={css['splash-body']}>\n- <div className={css['splash-intro']}>\n- <p className={css['splash-intro-header']}>\n+ <div className={css['top-container']}>\n+ <div className={css['top']}>\n+ <div className={css['body']}>\n+ <div className={css['intro']}>\n+ <p className={css['intro-header']}>\nSquadCal is a chat app with an integrated calendar.\n</p>\n- <p className={css['splash-intro-description']}>\n+ <p className={css['intro-description']}>\nWe make it incredibly easy to plan events with your friends.\n</p>\n</div>\n- <div className={css['splash-devices']}>\n+ <div className={css['devices']}>\n<img\nsrc=\"images/ios_screenshot.png\"\nsrcSet=\"images/ios_screenshot@2x.png 526w\"\n@@ -147,25 +147,25 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n</div>\n</div>\n- <div className={css['splash-bottom-container']}>\n- <div className={css['splash-bottom']}>\n- <div className={css['splash-header-rest']}>\n- <div className={css['splash-prompt']}>\n- <p className={css['splash-prompt-header']}>\n+ <div className={css['bottom-container']}>\n+ <div className={css['bottom']}>\n+ <div className={css['header-rest']}>\n+ <div className={css['prompt']}>\n+ <p className={css['prompt-header']}>\nWe're currently alpha testing the first version of our app.\n</p>\n- <p className={css['splash-prompt-description']}>\n+ <p className={css['prompt-description']}>\nIf you'd like to try it out, please let us know!\n</p>\n- <div className={css['splash-request-access-container']}>\n+ <div className={css['request-access-container']}>\n<div>\n- <form className={css['splash-request-access-form']}>\n+ <form className={css['request-access-form']}>\n<input\ntype=\"text\"\nvalue={this.state.email}\nonChange={this.onChangeEmail}\nplaceholder=\"Email address\"\n- className={css['splash-request-access-email']}\n+ className={css['request-access-email']}\nref={this.emailInputRef}\n/>\n<div className={css['custom-select']}>\n@@ -176,7 +176,7 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n<button\ntype=\"submit\"\n- className={css['splash-request-access-submit']}\n+ className={css['request-access-submit']}\nonClick={this.onSubmitRequestAccess}\n>\n{submitButtonContent}\n@@ -189,7 +189,7 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n</div>\n</div>\n- <div className={css['splash-header-overscroll']} />\n+ <div className={css['header-overscroll']} />\n</div>\n</div>\n{this.props.currentModal}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -1052,241 +1052,6 @@ div.intro-modal {\nbox-shadow: 2px 3px 6px 0px rgba(0, 0, 0, 0.1);\n}\n-div.splash-container {\n- top: 0;\n- width: 100%;\n- min-height: 100%;\n- display: flex;\n- flex-direction: column;\n-}\n-div.splash-header-container {\n- position: fixed;\n- top: 0;\n- left: 0;\n- right: 0;\n- height: 61px;\n- z-index: 3;\n- background-image: url(../images/background.png);\n- background-size: 3000px 2000px;\n- background-attachment: fixed;\n- padding: 0 10px;\n-}\n-div.splash-top-container {\n- position: fixed;\n- top: 0;\n- left: 0;\n- right: 0;\n- height: 100%;\n- background-image: url(../images/background.png);\n- background-size: 3000px 2000px;\n- background-repeat-y: repeat;\n- padding-top: 61px;\n-}\n-div.splash-top {\n- max-width: 1024px;\n- margin: 0 auto;\n-}\n-div.splash-header-contents {\n- display: flex;\n- justify-content: space-between;\n- align-items: center;\n- padding-top: 5px;\n- padding-bottom: 7px;\n-}\n-div.splash-action-links > * {\n- padding-right: 15px;\n- color: white;\n- font-weight: 300;\n-}\n-div.splash-action-links > *:last-child {\n- padding-right: 0;\n-}\n-header.splash-header h1 {\n- font-family: 'Anaheim', sans-serif;\n- color: white;\n- font-size: 38px;\n-}\n-header.splash-header span.request-access {\n- padding: 10px 20px;\n- border-radius: 20px;\n- border: 1px solid white;\n-}\n-div.splash-body {\n- padding: 30px 0 20px 0;\n-}\n-div.splash-intro {\n- text-align: center;\n- margin-bottom: 50px;\n-}\n-p.splash-intro-header {\n- color: white;\n- font-size: 28px;\n- font-weight: 300;\n-}\n-p.splash-intro-description {\n- color: white;\n- font-size: 21px;\n- font-weight: 300;\n- padding-top: 5px;\n-}\n-div.splash-devices {\n- display: flex;\n- justify-content: space-evenly;\n-}\n-div.splash-bottom-container {\n- z-index: 2;\n- flex-grow: 1;\n-}\n-div.splash-bottom {\n- margin-top: 728px;\n- background-image: url(../images/background.png);\n- background-size: 3000px 2000px;\n- background-attachment: fixed;\n- min-height: 100%;\n- display: flex;\n- flex-direction: column;\n-}\n-div.splash-header-rest {\n- background-color: rgba(255,255,255,0.84);\n- flex-grow: 1;\n-}\n-div.splash-header-overscroll {\n- position: fixed;\n- top: 100%;\n- left: 0;\n- right: 0;\n- height: 1000px;\n- background-color: white;\n-}\n-div.splash-prompt {\n- margin: 0 auto;\n- display: flex;\n- flex-direction: column;\n- align-items: center;\n-}\n-p.splash-prompt-header {\n- color: #282828;\n- font-size: 21px;\n- padding-top: 25px;\n- text-align: center;\n-}\n-p.splash-prompt-description {\n- color: #282828;\n- font-size: 18px;\n- padding-top: 9px;\n- text-align: center;\n-}\n-div.splash-request-access-container {\n- margin: 25px;\n- display: flex;\n- flex-direction: column;\n- align-items: center;\n-}\n-form.splash-request-access-form {\n- display: flex;\n- align-items: center;\n-}\n-input.splash-request-access-email {\n- width: 300px;\n- border: 0;\n- padding: 10px 10px 8px 10px;\n- font-size: 18px;\n- border-radius: 5px;\n- background-color: rgba(119,119,119,0.13);\n- color: black;\n-}\n-input.splash-request-access-email::placeholder,\n-input.splash-request-access-email::-ms-input-placeholder {\n- color: #777777;\n-}\n-button.splash-request-access-submit {\n- border: 0px;\n- padding: 10px 10px 8px 10px;\n- font-size: 18px;\n- border-radius: 5px;\n- background-color: rgba(0,170,0,0.53);\n- color: white;\n- margin-left: 15px;\n- cursor: pointer;\n- width: 78px;\n- height: 39px;\n-}\n-p.splash-android-warning {\n- font-size: 14px;\n- padding: 5px;\n-}\n-p.splash-request-access-error {\n- font-size: 14px;\n- padding: 10px;\n- text-align: center;\n- color: red;\n-}\n-p.splash-request-access-success {\n- font-size: 18px;\n- padding: 20px;\n- text-align: center;\n-}\n-\n-div.custom-select {\n- position: relative;\n- display: block;\n- border: 1px solid #bbb;\n- border-radius: .3em;\n- background-color: #f5f5f5;\n- margin-left: 15px;\n-}\n-div.custom-select::after {\n- content: \" \";\n- position: absolute;\n- top: 50%;\n- right: 1em;\n- z-index: 2;\n- pointer-events: none;\n- display: none;\n- width: 0;\n- height: 0;\n- border-left: 4px solid transparent;\n- border-right: 4px solid transparent;\n- border-top: 7px solid #666;\n- margin-top: -3px;\n-}\n-div.custom-select select {\n- width: 100%;\n- margin: 0;\n- outline: none;\n- padding: .6em .8em .5em .8em;\n- -webkit-box-sizing: border-box;\n- -moz-box-sizing: border-box;\n- box-sizing: border-box;\n- font-size: 16px;\n- font-family: sans-serif;\n- color: #444;\n- border-radius: .2em;\n-}\n-div.custom-select select:focus {\n- color: #222;\n- outline: none;\n-}\n-@supports (-webkit-appearance: none)\n- or (appearance: none)\n- or ((-moz-appearance: none) and (mask-type: alpha)) {\n-\n- div.custom-select::after {\n- display: block;\n- }\n- div.custom-select select {\n- padding-right: 2em;\n- background: none;\n- border: 1px solid transparent;\n- -webkit-appearance: none;\n- -moz-appearance: none;\n- appearance: none;\n- }\n- div.custom-select select:focus {\n- border-color: #aaa;\n- }\n-}\n-\n@media\nonly screen and (-webkit-min-device-pixel-ratio: 2.0),\nonly screen and (min--moz-device-pixel-ratio: 2.0),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Move splash CSS to separate file |
129,187 | 08.02.2019 18:57:55 | 18,000 | 64987d93da481f3dab8240890c3bfa4ed57a16b0 | [web] Improve HTML/CSS for splash page | [
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.css",
"new_path": "web/splash/splash.css",
"diff": "div.header-container {\n- position: fixed;\n- top: 0;\n- left: 0;\n- right: 0;\n- height: 61px;\n- z-index: 3;\n+ flex: 0 1 auto;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\npadding: 0 10px;\n}\ndiv.top-container {\n- position: fixed;\n+ position: absolute;\ntop: 0;\nleft: 0;\nright: 0;\n- height: 100%;\n- background-image: url(../images/background.png);\n- background-size: 3000px 2000px;\n- background-repeat-y: repeat;\n- padding-top: 61px;\n+}\n+div.content {\n+ flex: 1 0 0;\n+ position: relative;\n+ min-height: 100%;\n}\ndiv.top {\nmax-width: 1024px;\n@@ -74,7 +69,9 @@ div.devices {\n}\ndiv.bottom-container {\nz-index: 2;\n- flex-grow: 1;\n+ position: relative;\n+ overflow: auto;\n+ height: 100%;\n}\ndiv.bottom {\nmargin-top: 728px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.react.js",
"new_path": "web/splash/splash.react.js",
"diff": "@@ -119,6 +119,7 @@ class Splash extends React.PureComponent<Props, State> {\n</header>\n</div>\n</div>\n+ <div className={css['content']}>\n<div className={css['top-container']}>\n<div className={css['top']}>\n<div className={css['body']}>\n@@ -192,6 +193,7 @@ class Splash extends React.PureComponent<Props, State> {\n<div className={css['header-overscroll']} />\n</div>\n</div>\n+ </div>\n{this.props.currentModal}\n</React.Fragment>\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Improve HTML/CSS for splash page |
129,187 | 12.02.2019 14:39:58 | 18,000 | e291d540ab266cc1f134e7ed48f75aea2f9156c6 | [web] Fix Splash styling for Microsoft Edge | [
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.css",
"new_path": "web/splash/splash.css",
"diff": "div.header-container {\n- flex: 0 1 auto;\n+ flex: 1 1 auto;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n@@ -65,13 +65,15 @@ p.intro-description {\n}\ndiv.devices {\ndisplay: flex;\n- justify-content: space-evenly;\n+ justify-content: space-between;\n+ margin: 0 159px;\n}\ndiv.bottom-container {\nz-index: 2;\nposition: relative;\noverflow: auto;\nheight: 100%;\n+ -ms-overflow-style: -ms-autohiding-scrollbar;\n}\ndiv.bottom {\nmargin-top: 728px;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix Splash styling for Microsoft Edge |
129,187 | 12.02.2019 15:05:14 | 18,000 | 621f2d4b6867afeb9b4a58bfa1c8550fa94ab6e5 | [web] Always use autohiding scrollbar in Microsoft Edge | [
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.css",
"new_path": "web/splash/splash.css",
"diff": "@@ -73,7 +73,6 @@ div.bottom-container {\nposition: relative;\noverflow: auto;\nheight: 100%;\n- -ms-overflow-style: -ms-autohiding-scrollbar;\n}\ndiv.bottom {\nmargin-top: 728px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "* {\npadding: 0;\nmargin: 0;\n+ -ms-overflow-style: -ms-autohiding-scrollbar;\n}\nhtml {\nheight: 100%;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Always use autohiding scrollbar in Microsoft Edge |
129,187 | 12.02.2019 15:18:40 | 18,000 | a578583c701c9ea9adfbdcba3f30900cd92d15b4 | [web] Use camelCase for CSS class names in Splash
Easier to index into using JavaScript | [
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.css",
"new_path": "web/splash/splash.css",
"diff": "-div.header-container {\n+div.headerContainer {\nflex: 1 1 auto;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\npadding: 0 10px;\n}\n-div.top-container {\n+div.topContainer {\nposition: absolute;\ntop: 0;\nleft: 0;\n@@ -20,19 +20,19 @@ div.top {\nmax-width: 1024px;\nmargin: 0 auto;\n}\n-div.header-contents {\n+div.headerContents {\ndisplay: flex;\njustify-content: space-between;\nalign-items: center;\npadding-top: 5px;\npadding-bottom: 7px;\n}\n-div.action-links > * {\n+div.actionLinks > * {\npadding-right: 15px;\ncolor: white;\nfont-weight: 300;\n}\n-div.action-links > *:last-child {\n+div.actionLinks > *:last-child {\npadding-right: 0;\n}\nheader.header h1 {\n@@ -40,7 +40,7 @@ header.header h1 {\ncolor: white;\nfont-size: 38px;\n}\n-header.header span.request-access {\n+header.header span.requestAccess {\npadding: 10px 20px;\nborder-radius: 20px;\nborder: 1px solid white;\n@@ -52,12 +52,12 @@ div.intro {\ntext-align: center;\nmargin-bottom: 50px;\n}\n-p.intro-header {\n+p.introHeader {\ncolor: white;\nfont-size: 28px;\nfont-weight: 300;\n}\n-p.intro-description {\n+p.introDescription {\ncolor: white;\nfont-size: 21px;\nfont-weight: 300;\n@@ -68,7 +68,7 @@ div.devices {\njustify-content: space-between;\nmargin: 0 159px;\n}\n-div.bottom-container {\n+div.bottomContainer {\nz-index: 2;\nposition: relative;\noverflow: auto;\n@@ -83,11 +83,11 @@ div.bottom {\ndisplay: flex;\nflex-direction: column;\n}\n-div.header-rest {\n+div.headerRest {\nbackground-color: rgba(255,255,255,0.84);\nflex-grow: 1;\n}\n-div.header-overscroll {\n+div.headerOverscroll {\nposition: fixed;\ntop: 100%;\nleft: 0;\n@@ -101,29 +101,29 @@ div.prompt {\nflex-direction: column;\nalign-items: center;\n}\n-p.prompt-header {\n+p.promptHeader {\ncolor: #282828;\nfont-size: 21px;\npadding-top: 25px;\ntext-align: center;\n}\n-p.prompt-description {\n+p.promptDescription {\ncolor: #282828;\nfont-size: 18px;\npadding-top: 9px;\ntext-align: center;\n}\n-div.request-access-container {\n+div.requestAccessContainer {\nmargin: 25px;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\n}\n-form.request-access-form {\n+form.requestAccessForm {\ndisplay: flex;\nalign-items: center;\n}\n-input.request-access-email {\n+input.requestAccessEmail {\nwidth: 300px;\nborder: 0;\npadding: 10px 10px 8px 10px;\n@@ -132,11 +132,11 @@ input.request-access-email {\nbackground-color: rgba(119,119,119,0.13);\ncolor: black;\n}\n-input.request-access-email::placeholder,\n-input.request-access-email::-ms-input-placeholder {\n+input.requestAccessEmail::placeholder,\n+input.requestAccessEmail::-ms-input-placeholder {\ncolor: #777777;\n}\n-button.request-access-submit {\n+button.requestAccessSubmit {\nborder: 0px;\npadding: 10px 10px 8px 10px;\nfont-size: 18px;\n@@ -148,23 +148,23 @@ button.request-access-submit {\nwidth: 78px;\nheight: 39px;\n}\n-p.android-warning {\n+p.androidWarning {\nfont-size: 14px;\npadding: 5px;\n}\n-p.request-access-error {\n+p.requestAccessError {\nfont-size: 14px;\npadding: 10px;\ntext-align: center;\ncolor: red;\n}\n-p.request-access-success {\n+p.requestAccessSuccess {\nfont-size: 18px;\npadding: 20px;\ntext-align: center;\n}\n-div.custom-select {\n+div.customSelect {\nposition: relative;\ndisplay: block;\nborder: 1px solid #bbb;\n@@ -172,7 +172,7 @@ div.custom-select {\nbackground-color: #f5f5f5;\nmargin-left: 15px;\n}\n-div.custom-select::after {\n+div.customSelect::after {\ncontent: \" \";\nposition: absolute;\ntop: 50%;\n@@ -187,7 +187,7 @@ div.custom-select::after {\nborder-top: 7px solid #666;\nmargin-top: -3px;\n}\n-div.custom-select select {\n+div.customSelect select {\nwidth: 100%;\nmargin: 0;\noutline: none;\n@@ -200,7 +200,7 @@ div.custom-select select {\ncolor: #444;\nborder-radius: .2em;\n}\n-div.custom-select select:focus {\n+div.customSelect select:focus {\ncolor: #222;\noutline: none;\n}\n@@ -208,10 +208,10 @@ div.custom-select select:focus {\nor (appearance: none)\nor ((-moz-appearance: none) and (mask-type: alpha)) {\n- div.custom-select::after {\n+ div.customSelect::after {\ndisplay: block;\n}\n- div.custom-select select {\n+ div.customSelect select {\npadding-right: 2em;\nbackground: none;\nborder: 1px solid transparent;\n@@ -219,8 +219,7 @@ div.custom-select select:focus {\n-moz-appearance: none;\nappearance: none;\n}\n- div.custom-select select:focus {\n+ div.customSelect select:focus {\nborder-color: #aaa;\n}\n}\n-\n"
},
{
"change_type": "MODIFY",
"old_path": "web/splash/splash.react.js",
"new_path": "web/splash/splash.react.js",
"diff": "@@ -68,7 +68,7 @@ class Splash extends React.PureComponent<Props, State> {\nlet androidWarning = null;\nif (this.state.platform === \"android\") {\nandroidWarning = (\n- <p className={css['android-warning']}>\n+ <p className={css.androidWarning}>\nMake sure this is the email you use to log in to the Google Play\nStore!\n</p>\n@@ -77,7 +77,7 @@ class Splash extends React.PureComponent<Props, State> {\nlet error = null\nif (this.state.error) {\nerror = (\n- <p className={css['request-access-error']}>\n+ <p className={css.requestAccessError}>\n{this.state.error}\n</p>\n);\n@@ -85,7 +85,7 @@ class Splash extends React.PureComponent<Props, State> {\nlet success = null\nif (this.state.success) {\nsuccess = (\n- <p className={css['request-access-success']}>\n+ <p className={css.requestAccessSuccess}>\n{this.state.success}\n</p>\n);\n@@ -98,14 +98,14 @@ class Splash extends React.PureComponent<Props, State> {\n}\nreturn (\n<React.Fragment>\n- <div className={css['header-container']}>\n- <div className={css['top']}>\n- <header className={css['header']}>\n- <div className={css['header-contents']}>\n+ <div className={css.headerContainer}>\n+ <div className={css.top}>\n+ <header className={css.header}>\n+ <div className={css.headerContents}>\n<h1>SquadCal</h1>\n- <div className={css['action-links']}>\n+ <div className={css.actionLinks}>\n<a href=\"#\" onClick={this.onClickRequestAccess}>\n- <span className={css['request-access']}>\n+ <span className={css.requestAccess}>\nRequest access\n</span>\n</a>\n@@ -119,19 +119,19 @@ class Splash extends React.PureComponent<Props, State> {\n</header>\n</div>\n</div>\n- <div className={css['content']}>\n- <div className={css['top-container']}>\n- <div className={css['top']}>\n- <div className={css['body']}>\n- <div className={css['intro']}>\n- <p className={css['intro-header']}>\n+ <div className={css.content}>\n+ <div className={css.topContainer}>\n+ <div className={css.top}>\n+ <div className={css.body}>\n+ <div className={css.intro}>\n+ <p className={css.introHeader}>\nSquadCal is a chat app with an integrated calendar.\n</p>\n- <p className={css['intro-description']}>\n+ <p className={css.introDescription}>\nWe make it incredibly easy to plan events with your friends.\n</p>\n</div>\n- <div className={css['devices']}>\n+ <div className={css.devices}>\n<img\nsrc=\"images/ios_screenshot.png\"\nsrcSet=\"images/ios_screenshot@2x.png 526w\"\n@@ -148,28 +148,28 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n</div>\n</div>\n- <div className={css['bottom-container']}>\n- <div className={css['bottom']}>\n- <div className={css['header-rest']}>\n- <div className={css['prompt']}>\n- <p className={css['prompt-header']}>\n+ <div className={css.bottomContainer}>\n+ <div className={css.bottom}>\n+ <div className={css.headerRest}>\n+ <div className={css.prompt}>\n+ <p className={css.promptHeader}>\nWe're currently alpha testing the first version of our app.\n</p>\n- <p className={css['prompt-description']}>\n+ <p className={css.promptDescription}>\nIf you'd like to try it out, please let us know!\n</p>\n- <div className={css['request-access-container']}>\n+ <div className={css.requestAccessContainer}>\n<div>\n- <form className={css['request-access-form']}>\n+ <form className={css.requestAccessForm}>\n<input\ntype=\"text\"\nvalue={this.state.email}\nonChange={this.onChangeEmail}\nplaceholder=\"Email address\"\n- className={css['request-access-email']}\n+ className={css.requestAccessEmail}\nref={this.emailInputRef}\n/>\n- <div className={css['custom-select']}>\n+ <div className={css.customSelect}>\n<select onChange={this.onChangePlatform}>\n<option value=\"ios\">iOS</option>\n<option value=\"android\">Android</option>\n@@ -177,7 +177,7 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n<button\ntype=\"submit\"\n- className={css['request-access-submit']}\n+ className={css.requestAccessSubmit}\nonClick={this.onSubmitRequestAccess}\n>\n{submitButtonContent}\n@@ -190,7 +190,7 @@ class Splash extends React.PureComponent<Props, State> {\n</div>\n</div>\n</div>\n- <div className={css['header-overscroll']} />\n+ <div className={css.headerOverscroll} />\n</div>\n</div>\n</div>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use camelCase for CSS class names in Splash
Easier to index into using JavaScript |
129,187 | 13.02.2019 12:20:23 | 18,000 | c63e80fc2006a9af5943fd187acda7d76ae9e0f7 | [web] ComposedMessage | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -159,7 +159,6 @@ div.messageTimestampTopRightTooltip:after {\ndiv.textMessage {\npadding: 6px 12px;\n- margin: 0 4px 0 12px;\nwhite-space: pre-wrap;\n}\ndiv.normalTextMessage {\n@@ -180,7 +179,8 @@ div.content {\ndisplay: flex;\nflex-shrink: 0;\nalign-items: center;\n- margin-bottom: 5px;\n+ margin: 0 4px 5px 12px;\n+ overflow: hidden;\n}\ndiv.nonViewerContent {\nalign-self: flex-start;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/chat/composed-message.react.js",
"diff": "+// @flow\n+\n+import {\n+ type ChatMessageInfoItem,\n+ chatMessageItemPropType,\n+} from 'lib/selectors/chat-selectors';\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\n+import { assertComposableMessageType } from 'lib/types/message-types';\n+\n+import * as React from 'react';\n+import PropTypes from 'prop-types';\n+import classNames from 'classnames';\n+import CircleIcon from 'react-feather/dist/icons/circle';\n+import CheckCircleIcon from 'react-feather/dist/icons/check-circle';\n+import XCircleIcon from 'react-feather/dist/icons/x-circle';\n+\n+import { stringForUser } from 'lib/shared/user-utils';\n+\n+import FailedSend from './failed-send.react';\n+import css from './chat-message-list.css';\n+\n+type Props = {|\n+ item: ChatMessageInfoItem,\n+ threadInfo: ThreadInfo,\n+ sendFailed: bool,\n+ children: React.Node,\n+|};\n+class ComposedMessage extends React.PureComponent<Props> {\n+\n+ static propTypes = {\n+ item: chatMessageItemPropType.isRequired,\n+ threadInfo: threadInfoPropType.isRequired,\n+ sendFailed: PropTypes.bool.isRequired,\n+ children: PropTypes.node.isRequired,\n+ };\n+\n+ constructor(props: Props) {\n+ super(props);\n+ assertComposableMessageType(props.item.messageInfo.type);\n+ }\n+\n+ componentDidUpdate(prevProps: Props) {\n+ assertComposableMessageType(this.props.item.messageInfo.type);\n+ }\n+\n+ render() {\n+ assertComposableMessageType(this.props.item.messageInfo.type);\n+ const { id, creator } = this.props.item.messageInfo;\n+ const threadColor = this.props.threadInfo.color;\n+\n+ const { isViewer } = creator;\n+ const contentClassName = classNames({\n+ [css.content]: true,\n+ [css.viewerContent]: isViewer,\n+ [css.nonViewerContent]: !isViewer,\n+ });\n+ const contentStyle = {\n+ borderTopRightRadius:\n+ isViewer && !this.props.item.startsCluster ? 0 : 8,\n+ borderBottomRightRadius:\n+ isViewer && !this.props.item.endsCluster ? 0 : 8,\n+ borderTopLeftRadius:\n+ !isViewer && !this.props.item.startsCluster ? 0 : 8,\n+ borderBottomLeftRadius:\n+ !isViewer && !this.props.item.endsCluster ? 0 : 8,\n+ };\n+\n+ let authorName = null;\n+ if (!isViewer && this.props.item.startsCluster) {\n+ authorName = (\n+ <span className={css.authorName}>\n+ {stringForUser(creator)}\n+ </span>\n+ );\n+ }\n+\n+ let deliveryIcon = null;\n+ let failedSendInfo = null;\n+ if (isViewer) {\n+ let deliveryIconSpan;\n+ let deliveryIconColor = threadColor;\n+ if (id !== null && id !== undefined) {\n+ deliveryIconSpan = <CheckCircleIcon />;\n+ } else {\n+ if (this.props.sendFailed) {\n+ deliveryIconSpan = <XCircleIcon />;\n+ deliveryIconColor = \"FF0000\";\n+ failedSendInfo = (\n+ <FailedSend\n+ item={this.props.item}\n+ threadInfo={this.props.threadInfo}\n+ />\n+ );\n+ } else {\n+ deliveryIconSpan = <CircleIcon />;\n+ }\n+ }\n+ deliveryIcon = (\n+ <div\n+ className={css.iconContainer}\n+ style={{ color: `#${deliveryIconColor}` }}\n+ >\n+ {deliveryIconSpan}\n+ </div>\n+ );\n+ }\n+\n+ return (\n+ <React.Fragment>\n+ {authorName}\n+ <div className={contentClassName} style={contentStyle}>\n+ {this.props.children}\n+ {deliveryIcon}\n+ </div>\n+ {failedSendInfo}\n+ </React.Fragment>\n+ );\n+ }\n+\n+}\n+\n+export default ComposedMessage;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/text-message.react.js",
"new_path": "web/chat/text-message.react.js",
"diff": "@@ -13,17 +13,12 @@ import invariant from 'invariant';\nimport classNames from 'classnames';\nimport Linkify from 'react-linkify';\nimport PropTypes from 'prop-types';\n-import CircleIcon from 'react-feather/dist/icons/circle';\n-import CheckCircleIcon from 'react-feather/dist/icons/check-circle';\n-import XCircleIcon from 'react-feather/dist/icons/x-circle';\nimport { colorIsDark } from 'lib/shared/thread-utils';\nimport { onlyEmojiRegex } from 'lib/shared/emojis';\n-import { stringForUser } from 'lib/shared/user-utils';\n-import { messageKey } from 'lib/shared/message-utils';\nimport css from './chat-message-list.css';\n-import FailedSend from './failed-send.react';\n+import ComposedMessage from './composed-message.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\n@@ -46,9 +41,9 @@ class TextMessage extends React.PureComponent<Props> {\n);\n}\n- componentWillReceiveProps(nextProps: Props) {\n+ componentDidUpdate(prevProps: Props) {\ninvariant(\n- nextProps.item.messageInfo.type === messageTypes.TEXT,\n+ this.props.item.messageInfo.type === messageTypes.TEXT,\n\"TextMessage should only be used for messageTypes.TEXT\",\n);\n}\n@@ -59,7 +54,6 @@ class TextMessage extends React.PureComponent<Props> {\n\"TextMessage should only be used for messageTypes.TEXT\",\n);\nconst { text, id, creator } = this.props.item.messageInfo;\n- const threadColor = this.props.threadInfo.color;\nconst { isViewer } = creator;\nconst onlyEmoji = onlyEmojiRegex.test(text);\n@@ -68,76 +62,30 @@ class TextMessage extends React.PureComponent<Props> {\n[css.normalTextMessage]: !onlyEmoji,\n[css.emojiOnlyTextMessage]: onlyEmoji,\n});\n- const contentClassName = classNames({\n- [css.content]: true,\n- [css.viewerContent]: isViewer,\n- [css.nonViewerContent]: !isViewer,\n- });\n- let darkColor = false;\n+\nconst messageStyle = {};\nif (isViewer) {\n- darkColor = colorIsDark(threadColor);\n+ const threadColor = this.props.threadInfo.color;\n+ const darkColor = colorIsDark(threadColor);\nmessageStyle.backgroundColor = `#${threadColor}`;\nmessageStyle.color = darkColor ? 'white' : 'black';\n} else {\nmessageStyle.backgroundColor = \"rgba(221,221,221,0.73)\";\nmessageStyle.color = 'black';\n}\n- let authorName = null;\n- if (!isViewer && this.props.item.startsCluster) {\n- authorName = (\n- <span className={css.authorName}>\n- {stringForUser(creator)}\n- </span>\n- );\n- }\n- messageStyle.borderTopRightRadius =\n- isViewer && !this.props.item.startsCluster ? 0 : 8;\n- messageStyle.borderBottomRightRadius =\n- isViewer && !this.props.item.endsCluster ? 0 : 8;\n- messageStyle.borderTopLeftRadius =\n- !isViewer && !this.props.item.startsCluster ? 0 : 8;\n- messageStyle.borderBottomLeftRadius =\n- !isViewer && !this.props.item.endsCluster ? 0 : 8;\n-\n- let deliveryIcon = null;\n- let failedSendInfo = null;\n- if (isViewer) {\n- let deliveryIconSpan;\n- let deliveryIconColor = threadColor;\n- if (id !== null && id !== undefined) {\n- deliveryIconSpan = <CheckCircleIcon />;\n- } else {\n- const sendFailed = this.props.item.localMessageInfo\n- ? this.props.item.localMessageInfo.sendFailed\n- : null;\n- if (sendFailed) {\n- deliveryIconSpan = <XCircleIcon />;\n- deliveryIconColor = \"FF0000\";\n- failedSendInfo = (\n- <FailedSend\n+\n+ const sendFailed =\n+ isViewer &&\n+ id !== null && id !== undefined &&\n+ this.props.item.localMessageInfo &&\n+ this.props.item.localMessageInfo.sendFailed;\n+\n+ return (\n+ <ComposedMessage\nitem={this.props.item}\nthreadInfo={this.props.threadInfo}\n- />\n- );\n- } else {\n- deliveryIconSpan = <CircleIcon />;\n- }\n- }\n- deliveryIcon = (\n- <div\n- className={css.iconContainer}\n- style={{ color: `#${deliveryIconColor}` }}\n+ sendFailed={!!sendFailed}\n>\n- {deliveryIconSpan}\n- </div>\n- );\n- }\n-\n- return (\n- <React.Fragment>\n- {authorName}\n- <div className={contentClassName}>\n<div\nclassName={messageClassName}\nstyle={messageStyle}\n@@ -146,10 +94,7 @@ class TextMessage extends React.PureComponent<Props> {\n>\n<Linkify>{text}</Linkify>\n</div>\n- {deliveryIcon}\n- </div>\n- {failedSendInfo}\n- </React.Fragment>\n+ </ComposedMessage>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] ComposedMessage |
129,187 | 13.02.2019 14:59:52 | 18,000 | 74b2381db0e6743dfdb0c9dc7402823006eea41c | [web] Couple fixes for ComposedMessage | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -179,8 +179,7 @@ div.content {\ndisplay: flex;\nflex-shrink: 0;\nalign-items: center;\n- margin: 0 4px 5px 12px;\n- overflow: hidden;\n+ margin-bottom: 5px;\n}\ndiv.nonViewerContent {\nalign-self: flex-start;\n@@ -197,6 +196,11 @@ div.iconContainer > svg {\nheight: 16px;\n}\n+div.messageBox {\n+ margin: 0 4px 0 12px;\n+ overflow: hidden;\n+}\n+\ndiv.failedSend {\ntext-transform: uppercase;\ndisplay: flex;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -54,7 +54,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n[css.viewerContent]: isViewer,\n[css.nonViewerContent]: !isViewer,\n});\n- const contentStyle = {\n+ const messageBoxStyle = {\nborderTopRightRadius:\nisViewer && !this.props.item.startsCluster ? 0 : 8,\nborderBottomRightRadius:\n@@ -81,8 +81,7 @@ class ComposedMessage extends React.PureComponent<Props> {\nlet deliveryIconColor = threadColor;\nif (id !== null && id !== undefined) {\ndeliveryIconSpan = <CheckCircleIcon />;\n- } else {\n- if (this.props.sendFailed) {\n+ } else if (this.props.sendFailed) {\ndeliveryIconSpan = <XCircleIcon />;\ndeliveryIconColor = \"FF0000\";\nfailedSendInfo = (\n@@ -94,7 +93,6 @@ class ComposedMessage extends React.PureComponent<Props> {\n} else {\ndeliveryIconSpan = <CircleIcon />;\n}\n- }\ndeliveryIcon = (\n<div\nclassName={css.iconContainer}\n@@ -108,8 +106,10 @@ class ComposedMessage extends React.PureComponent<Props> {\nreturn (\n<React.Fragment>\n{authorName}\n- <div className={contentClassName} style={contentStyle}>\n+ <div className={contentClassName}>\n+ <div className={css.messageBox} style={messageBoxStyle}>\n{this.props.children}\n+ </div>\n{deliveryIcon}\n</div>\n{failedSendInfo}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Couple fixes for ComposedMessage |
129,187 | 13.02.2019 15:11:18 | 18,000 | ee3f41520cdf0b47e5aa1dad0118c144909c2148 | [web] Use ComposedMessage in MultimediaMessage | [
{
"change_type": "MODIFY",
"old_path": "web/chat/message.react.js",
"new_path": "web/chat/message.react.js",
"diff": "@@ -76,6 +76,7 @@ class Message extends React.PureComponent<Props> {\nmessage = (\n<MultimediaMessage\nitem={this.props.item}\n+ threadInfo={this.props.threadInfo}\nsetMouseOver={this.props.setMouseOver}\nchatInputState={this.props.chatInputState}\n/>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -10,6 +10,7 @@ import {\ntype ChatInputState,\n} from './chat-input-state';\nimport type { MessagePositionInfo } from './message.react';\n+import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\nimport * as React from 'react';\nimport invariant from 'invariant';\n@@ -20,9 +21,11 @@ import { messageKey } from 'lib/shared/message-utils';\nimport css from './chat-message-list.css';\nimport Multimedia from './multimedia.react';\n+import ComposedMessage from './composed-message.react';\ntype Props = {|\nitem: ChatMessageInfoItem,\n+ threadInfo: ThreadInfo,\nsetMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchatInputState: ChatInputState,\n|};\n@@ -30,6 +33,7 @@ class MultimediaMessage extends React.PureComponent<Props> {\nstatic propTypes = {\nitem: chatMessageItemPropType.isRequired,\n+ threadInfo: threadInfoPropType.isRequired,\nsetMouseOver: PropTypes.func.isRequired,\nchatInputState: chatInputStatePropType.isRequired,\n};\n@@ -58,10 +62,14 @@ class MultimediaMessage extends React.PureComponent<Props> {\nconst pendingUploads = localID\n? this.props.chatInputState.assignedUploads[localID]\n: [];\n+ let sendFailed = false;\nconst multimedia = media.map(singleMedia => {\nconst pendingUpload = pendingUploads.find(\nupload => upload.localID === singleMedia.id,\n);\n+ if (pendingUpload && pendingUpload.failed) {\n+ sendFailed = true;\n+ }\nreturn (\n<Multimedia\nuri={singleMedia.uri}\n@@ -71,9 +79,13 @@ class MultimediaMessage extends React.PureComponent<Props> {\n);\n});\nreturn (\n- <div className={css.robotext}>\n+ <ComposedMessage\n+ item={this.props.item}\n+ threadInfo={this.props.threadInfo}\n+ sendFailed={sendFailed}\n+ >\n<div className={css.previews}>{multimedia}</div>\n- </div>\n+ </ComposedMessage>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use ComposedMessage in MultimediaMessage |
129,187 | 13.02.2019 15:16:31 | 18,000 | 0bc9dff3c8fd1fafa403c2ebdcdfc420f37740df | Increment localID on createLocalMultimediaMessageActionType | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/local-id-reducer.js",
"new_path": "lib/reducers/local-id-reducer.js",
"diff": "@@ -9,7 +9,10 @@ import {\nhighestLocalIDSelector,\n} from '../selectors/local-id-selectors';\nimport { rehydrateActionType } from '../types/redux-types';\n-import { sendTextMessageActionTypes } from '../actions/message-actions';\n+import {\n+ sendTextMessageActionTypes,\n+ createLocalMultimediaMessageActionType,\n+} from '../actions/message-actions';\nimport { createLocalEntryActionType } from '../actions/entry-actions';\nexport default function reduceNextLocalID(state: number, action: BaseAction) {\n@@ -18,7 +21,8 @@ export default function reduceNextLocalID(state: number, action: BaseAction) {\nnewCandidate = highestLocalIDSelector(action.payload) + 1;\n} else if (\naction.type === sendTextMessageActionTypes.started ||\n- action.type === createLocalEntryActionType\n+ action.type === createLocalEntryActionType ||\n+ action.type === createLocalMultimediaMessageActionType\n) {\nconst { localID } = action.payload;\ninvariant(localID, \"should be set\");\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/message-reducer.js",
"new_path": "lib/reducers/message-reducer.js",
"diff": "@@ -812,7 +812,7 @@ function reduceMessageStore(\n},\n};\n} else if (action.type === createLocalMultimediaMessageActionType) {\n- const { messageInfo } = action.payload;\n+ const messageInfo = action.payload;\nreturn {\n...messageStore,\nmessages: {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -43,7 +43,6 @@ import type {\nSaveMessagesPayload,\nMessagesResultWithUserInfos,\nMessageStorePrunePayload,\n- CreateLocalMultimediaMessagePayload,\n} from './message-types';\nimport type { SetSessionPayload } from './session-types';\nimport type { ReportCreationResponse } from './report-types';\n@@ -462,7 +461,7 @@ export type BaseAction =\n|} | {|\ntype: \"SEND_MULTIMEDIA_MESSAGE_STARTED\",\nloadingInfo: LoadingInfo,\n- payload: RawMultimediaMessageInfo,\n+ payload?: void,\n|} | {|\ntype: \"SEND_MULTIMEDIA_MESSAGE_FAILED\",\nerror: true,\n@@ -650,7 +649,7 @@ export type BaseAction =\npayload: AssignMediaServerURIToMessagePayload,\n|} | {|\ntype: \"CREATE_LOCAL_MULTIMEDIA_MESSAGE\",\n- payload: CreateLocalMultimediaMessagePayload,\n+ payload: RawMultimediaMessageInfo,\n|};\nexport type ActionPayload\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -379,7 +379,7 @@ class ChatInputBar extends React.PureComponent<Props> {\nthis.props.chatInputState.assignPendingUploads(localID);\nthis.props.dispatchActionPayload(\ncreateLocalMultimediaMessageActionType,\n- { messageInfo },\n+ messageInfo,\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Increment localID on createLocalMultimediaMessageActionType |
129,187 | 13.02.2019 15:42:56 | 18,000 | c4d129199f005d103a3df026e4a29d289506783b | [web] Separate out "preview" logic from Multimedia | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -245,14 +245,16 @@ div.previews {\noverflow-x: auto;\nwhite-space: nowrap;\n}\n-span.preview {\n+span.multimedia {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\n- margin: 10px;\nposition: relative;\n}\n-span.preview > span.previewImage {\n+div.previews > span.multimedia {\n+ margin: 10px;\n+}\n+span.multimedia > span.multimediaImage {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\n@@ -260,11 +262,11 @@ span.preview > span.previewImage {\nmin-height: 50px;\nmin-width: 50px;\n}\n-span.preview > span.previewImage > img {\n+span.multimedia > span.multimediaImage > img {\nmax-height: 200px;\nmax-width: 200px;\n}\n-span.preview > span.previewImage > svg.removeUpload {\n+span.multimedia > span.multimediaImage > svg.removeUpload {\ndisplay: none;\nposition: absolute;\ncursor: pointer;\n@@ -275,10 +277,10 @@ span.preview > span.previewImage > svg.removeUpload {\nbox-shadow: inset 0px 0px 5px rgba(0,0,0,0.5);\nbackground-color: rgba(34,34,34,0.67);\n}\n-span.preview:hover > span.previewImage > svg.removeUpload {\n+span.multimedia:hover > span.multimediaImage > svg.removeUpload {\ndisplay: inherit;\n}\n-span.preview > svg.uploadError {\n+span.multimedia > svg.uploadError {\nposition: absolute;\ntop: 0;\nbottom: 0;\n@@ -290,7 +292,7 @@ span.preview > svg.uploadError {\nbox-shadow: inset 0px 0px 5px rgba(0,0,0,0.5);\nbackground-color: #DD2222;\n}\n-span.preview > svg.progressIndicator {\n+span.multimedia > svg.progressIndicator {\nposition: absolute;\ntop: 0;\nbottom: 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -84,7 +84,7 @@ class MultimediaMessage extends React.PureComponent<Props> {\nthreadInfo={this.props.threadInfo}\nsendFailed={sendFailed}\n>\n- <div className={css.previews}>{multimedia}</div>\n+ {multimedia}\n</ComposedMessage>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia.react.js",
"new_path": "web/chat/multimedia.react.js",
"diff": "@@ -79,8 +79,8 @@ class Multimedia extends React.PureComponent<Props> {\n}\nreturn (\n- <span className={css.preview}>\n- <span className={css.previewImage}>\n+ <span className={css.multimedia}>\n+ <span className={css.multimediaImage}>\n<img src={this.props.uri} />\n{removeButton}\n</span>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Separate out "preview" logic from Multimedia |
129,187 | 13.02.2019 17:18:08 | 18,000 | 352860fa0131c053bd628b9abff91a3ab91eb392 | [web] Fix a couple bugs in ChatInputState logic | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-state-container.react.js",
"new_path": "web/chat/chat-input-state-container.react.js",
"diff": "@@ -12,7 +12,7 @@ import _memoize from 'lodash/memoize';\nimport _keyBy from 'lodash/fp/keyBy';\nimport _omit from 'lodash/fp/omit';\nimport _flow from 'lodash/fp/flow';\n-import _omitBy from 'lodash/fp/pickBy';\n+import _omitBy from 'lodash/fp/omitBy';\nimport _map from 'lodash/fp/map';\nimport _groupBy from 'lodash/fp/groupBy';\nimport _partition from 'lodash/fp/partition';\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -61,12 +61,15 @@ class MultimediaMessage extends React.PureComponent<Props> {\nconst { localID, media } = this.props.item.messageInfo;\nconst pendingUploads = localID\n? this.props.chatInputState.assignedUploads[localID]\n- : [];\n+ : null;\nlet sendFailed = false;\nconst multimedia = media.map(singleMedia => {\n- const pendingUpload = pendingUploads.find(\n+ let pendingUpload;\n+ if (pendingUploads) {\n+ pendingUpload = pendingUploads.find(\nupload => upload.localID === singleMedia.id,\n);\n+ }\nif (pendingUpload && pendingUpload.failed) {\nsendFailed = true;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix a couple bugs in ChatInputState logic |
129,187 | 13.02.2019 17:36:50 | 18,000 | ef7c3ee7ec338d9445730165e1c93cb35a28540f | [web] Move mouseover detection logic from TextMessage to ComposedMessage
This allows `MultimediaMessage` to share it. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -6,6 +6,7 @@ import {\n} from 'lib/selectors/chat-selectors';\nimport { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types';\nimport { assertComposableMessageType } from 'lib/types/message-types';\n+import type { MessagePositionInfo } from './message.react';\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\n@@ -23,6 +24,7 @@ type Props = {|\nitem: ChatMessageInfoItem,\nthreadInfo: ThreadInfo,\nsendFailed: bool,\n+ setMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchildren: React.Node,\n|};\nclass ComposedMessage extends React.PureComponent<Props> {\n@@ -31,6 +33,7 @@ class ComposedMessage extends React.PureComponent<Props> {\nitem: chatMessageItemPropType.isRequired,\nthreadInfo: threadInfoPropType.isRequired,\nsendFailed: PropTypes.bool.isRequired,\n+ setMouseOver: PropTypes.func.isRequired,\nchildren: PropTypes.node.isRequired,\n};\n@@ -107,7 +110,12 @@ class ComposedMessage extends React.PureComponent<Props> {\n<React.Fragment>\n{authorName}\n<div className={contentClassName}>\n- <div className={css.messageBox} style={messageBoxStyle}>\n+ <div\n+ className={css.messageBox}\n+ style={messageBoxStyle}\n+ onMouseOver={this.onMouseOver}\n+ onMouseOut={this.onMouseOut}\n+ >\n{this.props.children}\n</div>\n{deliveryIcon}\n@@ -117,6 +125,19 @@ class ComposedMessage extends React.PureComponent<Props> {\n);\n}\n+ onMouseOver = (event: SyntheticEvent<HTMLDivElement>) => {\n+ const { item } = this.props;\n+ const rect = event.currentTarget.getBoundingClientRect();\n+ const { top, bottom, left, right, height, width } = rect;\n+ const messagePosition = { top, bottom, left, right, height, width };\n+ this.props.setMouseOver({ type: \"on\", item, messagePosition });\n+ }\n+\n+ onMouseOut = () => {\n+ const { item } = this.props;\n+ this.props.setMouseOver({ type: \"off\", item });\n+ }\n+\n}\nexport default ComposedMessage;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -86,6 +86,7 @@ class MultimediaMessage extends React.PureComponent<Props> {\nitem={this.props.item}\nthreadInfo={this.props.threadInfo}\nsendFailed={sendFailed}\n+ setMouseOver={this.props.setMouseOver}\n>\n{multimedia}\n</ComposedMessage>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/text-message.react.js",
"new_path": "web/chat/text-message.react.js",
"diff": "@@ -85,32 +85,15 @@ class TextMessage extends React.PureComponent<Props> {\nitem={this.props.item}\nthreadInfo={this.props.threadInfo}\nsendFailed={!!sendFailed}\n+ setMouseOver={this.props.setMouseOver}\n>\n- <div\n- className={messageClassName}\n- style={messageStyle}\n- onMouseOver={this.onMouseOver}\n- onMouseOut={this.onMouseOut}\n- >\n+ <div className={messageClassName} style={messageStyle}>\n<Linkify>{text}</Linkify>\n</div>\n</ComposedMessage>\n);\n}\n- onMouseOver = (event: SyntheticEvent<HTMLDivElement>) => {\n- const { item } = this.props;\n- const rect = event.currentTarget.getBoundingClientRect();\n- const { top, bottom, left, right, height, width } = rect;\n- const messagePosition = { top, bottom, left, right, height, width };\n- this.props.setMouseOver({ type: \"on\", item, messagePosition });\n- }\n-\n- onMouseOut = () => {\n- const { item } = this.props;\n- this.props.setMouseOver({ type: \"off\", item });\n- }\n-\n}\nexport default TextMessage;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Move mouseover detection logic from TextMessage to ComposedMessage
This allows `MultimediaMessage` to share it. |
129,187 | 13.02.2019 17:37:26 | 18,000 | a3fca1eaf3074ade170c778b53c437644131ef26 | [lib] Allow clustering of multimedia messages | [
{
"change_type": "MODIFY",
"old_path": "lib/selectors/chat-selectors.js",
"new_path": "lib/selectors/chat-selectors.js",
"diff": "@@ -11,6 +11,7 @@ import {\nmessageInfoPropType,\nlocalMessageInfoPropType,\nmessageTypes,\n+ isComposableMessageType,\n} from '../types/message-types';\nimport type { UserInfo } from '../types/user-types';\n@@ -169,8 +170,8 @@ function createChatMessageItems(\n) {\nstartsConversation = false;\nif (\n- lastMessageInfo.type === messageTypes.TEXT &&\n- rawMessageInfo.type === messageTypes.TEXT &&\n+ isComposableMessageType(lastMessageInfo.type) &&\n+ isComposableMessageType(rawMessageInfo.type) &&\nlastMessageInfo.creatorID === rawMessageInfo.creatorID\n) {\nstartsCluster = false;\n@@ -190,10 +191,15 @@ function createChatMessageItems(\nif (!messageInfo) {\ncontinue;\n}\n- if (\n+ if (isComposableMessageType(messageInfo.type)) {\n+ // We use these invariants instead of just checking the messageInfo.type\n+ // directly in the conditional above so that isComposableMessageType can\n+ // be the source of truth\n+ invariant(\nmessageInfo.type === messageTypes.TEXT ||\n- messageInfo.type === messageTypes.MULTIMEDIA\n- ) {\n+ messageInfo.type === messageTypes.MULTIMEDIA,\n+ \"Flow doesn't understand isComposableMessageType above\",\n+ );\nconst localMessageInfo = messageStore.local[messageKey(messageInfo)];\nchatMessageItems.push({\nitemType: \"message\",\n@@ -204,6 +210,11 @@ function createChatMessageItems(\nendsCluster: false,\n});\n} else {\n+ invariant(\n+ messageInfo.type !== messageTypes.TEXT &&\n+ messageInfo.type !== messageTypes.MULTIMEDIA,\n+ \"Flow doesn't understand isComposableMessageType above\",\n+ );\nconst robotext = robotextForMessageInfo(\nmessageInfo,\nthreadInfos[threadID],\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Allow clustering of multimedia messages |
129,187 | 13.02.2019 17:46:53 | 18,000 | ee49bac76808304694390808af9391266249f467 | [web] Get rid of baseline under img | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -250,6 +250,7 @@ span.multimedia {\nalign-items: center;\njustify-content: center;\nposition: relative;\n+ vertical-align: top;\n}\ndiv.previews > span.multimedia {\nmargin: 10px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -20,6 +20,9 @@ a {\ntext-decoration: none;\ncolor: #2A5DB0;\n}\n+img, iframe {\n+ display: block;\n+}\ninput[type='text'], input[type='password'], textarea {\n-webkit-appearance: none;\n-moz-appearance: none;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Get rid of baseline under img |
129,187 | 15.02.2019 18:34:38 | 18,000 | 8e3b22898edd84769ed4322c1e831eb3f915704e | codeVersion -> 28
iOS-only | [
{
"change_type": "MODIFY",
"old_path": "lib/facts/version.json",
"new_path": "lib/facts/version.json",
"diff": "{\n- \"currentCodeVersion\": 27\n+ \"currentCodeVersion\": 28\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -110,8 +110,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 27\n- versionName \"0.0.27\"\n+ versionCode 28\n+ versionName \"0.0.28\"\n}\nsplits {\nabi {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.27</string>\n+ <string>0.0.28</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>27</string>\n+ <string>28</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | codeVersion -> 28
iOS-only |
129,187 | 16.02.2019 17:35:04 | 18,000 | f5f3d02d84dd9335dfde8e2c753b66f45b0d2a27 | Use table instead of hard-coded constants for app version update message | [
{
"change_type": "DELETE",
"old_path": "lib/facts/version.json",
"new_path": null,
"diff": "-{\n- \"currentCodeVersion\": 28\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -9,7 +9,6 @@ import { createMigrate } from 'redux-persist';\nimport invariant from 'invariant';\nimport { Platform } from 'react-native';\n-import version from 'lib/facts/version';\nimport { highestLocalIDSelector } from 'lib/selectors/local-id-selectors';\nimport { nativeCalendarQuery } from './selectors/nav-selectors';\n@@ -127,7 +126,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = version.currentCodeVersion;\n+const codeVersion = 28;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/bots/app-version-update.js",
"new_path": "server/src/bots/app-version-update.js",
"diff": "@@ -4,7 +4,6 @@ import { messageTypes } from 'lib/types/message-types';\nimport invariant from 'invariant';\n-import version from 'lib/facts/version';\nimport bots from 'lib/facts/bots';\nimport { promiseAll } from 'lib/utils/promises'\n@@ -13,7 +12,6 @@ import { createSquadbotThread } from './squadbot';\nimport createMessages from '../creators/message-creator';\nimport { createBotViewer } from '../session/bots';\n-const { currentCodeVersion } = version;\nconst thirtyDays = 30 * 24 * 60 * 60 * 1000;\nconst { squadbot } = bots;\n@@ -26,7 +24,16 @@ async function botherMonthlyActivesToUpdateAppVersion(): Promise<void> {\nMIN(JSON_EXTRACT(c.versions, \"$.codeVersion\")) AS min_code_version\nFROM sessions s\nLEFT JOIN cookies c ON c.id = s.cookie\n- WHERE s.last_update > ${cutoff} AND c.platform != \"web\"\n+ LEFT JOIN versions v ON v.platform = c.platform AND v.code_version = (\n+ SELECT MAX(code_version)\n+ FROM versions\n+ WHERE platform = c.platform AND deploy_time IS NOT NULL\n+ )\n+ WHERE s.last_update > ${cutoff}\n+ AND c.platform != \"web\"\n+ AND v.id IS NOT NULL\n+ AND JSON_EXTRACT(c.versions, \"$.codeVersion\") IS NOT NULL\n+ AND v.code_version > JSON_EXTRACT(c.versions, \"$.codeVersion\")\nGROUP BY s.user\n) x\nLEFT JOIN (\n@@ -40,7 +47,6 @@ async function botherMonthlyActivesToUpdateAppVersion(): Promise<void> {\nWHERE m1.user IS NOT NULL AND m2.user IS NOT NULL\nGROUP BY t.id, m1.user\n) t ON t.user = x.user AND t.user_count = 2\n- WHERE x.min_code_version < ${currentCodeVersion}\nGROUP BY x.user, x.min_code_version\n`;\nconst [ result ] = await dbQuery(query);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Use table instead of hard-coded constants for app version update message |
129,187 | 18.02.2019 22:35:03 | 18,000 | bb22a1f4bd255218b0e5d8d3967bf775a283c740 | [web] Display MultimediaMessage as grid | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -180,14 +180,18 @@ div.content {\nflex-shrink: 0;\nalign-items: center;\nmargin-bottom: 5px;\n+ box-sizing: border-box;\n+ width: 100%;\n}\ndiv.nonViewerContent {\nalign-self: flex-start;\n- margin-right: 8px;\n+ justify-content: flex-start;\n+ padding-right: 8px;\n}\ndiv.viewerContent {\nalign-self: flex-end;\n- margin-right: 4px;\n+ justify-content: flex-end;\n+ padding-right: 4px;\n}\ndiv.iconContainer {\nmargin-right: 1px;\n@@ -199,6 +203,12 @@ div.iconContainer > svg {\ndiv.messageBox {\nmargin: 0 4px 0 12px;\noverflow: hidden;\n+ display: flex;\n+ flex-wrap: wrap;\n+ justify-content: space-between;\n+}\n+div.fullWidthMessageBox {\n+ width: 100%;\n}\ndiv.failedSend {\n@@ -263,10 +273,14 @@ span.multimedia > span.multimediaImage {\nmin-height: 50px;\nmin-width: 50px;\n}\n-span.multimedia > span.multimediaImage > img {\n+div.previews > span.multimedia > span.multimediaImage > img {\nmax-height: 200px;\nmax-width: 200px;\n}\n+span.multimedia > span.multimediaImage > img {\n+ max-height: 200px;\n+ max-width: 100%;\n+}\nspan.multimedia > span.multimediaImage > svg.removeUpload {\ndisplay: none;\nposition: absolute;\n@@ -315,3 +329,42 @@ span.multimedia > svg.progressIndicator {\n:global(.CircularProgressbar-trail) {\nstroke: transparent !important;\n}\n+\n+div.messageBox > span.multimedia {\n+ flex: 0 0 49.75%;\n+ margin-top: 2px;\n+}\n+div.messageBox > span.multimedia:first-child {\n+ margin-top: 0;\n+}\n+div.messageBox > span.multimedia > span.multimediaImage {\n+ flex: 1;\n+}\n+div.messageBox > span.multimedia > span.multimediaImage:after {\n+ content: \"\";\n+ display: block;\n+ padding-bottom: 100%;\n+}\n+div.messageBox > span.multimedia > span.multimediaImage > img {\n+ position: absolute;\n+ width: 100%;\n+ height: 100%;\n+ max-height: initial;\n+ object-fit: cover;\n+}\n+\n+div.messageBox > span.multimedia:nth-last-child(n+3):first-child,\n+div.messageBox > span.multimedia:nth-last-child(n+3):first-child ~ * {\n+ flex-basis: 33%;\n+}\n+div.messageBox > span.multimedia:nth-last-child(n+4):first-child,\n+div.messageBox > span.multimedia:nth-last-child(n+4):first-child ~ * {\n+ flex-basis: 49.75%;\n+}\n+div.messageBox > span.multimedia:nth-last-child(n+5):first-child,\n+div.messageBox > span.multimedia:nth-last-child(n+5):first-child ~ * {\n+ flex-basis: 33%;\n+}\n+div.messageBox > span.multimedia:nth-child(5):last-child {\n+ margin-right: auto;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -26,6 +26,7 @@ type Props = {|\nsendFailed: bool,\nsetMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchildren: React.Node,\n+ className?: string,\n|};\nclass ComposedMessage extends React.PureComponent<Props> {\n@@ -35,6 +36,7 @@ class ComposedMessage extends React.PureComponent<Props> {\nsendFailed: PropTypes.bool.isRequired,\nsetMouseOver: PropTypes.func.isRequired,\nchildren: PropTypes.node.isRequired,\n+ className: PropTypes.string,\n};\nconstructor(props: Props) {\n@@ -111,7 +113,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n{authorName}\n<div className={contentClassName}>\n<div\n- className={css.messageBox}\n+ className={classNames(css.messageBox, this.props.className)}\nstyle={messageBoxStyle}\nonMouseOver={this.onMouseOver}\nonMouseOut={this.onMouseOut}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -87,6 +87,7 @@ class MultimediaMessage extends React.PureComponent<Props> {\nthreadInfo={this.props.threadInfo}\nsendFailed={sendFailed}\nsetMouseOver={this.props.setMouseOver}\n+ className={css.fullWidthMessageBox}\n>\n{multimedia}\n</ComposedMessage>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Display MultimediaMessage as grid |
129,187 | 19.02.2019 14:44:16 | 18,000 | 7a54a5253c6d5a287d5f912ba7040cd14ec1eae5 | [native] codeVersion -> 29 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -110,8 +110,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 28\n- versionName \"0.0.28\"\n+ versionCode 29\n+ versionName \"0.0.29\"\n}\nsplits {\nabi {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.plist",
"new_path": "native/ios/SquadCal/Info.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.28</string>\n+ <string>0.0.29</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>28</string>\n+ <string>29</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/persist.js",
"new_path": "native/persist.js",
"diff": "@@ -126,7 +126,7 @@ const persistConfig = {\nmigrate: createMigrate(migrations, { debug: __DEV__ }),\n};\n-const codeVersion = 28;\n+const codeVersion = 29;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] codeVersion -> 29 |
129,187 | 19.02.2019 15:19:40 | 18,000 | 4c4678731f6c8d9daaf7aad70af4092b621b5805 | [web] Use CSS grid instead of Flexbox
This allows us to specify `grid-gap`, and we're not supporting IE anyways. | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -330,22 +330,27 @@ span.multimedia > svg.progressIndicator {\nstroke: transparent !important;\n}\n-div.messageBox > span.multimedia {\n- flex: 0 0 49.75%;\n- margin-top: 2px;\n+div.messageBox > div.imageGrid {\n+ display: grid;\n+ width: 100%;\n+ grid-template-columns: repeat(6, 1fr);\n+ grid-gap: 5px;\n+}\n+div.imageGrid > span.multimedia {\n+ grid-column-end: span 3;\n}\n-div.messageBox > span.multimedia:first-child {\n+div.imageGrid > span.multimedia:first-child {\nmargin-top: 0;\n}\n-div.messageBox > span.multimedia > span.multimediaImage {\n+div.imageGrid > span.multimedia > span.multimediaImage {\nflex: 1;\n}\n-div.messageBox > span.multimedia > span.multimediaImage:after {\n+div.imageGrid > span.multimedia > span.multimediaImage:after {\ncontent: \"\";\ndisplay: block;\npadding-bottom: 100%;\n}\n-div.messageBox > span.multimedia > span.multimediaImage > img {\n+div.imageGrid > span.multimedia > span.multimediaImage > img {\nposition: absolute;\nwidth: 100%;\nheight: 100%;\n@@ -353,18 +358,15 @@ div.messageBox > span.multimedia > span.multimediaImage > img {\nobject-fit: cover;\n}\n-div.messageBox > span.multimedia:nth-last-child(n+3):first-child,\n-div.messageBox > span.multimedia:nth-last-child(n+3):first-child ~ * {\n- flex-basis: 33%;\n-}\n-div.messageBox > span.multimedia:nth-last-child(n+4):first-child,\n-div.messageBox > span.multimedia:nth-last-child(n+4):first-child ~ * {\n- flex-basis: 49.75%;\n+div.imageGrid > span.multimedia:nth-last-child(n+3):first-child,\n+div.imageGrid > span.multimedia:nth-last-child(n+3):first-child ~ * {\n+ grid-column-end: span 2;\n}\n-div.messageBox > span.multimedia:nth-last-child(n+5):first-child,\n-div.messageBox > span.multimedia:nth-last-child(n+5):first-child ~ * {\n- flex-basis: 33%;\n+div.imageGrid > span.multimedia:nth-last-child(n+4):first-child,\n+div.imageGrid > span.multimedia:nth-last-child(n+4):first-child ~ * {\n+ grid-column-end: span 3;\n}\n-div.messageBox > span.multimedia:nth-child(5):last-child {\n- margin-right: auto;\n+div.imageGrid > span.multimedia:nth-last-child(n+5):first-child,\n+div.imageGrid > span.multimedia:nth-last-child(n+5):first-child ~ * {\n+ grid-column-end: span 2;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -89,7 +89,9 @@ class MultimediaMessage extends React.PureComponent<Props> {\nsetMouseOver={this.props.setMouseOver}\nclassName={css.fullWidthMessageBox}\n>\n+ <div className={css.imageGrid}>\n{multimedia}\n+ </div>\n</ComposedMessage>\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia.react.js",
"new_path": "web/chat/multimedia.react.js",
"diff": "@@ -17,7 +17,7 @@ import css from './chat-message-list.css';\ntype Props = {|\nuri: string,\n- pendingUpload?: PendingMultimediaUpload,\n+ pendingUpload?: ?PendingMultimediaUpload,\nremove?: (uploadID: string) => void,\n|};\nclass Multimedia extends React.PureComponent<Props> {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use CSS grid instead of Flexbox
This allows us to specify `grid-gap`, and we're not supporting IE anyways. |
129,187 | 19.02.2019 15:30:16 | 18,000 | b7b8788d91003954be9ec35926824c12cb5964a1 | [web] Custom borderRadius for MultimediaMessage | [
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -27,6 +27,7 @@ type Props = {|\nsetMouseOver: (messagePositionInfo: MessagePositionInfo) => void,\nchildren: React.Node,\nclassName?: string,\n+ borderRadius: number,\n|};\nclass ComposedMessage extends React.PureComponent<Props> {\n@@ -37,6 +38,10 @@ class ComposedMessage extends React.PureComponent<Props> {\nsetMouseOver: PropTypes.func.isRequired,\nchildren: PropTypes.node.isRequired,\nclassName: PropTypes.string,\n+ borderRadius: PropTypes.number.isRequired,\n+ };\n+ static defaultProps = {\n+ borderRadius: 8,\n};\nconstructor(props: Props) {\n@@ -50,8 +55,9 @@ class ComposedMessage extends React.PureComponent<Props> {\nrender() {\nassertComposableMessageType(this.props.item.messageInfo.type);\n- const { id, creator } = this.props.item.messageInfo;\n- const threadColor = this.props.threadInfo.color;\n+ const { borderRadius, item, threadInfo } = this.props;\n+ const { id, creator } = item.messageInfo;\n+ const threadColor = threadInfo.color;\nconst { isViewer } = creator;\nconst contentClassName = classNames({\n@@ -61,17 +67,17 @@ class ComposedMessage extends React.PureComponent<Props> {\n});\nconst messageBoxStyle = {\nborderTopRightRadius:\n- isViewer && !this.props.item.startsCluster ? 0 : 8,\n+ isViewer && !item.startsCluster ? 0 : borderRadius,\nborderBottomRightRadius:\n- isViewer && !this.props.item.endsCluster ? 0 : 8,\n+ isViewer && !item.endsCluster ? 0 : borderRadius,\nborderTopLeftRadius:\n- !isViewer && !this.props.item.startsCluster ? 0 : 8,\n+ !isViewer && !item.startsCluster ? 0 : borderRadius,\nborderBottomLeftRadius:\n- !isViewer && !this.props.item.endsCluster ? 0 : 8,\n+ !isViewer && !item.endsCluster ? 0 : borderRadius,\n};\nlet authorName = null;\n- if (!isViewer && this.props.item.startsCluster) {\n+ if (!isViewer && item.startsCluster) {\nauthorName = (\n<span className={css.authorName}>\n{stringForUser(creator)}\n@@ -91,8 +97,8 @@ class ComposedMessage extends React.PureComponent<Props> {\ndeliveryIconColor = \"FF0000\";\nfailedSendInfo = (\n<FailedSend\n- item={this.props.item}\n- threadInfo={this.props.threadInfo}\n+ item={item}\n+ threadInfo={threadInfo}\n/>\n);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -88,6 +88,7 @@ class MultimediaMessage extends React.PureComponent<Props> {\nsendFailed={sendFailed}\nsetMouseOver={this.props.setMouseOver}\nclassName={css.fullWidthMessageBox}\n+ borderRadius={16}\n>\n<div className={css.imageGrid}>\n{multimedia}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Custom borderRadius for MultimediaMessage |
129,187 | 19.02.2019 15:35:47 | 18,000 | 29dafe9ecce7c35de979db2213531d7cd144a104 | [web] Focus ChatInputBar when files uploaded | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -101,18 +101,26 @@ class ChatInputBar extends React.PureComponent<Props> {\nif (chatInputState.draft !== prevChatInputState.draft) {\nthis.updateHeight();\n}\n+ const curUploadIDs = ChatInputBar.unassignedUploadIDs(\n+ chatInputState.pendingUploads,\n+ );\n+ const prevUploadIDs = ChatInputBar.unassignedUploadIDs(\n+ prevChatInputState.pendingUploads,\n+ );\nif (\nthis.multimediaInput &&\n- _difference(\n- ChatInputBar.unassignedUploadIDs(prevChatInputState.pendingUploads),\n- )(\n- ChatInputBar.unassignedUploadIDs(chatInputState.pendingUploads),\n- ).length > 0\n+ _difference(prevUploadIDs)(curUploadIDs).length > 0\n) {\n// Whenever a pending upload is removed, we reset the file\n// HTMLInputElement's value field, so that if the same upload occurs again\n// the onChange call doesn't get filtered\nthis.multimediaInput.value = \"\";\n+ } else if (\n+ this.textarea &&\n+ _difference(curUploadIDs)(prevUploadIDs).length > 0\n+ ) {\n+ // Whenever a pending upload is added, we focus the textarea\n+ this.textarea.focus();\n}\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Focus ChatInputBar when files uploaded |
129,187 | 19.02.2019 16:53:29 | 18,000 | aca3aeeafd241db71d96e23b0bf0d1c0f040c8f1 | [web] Special-case display of single multimedia | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -210,6 +210,9 @@ div.messageBox {\ndiv.fullWidthMessageBox {\nwidth: 100%;\n}\n+div.halfWidthMessageBox {\n+ max-width: 50%;\n+}\ndiv.failedSend {\ntext-transform: uppercase;\n@@ -336,6 +339,14 @@ div.messageBox > div.imageGrid {\ngrid-template-columns: repeat(6, 1fr);\ngrid-gap: 5px;\n}\n+div.messageBox span.multimedia > span.multimediaImage {\n+ min-height: initial;\n+ min-width: initial;\n+}\n+div.messageBox span.multimedia > span.multimediaImage > img {\n+ max-height: initial;\n+}\n+\ndiv.imageGrid > span.multimedia {\ngrid-column-end: span 3;\n}\n@@ -354,7 +365,6 @@ div.imageGrid > span.multimedia > span.multimediaImage > img {\nposition: absolute;\nwidth: 100%;\nheight: 100%;\n- max-height: initial;\nobject-fit: cover;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/multimedia-message.react.js",
"new_path": "web/chat/multimedia-message.react.js",
"diff": "@@ -81,18 +81,26 @@ class MultimediaMessage extends React.PureComponent<Props> {\n/>\n);\n});\n+ invariant(\n+ multimedia.length > 0,\n+ \"should be at least one multimedia...\",\n+ );\n+ const content = multimedia.length > 1\n+ ? <div className={css.imageGrid}>{multimedia}</div>\n+ : multimedia;\n+ const className = multimedia.length > 1\n+ ? css.fullWidthMessageBox\n+ : css.halfWidthMessageBox;\nreturn (\n<ComposedMessage\nitem={this.props.item}\nthreadInfo={this.props.threadInfo}\nsendFailed={sendFailed}\nsetMouseOver={this.props.setMouseOver}\n- className={css.fullWidthMessageBox}\n+ className={className}\nborderRadius={16}\n>\n- <div className={css.imageGrid}>\n- {multimedia}\n- </div>\n+ {content}\n</ComposedMessage>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Special-case display of single multimedia |
129,187 | 19.02.2019 17:46:47 | 18,000 | 90ea9886dd61100e89735f360a9a2b8e2022bfc1 | [web] Fix calendar header for Edge | [
{
"change_type": "MODIFY",
"old_path": "web/calendar/calendar.css",
"new_path": "web/calendar/calendar.css",
"diff": "@@ -10,6 +10,7 @@ a.filtersButton {\nfont-size: 16px;\ncursor: pointer;\ntext-transform: uppercase;\n+ position: absolute;\n}\na.filtersButton > svg {\npadding-right: 5px;\n@@ -22,16 +23,13 @@ div.content {\nh2.nav {\nfont-family: 'Anaheim', sans-serif;\ntext-align: center;\n- margin: 8px auto 0px auto;\n- width: 200px;\n+ margin: 8px auto 12px auto;\n+ width: 250px;\ncolor: #333333;\n+ display: flex;\n+ justify-content: space-between;\n}\n-h2.nav > a.previousMonthLink {\n- margin-left: -100px;\n- color: #036AFF;\n-}\n-h2.nav > a.nextMonthLink {\n- margin-right: -100px;\n+h2.nav > a.monthLink {\ncolor: #036AFF;\n}\nh2.nav > div.monthName {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/calendar/calendar.react.js",
"new_path": "web/calendar/calendar.react.js",
"diff": "@@ -192,7 +192,7 @@ class Calendar extends React.PureComponent<Props, State> {\n</a>\n<h2 className={css.nav}>\n<a\n- className={css.previousMonthLink}\n+ className={css.monthLink}\nhref={prevURL}\nonClick={this.onClickPrevURL}\n>\n@@ -206,7 +206,7 @@ class Calendar extends React.PureComponent<Props, State> {\n{\" \"}\n</div>\n<a\n- className={css.nextMonthLink}\n+ className={css.monthLink}\nhref={nextURL}\nonClick={this.onClickNextURL}\n>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix calendar header for Edge |
129,187 | 20.02.2019 12:20:40 | 18,000 | 1ae5870c0a304d004b9858acb7b41ec018fce2fa | [server] fetchMedia | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/upload-creator.js",
"new_path": "server/src/creators/upload-creator.js",
"diff": "@@ -9,9 +9,7 @@ import { ServerError } from 'lib/utils/errors';\nimport { dbQuery, SQL } from '../database';\nimport createIDs from './id-creator';\n-import urlFacts from '../../facts/url';\n-\n-const { baseDomain, basePath } = urlFacts;\n+import { getUploadURL } from '../fetchers/upload-fetchers';\ntype UploadInput = {|\nname: string,\n@@ -51,8 +49,4 @@ async function createUploads(\n}));\n}\n-function getUploadURL(id: string, secret: string) {\n- return `${baseDomain}${basePath}upload/${id}/${secret}`;\n-}\n-\nexport default createUploads;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/upload-fetchers.js",
"new_path": "server/src/fetchers/upload-fetchers.js",
"diff": "// @flow\nimport type { Viewer } from '../session/viewer';\n+import type { Media } from 'lib/types/media-types';\nimport { dbQuery, SQL } from '../database';\nimport { ServerError } from 'lib/utils/errors';\n+import urlFacts from '../../facts/url';\n+\n+const { baseDomain, basePath } = urlFacts;\ntype UploadInfo = {|\ncontent: Buffer,\n@@ -29,6 +33,32 @@ async function fetchUpload(\nreturn { content, mime };\n}\n+function getUploadURL(id: string, secret: string) {\n+ return `${baseDomain}${basePath}upload/${id}/${secret}`;\n+}\n+\n+async function fetchMedia(\n+ viewer: Viewer,\n+ mediaIDs: $ReadOnlyArray<string>,\n+): Promise<$ReadOnlyArray<Media>> {\n+ const query = SQL`\n+ SELECT id, secret, type\n+ FROM uploads\n+ WHERE id IN (${mediaIDs}) AND uploader = ${viewer.id} AND container IS NULL\n+ `;\n+ const [ result ] = await dbQuery(query);\n+ return result.map(row => {\n+ const id = row.id.toString();\n+ return {\n+ id,\n+ uri: getUploadURL(id, row.secret),\n+ type: row.type,\n+ };\n+ });\n+}\n+\nexport {\nfetchUpload,\n+ getUploadURL,\n+ fetchMedia,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] fetchMedia |
129,187 | 20.02.2019 12:59:04 | 18,000 | a04205beb6fe1a0892aa97435cfcc52277a838b7 | Server support for creating messageTypes.MULTIMEDIA | [
{
"change_type": "MODIFY",
"old_path": "lib/types/message-types.js",
"new_path": "lib/types/message-types.js",
"diff": "@@ -80,6 +80,15 @@ export function assertComposableMessageType(\n);\nreturn ourMessageType;\n}\n+export function messageDataLocalID(messageData: MessageData) {\n+ if (\n+ messageData.type !== messageTypes.TEXT &&\n+ messageData.type !== messageTypes.MULTIMEDIA\n+ ) {\n+ return null;\n+ }\n+ return messageData.localID;\n+}\n// *MessageData = passed to createMessages function to insert into database\n// Raw*MessageInfo = used by server, and contained in client's local store\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/creators/message-creator.js",
"new_path": "server/src/creators/message-creator.js",
"diff": "import {\nmessageTypes,\n+ messageDataLocalID,\ntype MessageData,\ntype RawMessageInfo,\n} from 'lib/types/message-types';\n@@ -51,7 +52,7 @@ async function createMessages(\nconst existingMessages = await Promise.all(\nmessageDatas.map(messageData => fetchMessageInfoForLocalID(\nviewer,\n- messageData.type === messageTypes.TEXT ? messageData.localID : null,\n+ messageDataLocalID(messageData),\n))\n);\nfor (let i = 0; i < existingMessages.length; i++) {\n@@ -121,6 +122,8 @@ async function createMessages(\ndate: messageData.date,\ntext: messageData.text,\n});\n+ } else if (messageData.type === messageTypes.MULTIMEDIA) {\n+ content = JSON.stringify(messageData.media.map(({ id }) => parseInt(id)));\n}\nconst creation = messageData.localID && viewer.hasSessionInfo\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Server support for creating messageTypes.MULTIMEDIA |
129,187 | 20.02.2019 13:54:09 | 18,000 | 397ba2c6efa64d2e65b6425e1feb2cbf0a20beff | [server] Support fetching messageTypes.MULTIMEDIA
This required refactoring `message-fetchers` so it could handle parsing multiple rows per `RawMessageInfo`. | [
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/message-fetchers.js",
"new_path": "server/src/fetchers/message-fetchers.js",
"diff": "@@ -30,6 +30,7 @@ import { ServerError } from 'lib/utils/errors';\nimport { dbQuery, SQL, mergeOrConditions } from '../database';\nimport { fetchUserInfos } from './user-fetchers';\nimport { creationString, localIDFromCreationString } from '../utils/idempotent';\n+import { getUploadURL } from './upload-fetchers';\nexport type CollapsableNotifInfo = {|\ncollapseKey: ?string,\n@@ -95,9 +96,13 @@ async function fetchCollapsableNotifs(\nconst collapseQuery = SQL`\nSELECT m.id, m.thread AS threadID, m.content, m.time, m.type,\nu.username AS creator, m.user AS creatorID,\n- stm.permissions AS subthread_permissions, n.user, n.collapse_key\n+ stm.permissions AS subthread_permissions, n.user, n.collapse_key,\n+ up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret\nFROM notifications n\nLEFT JOIN messages m ON m.id = n.message\n+ LEFT JOIN uploads up\n+ ON m.type = ${messageTypes.MULTIMEDIA}\n+ AND JSON_CONTAINS(m.content, CAST(up.id as JSON), '$')\nLEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = n.user\nLEFT JOIN memberships stm\nON m.type = ${messageTypes.CREATE_SUB_THREAD}\n@@ -110,15 +115,14 @@ async function fetchCollapsableNotifs(\ncollapseQuery.append(SQL`ORDER BY m.time DESC`);\nconst [ collapseResult ] = await dbQuery(collapseQuery);\n- const userInfos = {};\n- for (let row of collapseResult) {\n- userInfos[row.creatorID] = { id: row.creatorID, username: row.creator };\n- const rawMessageInfo = rawMessageInfoFromRow(row);\n- if (rawMessageInfo) {\n+ const { userInfos, messages } = parseMessageSQLResult(collapseResult);\n+\n+ for (let message of messages) {\n+ const { rawMessageInfo, rows } = message;\n+ const [ row ] = rows;\nconst info = usersToCollapseKeysToInfo[row.user][row.collapse_key];\ninfo.existingMessageInfos.push(rawMessageInfo);\n}\n- }\nfor (let userID in usersToCollapseKeysToInfo) {\nconst collapseKeysToInfo = usersToCollapseKeysToInfo[userID];\n@@ -135,12 +139,73 @@ async function fetchCollapsableNotifs(\nreturn { usersToCollapsableNotifInfo, userInfos };\n}\n-function rawMessageInfoFromRow(\n- row: Object,\n+type MessageSQLResult = {|\n+ messages: $ReadOnlyArray<{|\n+ rawMessageInfo: RawMessageInfo,\n+ rows: $ReadOnlyArray<Object>,\n+ |}>,\n+ userInfos: UserInfos,\n+|};\n+function parseMessageSQLResult(\n+ rows: $ReadOnlyArray<Object>,\n+): MessageSQLResult {\n+ const userInfos = {}, rowsByID = new Map();\n+ for (let row of rows) {\n+ const creatorID = row.creatorID.toString();\n+ userInfos[creatorID] = {\n+ id: creatorID,\n+ username: row.creator,\n+ };\n+ const id = row.id.toString();\n+ const currentRowsForID = rowsByID.get(id);\n+ if (currentRowsForID) {\n+ currentRowsForID.push(row);\n+ } else {\n+ rowsByID.set(id, [ row ]);\n+ }\n+ }\n+\n+ const messages = [];\n+ for (let messageRows of rowsByID.values()) {\n+ const rawMessageInfo = rawMessageInfoFromRows(messageRows);\n+ if (rawMessageInfo) {\n+ messages.push({ rawMessageInfo, rows: messageRows });\n+ }\n+ }\n+\n+ return { messages, userInfos };\n+}\n+\n+function assertSingleRow(\n+ rows: $ReadOnlyArray<Object>,\n+): Object {\n+ if (rows.length === 0) {\n+ throw new Error(\"expected single row, but none present!\");\n+ } else if (rows.length !== 1) {\n+ const messageIDs = rows.map(row => row.id.toString());\n+ console.log(\n+ `expected single row, but there are multiple! ${messageIDs.join(\", \")}`,\n+ );\n+ }\n+ return rows[0];\n+}\n+\n+function mostRecentRowType(\n+ rows: $ReadOnlyArray<Object>,\n+): MessageType {\n+ if (rows.length === 0) {\n+ throw new Error(\"expected row, but none present!\");\n+ }\n+ return assertMessageType(rows[0].type);\n+}\n+\n+function rawMessageInfoFromRows(\n+ rows: $ReadOnlyArray<Object>,\nviewer?: Viewer,\n): ?RawMessageInfo {\n- const type = assertMessageType(row.type);\n+ const type = mostRecentRowType(rows);\nif (type === messageTypes.TEXT) {\n+ const row = assertSingleRow(rows);\nconst rawTextMessageInfo: RawTextMessageInfo = {\ntype: messageTypes.TEXT,\nid: row.id.toString(),\n@@ -155,6 +220,7 @@ function rawMessageInfoFromRow(\n}\nreturn rawTextMessageInfo;\n} else if (type === messageTypes.CREATE_THREAD) {\n+ const row = assertSingleRow(rows);\nconst dbInitialThreadState = JSON.parse(row.content);\n// For legacy clients before the rename\nconst initialThreadState = {\n@@ -170,6 +236,7 @@ function rawMessageInfoFromRow(\ninitialThreadState,\n};\n} else if (type === messageTypes.ADD_MEMBERS) {\n+ const row = assertSingleRow(rows);\nreturn {\ntype: messageTypes.ADD_MEMBERS,\nid: row.id.toString(),\n@@ -179,6 +246,7 @@ function rawMessageInfoFromRow(\naddedUserIDs: JSON.parse(row.content),\n};\n} else if (type === messageTypes.CREATE_SUB_THREAD) {\n+ const row = assertSingleRow(rows);\nconst subthreadPermissions = row.subthread_permissions;\nif (!permissionLookup(subthreadPermissions, threadPermissions.KNOW_OF)) {\nreturn null;\n@@ -192,6 +260,7 @@ function rawMessageInfoFromRow(\nchildThreadID: row.content,\n};\n} else if (type === messageTypes.CHANGE_SETTINGS) {\n+ const row = assertSingleRow(rows);\nconst content = JSON.parse(row.content);\nconst field = Object.keys(content)[0];\nreturn {\n@@ -204,6 +273,7 @@ function rawMessageInfoFromRow(\nvalue: content[field],\n};\n} else if (type === messageTypes.REMOVE_MEMBERS) {\n+ const row = assertSingleRow(rows);\nreturn {\ntype: messageTypes.REMOVE_MEMBERS,\nid: row.id.toString(),\n@@ -213,6 +283,7 @@ function rawMessageInfoFromRow(\nremovedUserIDs: JSON.parse(row.content),\n};\n} else if (type === messageTypes.CHANGE_ROLE) {\n+ const row = assertSingleRow(rows);\nconst content = JSON.parse(row.content);\nreturn {\ntype: messageTypes.CHANGE_ROLE,\n@@ -224,6 +295,7 @@ function rawMessageInfoFromRow(\nnewRole: content.newRole,\n};\n} else if (type === messageTypes.LEAVE_THREAD) {\n+ const row = assertSingleRow(rows);\nreturn {\ntype: messageTypes.LEAVE_THREAD,\nid: row.id.toString(),\n@@ -232,6 +304,7 @@ function rawMessageInfoFromRow(\ncreatorID: row.creatorID.toString(),\n};\n} else if (type === messageTypes.JOIN_THREAD) {\n+ const row = assertSingleRow(rows);\nreturn {\ntype: messageTypes.JOIN_THREAD,\nid: row.id.toString(),\n@@ -240,6 +313,7 @@ function rawMessageInfoFromRow(\ncreatorID: row.creatorID.toString(),\n};\n} else if (type === messageTypes.CREATE_ENTRY) {\n+ const row = assertSingleRow(rows);\nconst content = JSON.parse(row.content);\nreturn {\ntype: messageTypes.CREATE_ENTRY,\n@@ -252,6 +326,7 @@ function rawMessageInfoFromRow(\ntext: content.text,\n};\n} else if (type === messageTypes.EDIT_ENTRY) {\n+ const row = assertSingleRow(rows);\nconst content = JSON.parse(row.content);\nreturn {\ntype: messageTypes.EDIT_ENTRY,\n@@ -264,6 +339,7 @@ function rawMessageInfoFromRow(\ntext: content.text,\n};\n} else if (type === messageTypes.DELETE_ENTRY) {\n+ const row = assertSingleRow(rows);\nconst content = JSON.parse(row.content);\nreturn {\ntype: messageTypes.DELETE_ENTRY,\n@@ -276,6 +352,7 @@ function rawMessageInfoFromRow(\ntext: content.text,\n};\n} else if (type === messageTypes.RESTORE_ENTRY) {\n+ const row = assertSingleRow(rows);\nconst content = JSON.parse(row.content);\nreturn {\ntype: messageTypes.RESTORE_ENTRY,\n@@ -287,6 +364,28 @@ function rawMessageInfoFromRow(\ndate: content.date,\ntext: content.text,\n};\n+ } else if (type === messageTypes.MULTIMEDIA) {\n+ const media = [];\n+ for (let row of rows) {\n+ if (!row.uploadID) {\n+ continue;\n+ }\n+ const uploadID = row.uploadID.toString();\n+ media.push({\n+ id: uploadID,\n+ uri: getUploadURL(uploadID, row.uploadSecret),\n+ type: row.uploadType,\n+ });\n+ }\n+ const [ row ] = rows;\n+ return {\n+ type: messageTypes.MULTIMEDIA,\n+ id: row.id.toString(),\n+ threadID: row.threadID.toString(),\n+ time: row.time,\n+ creatorID: row.creatorID.toString(),\n+ media,\n+ };\n} else {\ninvariant(false, `unrecognized messageType ${type}`);\n}\n@@ -307,13 +406,17 @@ async function fetchMessageInfos(\nSELECT * FROM (\nSELECT x.id, x.content, x.time, x.type, x.user AS creatorID,\nx.creation, u.username AS creator, x.subthread_permissions,\n+ x.uploadID, x.uploadType, x.uploadSecret,\n@num := if(@thread = x.thread, @num + 1, 1) AS number,\n@thread := x.thread AS threadID\nFROM (SELECT @num := 0, @thread := '') init\nJOIN (\nSELECT m.id, m.thread, m.user, m.content, m.time, m.type,\n- m.creation, stm.permissions AS subthread_permissions\n+ m.creation, stm.permissions AS subthread_permissions,\n+ up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret\nFROM messages m\n+ LEFT JOIN uploads up ON m.type = ${messageTypes.MULTIMEDIA}\n+ AND JSON_CONTAINS(m.content, CAST(up.id as JSON), '$')\nLEFT JOIN memberships mm\nON mm.thread = m.thread AND mm.user = ${viewerID}\nLEFT JOIN memberships stm ON m.type = ${messageTypes.CREATE_SUB_THREAD}\n@@ -330,20 +433,14 @@ async function fetchMessageInfos(\n`);\nconst [ result ] = await dbQuery(query);\n+ const { userInfos, messages } = parseMessageSQLResult(result);\n+\nconst rawMessageInfos = [];\n- const userInfos = {};\nconst threadToMessageCount = new Map();\n- for (let row of result) {\n- const creatorID = row.creatorID.toString();\n- userInfos[creatorID] = {\n- id: creatorID,\n- username: row.creator,\n- };\n- const rawMessageInfo = rawMessageInfoFromRow(row, viewer);\n- if (rawMessageInfo) {\n+ for (let message of messages) {\n+ const { rawMessageInfo } = message;\nrawMessageInfos.push(rawMessageInfo);\n- }\n- const threadID = row.threadID.toString();\n+ const { threadID } = rawMessageInfo;\nconst currentCountValue = threadToMessageCount.get(threadID);\nconst currentCount = currentCountValue ? currentCountValue : 0;\nthreadToMessageCount.set(threadID, currentCount + 1);\n@@ -476,8 +573,11 @@ async function fetchMessageInfosSince(\nconst query = SQL`\nSELECT m.id, m.thread AS threadID, m.content, m.time, m.type,\nm.creation, u.username AS creator, m.user AS creatorID,\n- stm.permissions AS subthread_permissions\n+ stm.permissions AS subthread_permissions,\n+ up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret\nFROM messages m\n+ LEFT JOIN uploads up ON m.type = ${messageTypes.MULTIMEDIA}\n+ AND JSON_CONTAINS(m.content, CAST(up.id as JSON), '$')\nLEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}\nLEFT JOIN memberships stm ON m.type = ${messageTypes.CREATE_SUB_THREAD}\nAND stm.thread = m.content AND stm.user = ${viewerID}\n@@ -491,12 +591,18 @@ async function fetchMessageInfosSince(\n`);\nconst [ result ] = await dbQuery(query);\n+ const {\n+ userInfos: allCreatorUserInfos,\n+ messages,\n+ } = parseMessageSQLResult(result);\n+\nconst rawMessageInfos = [];\nconst userInfos = {};\nlet currentThreadID = null;\nlet numMessagesForCurrentThreadID = 0;\n- for (let row of result) {\n- const threadID = row.threadID.toString();\n+ for (let message of messages) {\n+ const { rawMessageInfo } = message;\n+ const { threadID } = rawMessageInfo;\nif (threadID !== currentThreadID) {\ncurrentThreadID = threadID;\nnumMessagesForCurrentThreadID = 1;\n@@ -505,19 +611,16 @@ async function fetchMessageInfosSince(\nnumMessagesForCurrentThreadID++;\n}\nif (numMessagesForCurrentThreadID <= maxNumberPerThread) {\n- if (row.type === messageTypes.CREATE_THREAD) {\n+ if (rawMessageInfo.type === messageTypes.CREATE_THREAD) {\n// If a CREATE_THREAD message is here, then we have all messages\ntruncationStatuses[threadID] = messageTruncationStatus.EXHAUSTIVE;\n}\n- const creatorID = row.creatorID.toString();\n- userInfos[creatorID] = {\n- id: creatorID,\n- username: row.creator,\n- };\n- const rawMessageInfo = rawMessageInfoFromRow(row, viewer);\n- if (rawMessageInfo) {\n- rawMessageInfos.push(rawMessageInfo);\n+ const { creatorID } = rawMessageInfo;\n+ const userInfo = allCreatorUserInfos[creatorID];\n+ if (userInfo) {\n+ userInfos[creatorID] = userInfo;\n}\n+ rawMessageInfos.push(rawMessageInfo);\n} else if (numMessagesForCurrentThreadID === maxNumberPerThread + 1) {\ntruncationStatuses[threadID] = messageTruncationStatus.TRUNCATED;\n}\n@@ -568,8 +671,11 @@ async function fetchMessageInfoForLocalID(\nconst viewerID = viewer.id;\nconst query = SQL`\nSELECT m.id, m.thread AS threadID, m.content, m.time, m.type, m.creation,\n- m.user AS creatorID, stm.permissions AS subthread_permissions\n+ m.user AS creatorID, stm.permissions AS subthread_permissions,\n+ up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret\nFROM messages m\n+ LEFT JOIN uploads up ON m.type = ${messageTypes.MULTIMEDIA}\n+ AND JSON_CONTAINS(m.content, CAST(up.id as JSON), '$')\nLEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}\nLEFT JOIN memberships stm ON m.type = ${messageTypes.CREATE_SUB_THREAD}\nAND stm.thread = m.content AND stm.user = ${viewerID}\n@@ -581,7 +687,7 @@ async function fetchMessageInfoForLocalID(\nif (result.length === 0) {\nreturn null;\n}\n- return rawMessageInfoFromRow(result[0], viewer);\n+ return rawMessageInfoFromRows(result, viewer);\n}\nconst entryIDExtractString = \"$.entryID\";\n@@ -594,8 +700,11 @@ async function fetchMessageInfoForEntryAction(\nconst viewerID = viewer.id;\nconst query = SQL`\nSELECT m.id, m.thread AS threadID, m.content, m.time, m.type, m.creation,\n- m.user AS creatorID\n+ m.user AS creatorID, up.id AS uploadID, up.type AS uploadType,\n+ up.secret AS uploadSecret\nFROM messages m\n+ LEFT JOIN uploads up ON m.type = ${messageTypes.MULTIMEDIA}\n+ AND JSON_CONTAINS(m.content, CAST(up.id as JSON), '$')\nLEFT JOIN memberships mm ON mm.thread = m.thread AND mm.user = ${viewerID}\nWHERE m.user = ${viewerID} AND m.thread = ${threadID} AND\nm.type = ${messageType} AND\n@@ -607,7 +716,7 @@ async function fetchMessageInfoForEntryAction(\nif (result.length === 0) {\nreturn null;\n}\n- return rawMessageInfoFromRow(result[0], viewer);\n+ return rawMessageInfoFromRows(result, viewer);\n}\nexport {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Support fetching messageTypes.MULTIMEDIA
This required refactoring `message-fetchers` so it could handle parsing multiple rows per `RawMessageInfo`. |
129,187 | 20.02.2019 14:01:12 | 18,000 | 0974acdf150edaa7b85ef16e2f0b2e625d47bb26 | [lib] Support notifs on messageTypes.MULTIMEDIA | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/media-utils.js",
"new_path": "lib/shared/media-utils.js",
"diff": "@@ -17,11 +17,11 @@ function contentStringForMediaArray(media: $ReadOnlyArray<Media>): string {\nif (firstType === single.type) {\ncontinue;\n} else {\n- return \"media\";\n+ return \"some media\";\n}\n}\ninvariant(firstType, \"there should be some media\");\n- return `${firstType}s`;\n+ return `some ${firstType}s`;\n}\nexport {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/notif-utils.js",
"new_path": "lib/shared/notif-utils.js",
"diff": "@@ -21,6 +21,7 @@ import { stringForUser } from './user-utils';\nimport { prettyDate } from '../utils/date-utils';\nimport { pluralize } from '../utils/text-utils';\nimport { values } from '../utils/objects';\n+import { contentStringForMediaArray } from './media-utils';\nconst notificationPressActionType = \"NOTIFICATION_PRESS\";\n@@ -64,7 +65,7 @@ function notifThreadName(threadInfo: ThreadInfo): string {\n}\nfunction assertSingleMessageInfo(\n- messageInfos: MessageInfo[],\n+ messageInfos: $ReadOnlyArray<MessageInfo>,\n): MessageInfo {\nif (messageInfos.length === 0) {\nthrow new Error(\"expected single MessageInfo, but none present!\");\n@@ -79,7 +80,7 @@ function assertSingleMessageInfo(\n}\nfunction mostRecentMessageInfoType(\n- messageInfos: MessageInfo[],\n+ messageInfos: $ReadOnlyArray<MessageInfo>,\n): MessageType {\nif (messageInfos.length === 0) {\nthrow new Error(\"expected MessageInfo, but none present!\");\n@@ -286,6 +287,25 @@ function fullNotifTextForMessageInfo(\n\"messageInfo should be messageTypes.CHANGE_SETTINGS!\",\n);\nreturn strippedRobotextForMessageInfo(mostRecentMessageInfo, threadInfo);\n+ } else if (mostRecentType === messageTypes.MULTIMEDIA) {\n+ const media = [];\n+ for (let messageInfo of messageInfos) {\n+ invariant(\n+ messageInfo.type === messageTypes.MULTIMEDIA,\n+ \"messageInfo should be messageTypes.MULTIMEDIA!\",\n+ );\n+ for (let singleMedia of messageInfo.media) {\n+ media.push(singleMedia);\n+ }\n+ }\n+ const contentString = contentStringForMediaArray(media);\n+ const userString = stringForUser(messageInfos[0].creator);\n+ if (!threadInfo.name && threadIsTwoPersonChat(threadInfo)) {\n+ return `${userString} sent you ${contentString}`;\n+ } else {\n+ const threadName = notifThreadName(threadInfo);\n+ return `${userString} send ${contentString} to ${threadName}`;\n+ }\n} else {\ninvariant(false, `we're not aware of messageType ${mostRecentType}`);\n}\n@@ -310,7 +330,8 @@ function notifCollapseKeyForRawMessageInfo(\n): ?string {\nif (\nrawMessageInfo.type === messageTypes.ADD_MEMBERS ||\n- rawMessageInfo.type === messageTypes.REMOVE_MEMBERS\n+ rawMessageInfo.type === messageTypes.REMOVE_MEMBERS ||\n+ rawMessageInfo.type === messageTypes.MULTIMEDIA\n) {\nreturn joinResult(\nrawMessageInfo.type,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Support notifs on messageTypes.MULTIMEDIA |
129,187 | 20.02.2019 15:57:10 | 18,000 | 3b6e49f13d4d58fc54b8ad60029625d2d0bd31fc | [server] assignMedia | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/message-responders.js",
"new_path": "server/src/responders/message-responders.js",
"diff": "@@ -14,6 +14,7 @@ import {\n} from 'lib/types/message-types';\nimport t from 'tcomb';\n+import invariant from 'invariant';\nimport { ServerError } from 'lib/utils/errors';\nimport { threadPermissions } from 'lib/types/thread-types';\n@@ -23,6 +24,7 @@ import { validateInput, tShape } from '../utils/validation-utils';\nimport { checkThreadPermission } from '../fetchers/thread-fetchers';\nimport { fetchMessageInfos } from '../fetchers/message-fetchers';\nimport { fetchMedia } from '../fetchers/upload-fetchers';\n+import { assignMedia } from '../updaters/upload-updaters';\nconst sendTextMessageRequestInputValidator = tShape({\nthreadID: t.String,\n@@ -127,9 +129,16 @@ async function multimediaMessageCreationResponder(\ntime: Date.now(),\nmedia,\n};\n- const rawMessageInfos = await createMessages(viewer, [messageData]);\n+ const [ newMessageInfo ] = await createMessages(viewer, [messageData]);\n- return { newMessageInfo: rawMessageInfos[0] };\n+ const { id } = newMessageInfo;\n+ invariant(\n+ id !== null && id !== undefined,\n+ \"serverID should be set in createMessages result\",\n+ );\n+ await assignMedia(viewer, mediaIDs, id);\n+\n+ return { newMessageInfo };\n}\nexport {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/updaters/upload-updaters.js",
"diff": "+// @flow\n+\n+import type { Viewer } from '../session/viewer';\n+\n+import { dbQuery, SQL } from '../database';\n+\n+async function assignMedia(\n+ viewer: Viewer,\n+ mediaIDs: $ReadOnlyArray<string>,\n+ containerID: string,\n+): Promise<void> {\n+ const query = SQL`\n+ UPDATE uploads\n+ SET container = ${containerID}\n+ WHERE id IN (${mediaIDs}) AND uploader = ${viewer.id} AND container IS NULL\n+ `;\n+ await dbQuery(query);\n+}\n+\n+export {\n+ assignMedia,\n+};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] assignMedia |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.