mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
web/timeline: disable url preview images if image previews are disabled
This commit is contained in:
parent
ef05bc71f9
commit
218481f3a4
2 changed files with 4 additions and 2 deletions
|
@ -55,7 +55,7 @@ export const preferences = {
|
|||
}),
|
||||
show_media_previews: new Preference<boolean>({
|
||||
displayName: "Show image and video previews",
|
||||
description: "If disabled, images and videos will only be visible after clicking and will not be downloaded automatically.",
|
||||
description: "If disabled, images and videos will only be visible after clicking and will not be downloaded automatically. This will also disable images in URL previews.",
|
||||
allowedContexts: anyContext,
|
||||
defaultValue: true,
|
||||
}),
|
||||
|
|
|
@ -28,6 +28,8 @@ const URLPreviews = ({ event, room }: {
|
|||
}) => {
|
||||
const client = use(ClientContext)!
|
||||
const renderPreviews = usePreference(client.store, room, "render_url_previews")
|
||||
// TODO support blurhashes and clicking to view image previews here?
|
||||
const showPreviewImages = usePreference(client.store, room, "show_media_previews")
|
||||
if (event.redacted_by || !renderPreviews) {
|
||||
return null
|
||||
}
|
||||
|
@ -72,7 +74,7 @@ const URLPreviews = ({ event, room }: {
|
|||
<a href={url} title={title} target="_blank" rel="noreferrer noopener">{title}</a>
|
||||
</div>
|
||||
<div className="description" title={p["og:description"]}>{p["og:description"]}</div>
|
||||
{mediaURL && (inline
|
||||
{mediaURL && showPreviewImages && (inline
|
||||
? <div className="inline-media-wrapper">{mediaContainer}</div>
|
||||
: mediaContainer)}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue