aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/room.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 18dacbaa..2930875f 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -836,10 +836,17 @@ void Room::resetHighlightCount()
void Room::switchVersion(QString newVersion)
{
- auto* job = connection()->callApi<UpgradeRoomJob>(id(), newVersion);
- connect(job, &BaseJob::failure, this, [this,job] {
- emit upgradeFailed(job->errorString());
- });
+ if (!successorId().isEmpty())
+ {
+ Q_ASSERT(!successorId().isEmpty());
+ emit upgradeFailed(tr("The room is already upgraded"));
+ }
+ if (auto* job = connection()->callApi<UpgradeRoomJob>(id(), newVersion))
+ connect(job, &BaseJob::failure, this, [this,job] {
+ emit upgradeFailed(job->errorString());
+ });
+ else
+ emit upgradeFailed(tr("Couldn't initiate upgrade"));
}
bool Room::hasAccountData(const QString& type) const