summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2024-01-06 14:38:45 +0000
committerGitHub <noreply@github.com>2024-01-06 14:38:45 +0000
commit45cc7ab6f7e3a9fa18ac9e970ce7c50782e88c97 (patch)
tree07a00617d3bba087a9cbc0796f299b113c54ec7d /src/ui
parentTranslated using Weblate (Portuguese (Portugal)) (diff)
parentdeleteLater() on failure (diff)
downloadnheko-45cc7ab6f7e3a9fa18ac9e970ce7c50782e88c97.tar.xz
Merge pull request #1635 from NepNep21/ignore-command
Add /ignore, fixes #1634
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/UserProfile.cpp17
-rw-r--r--src/ui/UserProfile.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/ui/UserProfile.cpp b/src/ui/UserProfile.cpp

index 338f3658..c7254e23 100644 --- a/src/ui/UserProfile.cpp +++ b/src/ui/UserProfile.cpp
@@ -278,6 +278,17 @@ UserProfile::setIgnored(bool ignore) .arg(userid, QString::fromStdString(e->matrix_error.error))); } }); + + if (ignore) { + const QHash<QString, RoomInfo> invites = cache::invites(); + FilteredRoomlistModel *room_model = FilteredRoomlistModel::instance(); + + for (auto room = invites.keyBegin(), end = invites.keyEnd(); room != end; room++) { + if (room_model->getRoomPreviewById(*room).inviterUserId() == userid) { + room_model->declineInvite(*room); + } + } + } } void @@ -592,12 +603,18 @@ UserProfile::getGlobalProfileData() emit avatarUrlChanged(); }); + connect(profProx.get(), + &UserProfileFetchProxy::failedToFetchProfile, + this, + &UserProfile::failedToFetchProfile); + http::client()->get_profile(userid_.toStdString(), [prox = std::move(profProx), user = userid_.toStdString()]( const mtx::responses::Profile &res, mtx::http::RequestErr err) { if (err) { nhlog::net()->warn("failed to retrieve profile info for {}", user); + emit prox->failedToFetchProfile(); return; } diff --git a/src/ui/UserProfile.h b/src/ui/UserProfile.h
index bc5b6a35..64dbf99c 100644 --- a/src/ui/UserProfile.h +++ b/src/ui/UserProfile.h
@@ -45,6 +45,7 @@ public: signals: void profileFetched(mtx::responses::Profile); + void failedToFetchProfile(); }; class DeviceInfo @@ -205,6 +206,7 @@ signals: void globalUsernameRetrieved(const QString &globalUser); void devicesChanged(); void ignoredChanged(); + void failedToFetchProfile(); // internal void verificationStatiChanged();