From 030419fa8047ce732b163cbec32a3515bffd2243 Mon Sep 17 00:00:00 2001 From: dkkb <82504881+dkkb@users.noreply.github.com> Date: Wed, 27 Oct 2021 23:19:13 +0800 Subject: [PATCH 1/3] fix: Remove redundant scrollbar from iframe. (#2697) --- shared/embeds/Gist.js | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/embeds/Gist.js b/shared/embeds/Gist.js index c777051e3..405466f54 100644 --- a/shared/embeds/Gist.js +++ b/shared/embeds/Gist.js @@ -67,6 +67,7 @@ class Gist extends React.Component { frameBorder="0" width="100%" height="200px" + scrolling="no" id={`gist-${id}`} title={`Github Gist (${id})`} onLoad={this.updateIframeContent} From 67f06895e78675fad5263e54578fbafc9b90dafc Mon Sep 17 00:00:00 2001 From: dkkb <82504881+dkkb@users.noreply.github.com> Date: Wed, 27 Oct 2021 23:20:39 +0800 Subject: [PATCH 2/3] fix: Support uppercase letters in gist link (#2696) --- shared/embeds/Gist.js | 2 +- shared/embeds/Gist.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/embeds/Gist.js b/shared/embeds/Gist.js index 405466f54..1e2325edf 100644 --- a/shared/embeds/Gist.js +++ b/shared/embeds/Gist.js @@ -2,7 +2,7 @@ import * as React from "react"; const URL_REGEX = new RegExp( - "^https://gist.github.com/([a-z\\d](?:[a-z\\d]|-(?=[a-z\\d])){0,38})/(.*)$" + "^https://gist.github.com/([a-zA-Z\\d](?:[a-zA-Z\\d]|-(?=[a-zA-Z\\d])){0,38})/(.*)$" ); type Props = {| diff --git a/shared/embeds/Gist.test.js b/shared/embeds/Gist.test.js index f625c8492..630451142 100644 --- a/shared/embeds/Gist.test.js +++ b/shared/embeds/Gist.test.js @@ -15,6 +15,12 @@ describe("Gist", () => { match ) ).toBeTruthy(); + + expect( + "https://gist.github.com/ShubhanjanMedhi-dev/900c9c14093611898a4a085938bb90d9".match( + match + ) + ).toBeTruthy(); }); test("to not be enabled elsewhere", () => { From 1641423106a94aa53c5d0d520f9c17a99a3d487f Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 27 Oct 2021 20:12:22 -0700 Subject: [PATCH 3/3] fix: Prevent user.info request loop, keep track of requested users in component state (#2693) --- app/components/Collaborators.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/components/Collaborators.js b/app/components/Collaborators.js index d817e9a21..22f47d3e1 100644 --- a/app/components/Collaborators.js +++ b/app/components/Collaborators.js @@ -1,5 +1,5 @@ // @flow -import { sortBy, filter, uniq } from "lodash"; +import { sortBy, filter, uniq, isEqual } from "lodash"; import { observer } from "mobx-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; @@ -23,6 +23,7 @@ function Collaborators(props: Props) { const { t } = useTranslation(); const user = useCurrentUser(); const currentUserId = user?.id; + const [requestedUserIds, setRequestedUserIds] = React.useState([]); const { users, presence } = useStores(); const { document } = props; @@ -51,18 +52,21 @@ function Collaborators(props: Props) { [document.collaboratorIds, users.orderedData, presentIds] ); - // load any users we don't know about + // load any users we don't yet have in memory React.useEffect(() => { - if (users.isFetching) { - return; + const userIdsToFetch = uniq([ + ...document.collaboratorIds, + ...presentIds, + ]).filter((userId) => users.get(userId)); + + if (!isEqual(requestedUserIds, userIdsToFetch)) { + setRequestedUserIds(userIdsToFetch); } - uniq([...document.collaboratorIds, ...presentIds]).forEach((userId) => { - if (!users.get(userId)) { - return users.fetch(userId); - } - }); - }, [document, users, presentIds, document.collaboratorIds]); + userIdsToFetch + .filter((userId) => requestedUserIds.includes(userId)) + .forEach((userId) => users.fetch(userId)); + }, [document, users, presentIds, document.collaboratorIds, requestedUserIds]); const popover = usePopoverState({ gutter: 0,