diff --git a/saoriview.cpp b/saoriview.cpp index 8a3ef9d..7f602b9 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -259,7 +259,7 @@ htmlAnc("accounts:" + json["account"].toObject()["id"].toString() + ":statuses", htmlDiv("reblogger",htmlHr() + htmlImg("mavatar",json["account"].toObject()["avatar"].toString()) + - tr("boosted by: %1").arg(json["account"].toObject()["display_name"].toString()) + tr("boosted by: %1").arg(visiblenameFromAccountdata(json["account"].toObject())) ) ) ) : @@ -407,19 +407,19 @@ switch (type.indexOf(json["type"].toString())) { case 0: title += htmlImg("mavatar",SAORI_ICONS_CHAT); - title += tr("%1 mentioned your status.").arg(json["account"].toObject()["display_name"].toString()); + title += tr("%1 mentioned your status.").arg(visiblenameFromAccountdata(json["account"].toObject())); break; case 1: title += htmlImg("mavatar",SAORI_ICONS_SHARE); - title += tr("%1 boosted your status.").arg(json["account"].toObject()["display_name"].toString()); + title += tr("%1 boosted your status.").arg(visiblenameFromAccountdata(json["account"].toObject())); break; case 2: title += htmlImg("mavatar",SAORI_ICONS_STAR); - title += tr("%1 favourited your status.").arg(json["account"].toObject()["display_name"].toString()); + title += tr("%1 favourited your status.").arg(visiblenameFromAccountdata(json["account"].toObject())); break; case 3: title += htmlImg("mavatar",SAORI_ICONS_PERSONADD); - title += tr("%1 followed you.").arg(json["account"].toObject()["display_name"].toString()); + title += tr("%1 followed you.").arg(visiblenameFromAccountdata(json["account"].toObject())); break; default: break; @@ -432,7 +432,7 @@ htmlAnc("accounts:" + json["account"].toObject()["id"].toString() + ":statuses", htmlDiv("reblogger",htmlHr() + htmlImg("mavatar",json["account"].toObject()["avatar"].toString()) + - tr("%1 (@%2)").arg(json["account"].toObject()["display_name"].toString(), + tr("%1 (@%2)").arg(visiblenameFromAccountdata(json["account"].toObject()), json["account"].toObject()["acct"].toString()) ) ) @@ -445,6 +445,13 @@ return accountParser(json); } +const QString SaoriView::visiblenameFromAccountdata(const QJsonObject account) +{ + return account["display_name"].toString().isEmpty() ? + account["acct"].toString() : + account["display_name"].toString(); +} + const QString SaoriView::htmlDiv(const QString divclass, const QString text) { return QString("