Fix links with no thumbnail having previous link's thumbnail (#3720)

Co-authored-by: zneix <zneix@zneix.eu>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
qooq69 2022-05-22 13:16:16 +02:00 committed by GitHub
parent 6bb96f128b
commit 1b3aa343a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 19 deletions

View file

@ -23,6 +23,7 @@
- Bugfix: Fixed existing emote popups not being raised from behind other windows when refocusing them on macOS (#3713) - Bugfix: Fixed existing emote popups not being raised from behind other windows when refocusing them on macOS (#3713)
- Bugfix: Fixed automod queue pubsub topic persisting after user change. (#3718) - Bugfix: Fixed automod queue pubsub topic persisting after user change. (#3718)
- Bugfix: Fixed viewer list not closing after pressing escape key. (#3734) - Bugfix: Fixed viewer list not closing after pressing escape key. (#3734)
- Bugfix: Fixed links with no thumbnail having previous link's thumbnail. (#3720)
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662) - Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
## 2.3.5 ## 2.3.5

View file

@ -26,18 +26,22 @@ void LinkResolver::getLinkInfo(
QUrl::toPercentEncoding(url, "", "/:")))) QUrl::toPercentEncoding(url, "", "/:"))))
.caller(caller) .caller(caller)
.timeout(30000) .timeout(30000)
.onSuccess( .onSuccess([successCallback,
[successCallback, url](NetworkResult result) mutable -> Outcome { url](NetworkResult result) mutable -> Outcome {
auto root = result.parseJson(); auto root = result.parseJson();
auto statusCode = root.value("status").toInt(); auto statusCode = root.value("status").toInt();
QString response = QString(); QString response;
QString linkString = url; QString linkString = url;
ImagePtr thumbnail = nullptr; ImagePtr thumbnail = nullptr;
if (statusCode == 200) if (statusCode == 200)
{ {
response = root.value("tooltip").toString(); response = root.value("tooltip").toString();
if (root.contains("thumbnail"))
{
thumbnail = thumbnail =
Image::fromUrl({root.value("thumbnail").toString()}); Image::fromUrl({root.value("thumbnail").toString()});
}
if (getSettings()->unshortLinks) if (getSettings()->unshortLinks)
{ {
linkString = root.value("link").toString(); linkString = root.value("link").toString();