fix(LinkPreviews): Fix link preview settings

Removing link preview settings leftovers after integration.
This commit is contained in:
Alex Jbanca 2023-10-26 11:11:26 +03:00 committed by Alex Jbanca
parent b1a8fd6260
commit c22dc23ce0
2 changed files with 4 additions and 12 deletions

View File

@ -238,14 +238,10 @@ proc loadLinkPreviews*(self: Controller, urls: seq[string]) =
self.messageService.asyncUnfurlUrls(urls)
proc setLinkPreviewEnabled*(self: Controller, enabled: bool) =
if enabled and self.settingsService.saveUrlUnfurlingMode(UrlUnfurlingMode.Enabled):
self.linkPreviewPersistentSetting = UrlUnfurlingMode.Enabled
self.linkPreviewCurrentMessageSetting = UrlUnfurlingMode.Enabled
elif not enabled and self.settingsService.saveUrlUnfurlingMode(UrlUnfurlingMode.Disabled):
self.linkPreviewPersistentSetting = UrlUnfurlingMode.Disabled
self.linkPreviewCurrentMessageSetting = UrlUnfurlingMode.Disabled
self.delegate.setAskToEnableLinkPreview(false)
if enabled:
discard self.settingsService.saveUrlUnfurlingMode(UrlUnfurlingMode.Enabled)
return
discard self.settingsService.saveUrlUnfurlingMode(UrlUnfurlingMode.Disabled)
proc onUnfurlingModeChanged(self: Controller, value: UrlUnfurlingMode) =
self.linkPreviewPersistentSetting = value

View File

@ -248,13 +248,9 @@ QtObject:
proc enableLinkPreview(self: View) {.slot.} =
self.delegate.setLinkPreviewEnabled(true)
let links = self.linkPreviewModel.getLinks()
self.linkPreviewModel.clearItems()
self.loadLinkPreviews(links)
proc disableLinkPreview(self: View) {.slot.} =
self.delegate.setLinkPreviewEnabled(false)
self.linkPreviewModel.removeAllPreviewData()
proc setLinkPreviewEnabledForCurrentMessage(self: View, enabled: bool) {.slot.} =
self.delegate.setLinkPreviewEnabledForThisMessage(enabled)