Add a button to room the upgraded room in the timeline
This commit is contained in:
parent
0035c359ce
commit
952827d629
3 changed files with 55 additions and 1 deletions
|
|
@ -1489,7 +1489,6 @@ TimelineModel::sendEncryptedMessage(mtx::events::RoomEvent<T> msg, mtx::events::
|
|||
const auto room_id = room_id_.toStdString();
|
||||
|
||||
using namespace mtx::events;
|
||||
using namespace mtx::identifiers;
|
||||
|
||||
nlohmann::json doc = {{"type", mtx::events::to_string(eventType)},
|
||||
{"content", nlohmann::json(msg.content)},
|
||||
|
|
@ -2658,6 +2657,32 @@ TimelineModel::showAcceptKnockButton(const QString &id)
|
|||
return event->content.membership == Membership::Knock;
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::joinReplacementRoom(const QString &id)
|
||||
{
|
||||
mtx::events::collections::TimelineEvents *e = events.get(id.toStdString(), "");
|
||||
if (!e)
|
||||
return;
|
||||
|
||||
auto event = std::get_if<mtx::events::StateEvent<mtx::events::state::Tombstone>>(e);
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
auto joined_rooms = cache::joinedRooms();
|
||||
for (const auto &roomid : joined_rooms) {
|
||||
if (roomid == event->content.replacement_room) {
|
||||
manager_->rooms()->setCurrentRoom(
|
||||
QString::fromStdString(event->content.replacement_room));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ChatPage::instance()->joinRoomVia(
|
||||
event->content.replacement_room,
|
||||
{mtx::identifiers::parse<mtx::identifiers::User>(event->sender).hostname()},
|
||||
true);
|
||||
}
|
||||
|
||||
QString
|
||||
TimelineModel::formatMemberEvent(const QString &id)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue