Skip to content

Commit

Permalink
use LocationAssetType (#7965)
Browse files Browse the repository at this point in the history
* use LocationAssetType

Signed-off-by: Kerry Archibald <kerrya@element.io>

* center icon better

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug

Signed-off-by: Kerry Archibald <kerrya@element.io>

* retrigger all builds

Signed-off-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Kerry committed Mar 3, 2022
1 parent 3572b36 commit 7aefa34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 4 additions & 5 deletions res/css/views/messages/_MLocationBody.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ 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: contain;
mask-size: 16px;
mask-position: center;
mask-image: url('$(res)/img/element-icons/location.svg');
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/messages/MLocationBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -130,8 +130,8 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {

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 {
Expand Down
3 changes: 2 additions & 1 deletion test/components/views/messages/MLocationBody-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
});
});
Expand Down

0 comments on commit 7aefa34

Please sign in to comment.