From 9f9400d009af2e1a1c40dee604dc05e5b27c47a3 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 3 Mar 2022 10:29:32 +0100 Subject: [PATCH 1/4] use LocationAssetType Signed-off-by: Kerry Archibald --- res/css/views/messages/_MLocationBody.scss | 2 +- src/components/views/messages/MLocationBody.tsx | 6 +++--- test/components/views/messages/MLocationBody-test.tsx | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/res/css/views/messages/_MLocationBody.scss b/res/css/views/messages/_MLocationBody.scss index de2a3305220..e4f1787e91a 100644 --- a/res/css/views/messages/_MLocationBody.scss +++ b/res/css/views/messages/_MLocationBody.scss @@ -63,7 +63,7 @@ limitations under the License. height: 24px; padding-top: 8px; mask-repeat: no-repeat; - mask-size: contain; + mask-size: 16px; mask-position: center; mask-image: url('$(res)/img/element-icons/location.svg'); } diff --git a/src/components/views/messages/MLocationBody.tsx b/src/components/views/messages/MLocationBody.tsx index 5d58822bfbd..0d3ce4eebdb 100644 --- a/src/components/views/messages/MLocationBody.tsx +++ b/src/components/views/messages/MLocationBody.tsx @@ -20,7 +20,7 @@ import { logger } from "matrix-js-sdk/src/logger"; import { MatrixEvent } from 'matrix-js-sdk/src/models/event'; import { ASSET_NODE_TYPE, - ASSET_TYPE_SELF, + LocationAssetType, ILocationContent, LOCATION_EVENT_TYPE, } from 'matrix-js-sdk/src/@types/location'; @@ -130,8 +130,8 @@ export default class MLocationBody extends React.Component { export function isSelfLocation(locationContent: ILocationContent): boolean { const asset = ASSET_NODE_TYPE.findIn(locationContent) as { type: string }; - const assetType = asset?.type ?? ASSET_TYPE_SELF; - return assetType == ASSET_TYPE_SELF; + const assetType = asset?.type ?? LocationAssetType.Self; + return assetType == LocationAssetType.Self; } interface ILocationBodyContentProps { diff --git a/test/components/views/messages/MLocationBody-test.tsx b/test/components/views/messages/MLocationBody-test.tsx index ced6cea3f8e..d5b9665f3a8 100644 --- a/test/components/views/messages/MLocationBody-test.tsx +++ b/test/components/views/messages/MLocationBody-test.tsx @@ -17,6 +17,7 @@ limitations under the License. import { makeLocationContent } from "matrix-js-sdk/src/content-helpers"; import { ASSET_NODE_TYPE, + LocationAssetType, ILocationContent, LOCATION_EVENT_TYPE, TIMESTAMP_NODE_TYPE, @@ -235,7 +236,7 @@ describe("MLocationBody", () => { }); it("Returns false for an unknown asset type", () => { - const content = makeLocationContent("", "", 0, "", "org.example.unknown"); + const content = makeLocationContent("", "", 0, "", "org.example.unknown" as unknown as LocationAssetType); expect(isSelfLocation(content)).toBe(false); }); }); From d873ad8aefe99977eeac7182d9bcddb7828d8be8 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 3 Mar 2022 10:42:19 +0100 Subject: [PATCH 2/4] center icon better Signed-off-by: Kerry Archibald --- res/css/views/messages/_MLocationBody.scss | 7 +++---- src/components/views/messages/MLocationBody.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/res/css/views/messages/_MLocationBody.scss b/res/css/views/messages/_MLocationBody.scss index e4f1787e91a..eefb39004ef 100644 --- a/res/css/views/messages/_MLocationBody.scss +++ b/res/css/views/messages/_MLocationBody.scss @@ -58,10 +58,9 @@ limitations under the License. .mx_MLocationBody_markerContents { background-color: $location-marker-color; - margin: 4px; - width: 24px; - height: 24px; - padding-top: 8px; + margin: 0; + width: 31px; + height: 31px; mask-repeat: no-repeat; mask-size: 16px; mask-position: center; diff --git a/src/components/views/messages/MLocationBody.tsx b/src/components/views/messages/MLocationBody.tsx index 0d3ce4eebdb..4103c6a3f65 100644 --- a/src/components/views/messages/MLocationBody.tsx +++ b/src/components/views/messages/MLocationBody.tsx @@ -131,7 +131,7 @@ export default class MLocationBody extends React.Component { export function isSelfLocation(locationContent: ILocationContent): boolean { const asset = ASSET_NODE_TYPE.findIn(locationContent) as { type: string }; const assetType = asset?.type ?? LocationAssetType.Self; - return assetType == LocationAssetType.Self; + return false && assetType == LocationAssetType.Self; } interface ILocationBodyContentProps { From 3e7a192ba51d9f532e8794b6ebe295ac8d0aa9a9 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 3 Mar 2022 10:46:49 +0100 Subject: [PATCH 3/4] remove debug Signed-off-by: Kerry Archibald --- src/components/views/messages/MLocationBody.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/MLocationBody.tsx b/src/components/views/messages/MLocationBody.tsx index 4103c6a3f65..0d3ce4eebdb 100644 --- a/src/components/views/messages/MLocationBody.tsx +++ b/src/components/views/messages/MLocationBody.tsx @@ -131,7 +131,7 @@ export default class MLocationBody extends React.Component { export function isSelfLocation(locationContent: ILocationContent): boolean { const asset = ASSET_NODE_TYPE.findIn(locationContent) as { type: string }; const assetType = asset?.type ?? LocationAssetType.Self; - return false && assetType == LocationAssetType.Self; + return assetType == LocationAssetType.Self; } interface ILocationBodyContentProps { From a55935e99bde380e9fc07a55f6468ae186ce27de Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Thu, 3 Mar 2022 10:55:29 +0100 Subject: [PATCH 4/4] retrigger all builds Signed-off-by: Kerry Archibald