Refactor and fix invitations
-Move invitation handling into RoomPage and delete InvitationPage -Open the new room after accepting the invitation
This commit is contained in:
@@ -75,6 +75,12 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
|
||||
connect(this, &Room::aboutToAddHistoricalMessages, this, &NeoChatRoom::readMarkerLoadedChanged);
|
||||
|
||||
connect(this, &Quotient::Room::eventsHistoryJobChanged, this, &NeoChatRoom::lastActiveTimeChanged);
|
||||
|
||||
connect(this, &Room::joinStateChanged, this, [=](JoinState oldState, JoinState newState) {
|
||||
if(oldState == JoinState::Invite && newState != JoinState::Invite) {
|
||||
Q_EMIT isInviteChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void NeoChatRoom::uploadFile(const QUrl &url, const QString &body)
|
||||
@@ -685,3 +691,8 @@ bool NeoChatRoom::readMarkerLoaded() const
|
||||
const auto it = findInTimeline(readMarkerEventId());
|
||||
return it != timelineEdge();
|
||||
}
|
||||
|
||||
bool NeoChatRoom::isInvite() const
|
||||
{
|
||||
return joinState() == JoinState::Invite;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class NeoChatRoom : public Room
|
||||
Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false)
|
||||
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
||||
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
||||
|
||||
public:
|
||||
explicit NeoChatRoom(Connection *connection, QString roomId, JoinState joinState = {});
|
||||
@@ -102,6 +103,8 @@ public:
|
||||
Q_INVOKABLE [[nodiscard]] bool canSendEvent(const QString &eventType) const;
|
||||
Q_INVOKABLE [[nodiscard]] bool canSendState(const QString &eventType) const;
|
||||
|
||||
bool isInvite() const;
|
||||
|
||||
private:
|
||||
QString m_cachedInput;
|
||||
QSet<const Quotient::RoomEvent *> highlights;
|
||||
@@ -128,6 +131,7 @@ Q_SIGNALS:
|
||||
void backgroundChanged();
|
||||
void readMarkerLoadedChanged();
|
||||
void lastActiveTimeChanged();
|
||||
void isInviteChanged();
|
||||
|
||||
public Q_SLOTS:
|
||||
void uploadFile(const QUrl &url, const QString &body = QString());
|
||||
|
||||
Reference in New Issue
Block a user