mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
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:
parent
6bb96f128b
commit
1b3aa343a3
2 changed files with 24 additions and 19 deletions
|
@ -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
|
||||||
|
|
|
@ -26,32 +26,36 @@ 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();
|
||||||
|
|
||||||
|
if (root.contains("thumbnail"))
|
||||||
{
|
{
|
||||||
response = root.value("tooltip").toString();
|
|
||||||
thumbnail =
|
thumbnail =
|
||||||
Image::fromUrl({root.value("thumbnail").toString()});
|
Image::fromUrl({root.value("thumbnail").toString()});
|
||||||
if (getSettings()->unshortLinks)
|
|
||||||
{
|
|
||||||
linkString = root.value("link").toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
if (getSettings()->unshortLinks)
|
||||||
{
|
{
|
||||||
response = root.value("message").toString();
|
linkString = root.value("link").toString();
|
||||||
}
|
}
|
||||||
successCallback(QUrl::fromPercentEncoding(response.toUtf8()),
|
}
|
||||||
Link(Link::Url, linkString), thumbnail);
|
else
|
||||||
|
{
|
||||||
|
response = root.value("message").toString();
|
||||||
|
}
|
||||||
|
successCallback(QUrl::fromPercentEncoding(response.toUtf8()),
|
||||||
|
Link(Link::Url, linkString), thumbnail);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
})
|
})
|
||||||
.onError([successCallback, url](auto /*result*/) {
|
.onError([successCallback, url](auto /*result*/) {
|
||||||
successCallback("No link info found", Link(Link::Url, url),
|
successCallback("No link info found", Link(Link::Url, url),
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
Loading…
Reference in a new issue