forked from qt-creator/qt-creator
Gerrit: Resolve also user name from gerrit response
If gerrit provides it (version >= 2.10). Change-Id: I7087be338e954fa13eb4a9fcc4f848d6272a46d6 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
8795ec0beb
commit
75273506c1
@@ -223,8 +223,13 @@ int GerritServer::testConnection()
|
||||
QString output = resp.stdOut();
|
||||
output.remove(0, output.indexOf('\n')); // Strip first line
|
||||
QJsonDocument doc = QJsonDocument::fromJson(output.toUtf8());
|
||||
if (!doc.isNull())
|
||||
user.fullName = doc.object().value("name").toString();
|
||||
if (!doc.isNull()) {
|
||||
const QJsonObject obj = doc.object();
|
||||
user.fullName = obj.value("name").toString();
|
||||
const QString userName = obj.value("username").toString();
|
||||
if (!userName.isEmpty())
|
||||
user.userName = userName;
|
||||
}
|
||||
return 200;
|
||||
}
|
||||
const QRegularExpression errorRegexp("returned error: (\\d+)");
|
||||
|
||||
Reference in New Issue
Block a user