Skip to content

Commit

Permalink
Switch from m.content_warning to town.robin.msc3725.content_warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudrac3r committed Sep 8, 2023
1 parent 5735af5 commit 3fb8e2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ContentMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ export default class ContentMessages {

// Attach content warning
if (contentWarning) {
content["m.content_warning"] = {
content["town.robin.msc3725.content_warning"] = {

Check failure on line 501 in src/ContentMessages.ts

View workflow job for this annotation

GitHub Actions / Typescript Strict Error Checker (--strict --noImplicitAny)

Property 'town.robin.msc3725.content_warning' does not exist on type 'Omit<IMediaEventContent, "info"> & { info: Partial<IMediaEventInfo>; }'.

src/ContentMessages.ts:501:13 - Element implicitly has an 'any' type because expression of type '"town.robin.msc3725.content_warning"' can't be used to index type 'Omit<IMediaEventContent, "info"> & { info: Partial<IMediaEventInfo>; }'.

Check failure on line 501 in src/ContentMessages.ts

View workflow job for this annotation

GitHub Actions / Typescript Strict Error Checker (--noImplicitAny)

Property 'town.robin.msc3725.content_warning' does not exist on type 'Omit<IMediaEventContent, "info"> & { info: Partial<IMediaEventInfo>; }'.

src/ContentMessages.ts:501:13 - Element implicitly has an 'any' type because expression of type '"town.robin.msc3725.content_warning"' can't be used to index type 'Omit<IMediaEventContent, "info"> & { info: Partial<IMediaEventInfo>; }'.
type: "m.spoiler" // Since the UI checkbox is labelled "Spoiler"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/messages/MImageBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
imgError: false,
imgLoaded: false,
hover: false,
showImage: SettingsStore.getValue("showImages") && !this.props.mxEvent.getContent()["m.content_warning"],
showImage: SettingsStore.getValue("showImages") && !this.props.mxEvent.getContent()["town.robin.msc3725.content_warning"],
placeholder: Placeholder.NoImage,
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/messages/MVideoBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
decryptedUrl: `data:${mimetype},`,
decryptedThumbnailUrl: thumbnailUrl || `data:${mimetype},`,
decryptedBlob: null,
showVideo: !content?.["m.content_warning"],
showVideo: !content?.["town.robin.msc3725.content_warning"],
});
}
} catch (err) {
Expand All @@ -190,7 +190,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
} else { // not encrypted
const content = this.props.mxEvent.getContent<IMediaEventContent>();
this.setState({
showVideo: !content?.["m.content_warning"],
showVideo: !content?.["town.robin.msc3725.content_warning"],
})
}
}
Expand Down

0 comments on commit 3fb8e2b

Please sign in to comment.