Cherrypick Room URL preview settings to 23.04

- Add the ability to set the deafult url preview setting for the room if you have sufficient power level.
- Add the ability for the user to set the desired url preview setting.

network/neochat#560


(cherry picked from commit 81c73037ca)
This commit is contained in:
James Graham
2023-03-13 18:45:18 +00:00
parent da1c664f94
commit 8b26a9f45f
4 changed files with 147 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ Loader {
*/
property bool indicatorEnabled: false
active: !currentRoom.usesEncryption && model.display && links && links.length > 0
active: !currentRoom.usesEncryption && model.display && links && links.length > 0 && currentRoom.urlPreviewEnabled
visible: Config.showLinkPreview && active
sourceComponent: linkPreviewer.loaded ? linkPreviewComponent : loadingComponent

View File

@@ -263,6 +263,32 @@ Kirigami.ScrollablePage {
}
}
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("URL Previews")
}
MobileForm.FormCheckDelegate {
text: i18n("Enable URL previews by default for room members")
checked: room.defaultUrlPreviewState
visible: room.canSendState("org.matrix.room.preview_urls")
onToggled: {
room.defaultUrlPreviewState = checked
}
}
MobileForm.FormCheckDelegate {
text: i18n("Enable URL previews")
// Most users won't see the above setting so tell them the default.
description: room.defaultUrlPreviewState ? i18n("URL previews are enabled by default in this room") : i18n("URL previews are disabled by default in this room")
checked: room.urlPreviewEnabled
onToggled: {
room.urlPreviewEnabled = checked
}
}
}
}
Kirigami.InlineMessage {
Layout.fillWidth: true