Add button to reject invitation and ignore user
BUG: 474274
This commit is contained in:
@@ -1694,4 +1694,9 @@ void NeoChatRoom::loadReply(const QString &eventId, const QString &replyId)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
User *NeoChatRoom::invitingUser() const
|
||||||
|
{
|
||||||
|
return connection()->user(currentState().get<RoomMemberEvent>(connection()->userId())->senderId());
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_neochatroom.cpp"
|
#include "moc_neochatroom.cpp"
|
||||||
|
|||||||
@@ -794,6 +794,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void loadReply(const QString &eventId, const QString &replyId);
|
Q_INVOKABLE void loadReply(const QString &eventId, const QString &replyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we're invited to this room, the user that invited us. Undefined in other cases.
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE Quotient::User *invitingUser() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSet<const Quotient::RoomEvent *> highlights;
|
QSet<const Quotient::RoomEvent *> highlights;
|
||||||
|
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ void NotificationsManager::postInviteNotification(NeoChatRoom *room, const QStri
|
|||||||
notification->close();
|
notification->close();
|
||||||
RoomManager::instance().enterRoom(room);
|
RoomManager::instance().enterRoom(room);
|
||||||
});
|
});
|
||||||
notification->setActions({i18n("Accept Invitation"), i18n("Reject Invitation")});
|
notification->setActions({i18nc("@action:button The thing being accepted is an invitation to chat", "Accept"), i18nc("@action:button The thing being rejected is an invitation to chat", "Reject"), i18nc("@action:button The thing being rejected is an invitation to chat", "Reject and Ignore User")});
|
||||||
connect(notification, &KNotification::action1Activated, this, [room, notification]() {
|
connect(notification, &KNotification::action1Activated, this, [room, notification]() {
|
||||||
if (!room) {
|
if (!room) {
|
||||||
return;
|
return;
|
||||||
@@ -261,6 +261,14 @@ void NotificationsManager::postInviteNotification(NeoChatRoom *room, const QStri
|
|||||||
RoomManager::instance().leaveRoom(room);
|
RoomManager::instance().leaveRoom(room);
|
||||||
notification->close();
|
notification->close();
|
||||||
});
|
});
|
||||||
|
connect(notification, &KNotification::action3Activated, this, [room, notification]() {
|
||||||
|
if (!room) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RoomManager::instance().leaveRoom(room);
|
||||||
|
room->connection()->addToIgnoredUsers(room->invitingUser());
|
||||||
|
notification->close();
|
||||||
|
});
|
||||||
connect(notification, &KNotification::closed, this, [this, room]() {
|
connect(notification, &KNotification::closed, this, [this, room]() {
|
||||||
if (!room) {
|
if (!room) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -16,6 +16,15 @@ Kirigami.PlaceholderMessage {
|
|||||||
|
|
||||||
text: i18n("Accept this invitation?")
|
text: i18n("Accept this invitation?")
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
QQC2.Button {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: i18nc("@action:button The thing being rejected is an invitation to chat", "Reject and ignore user")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
RoomManager.leaveRoom(root.currentRoom);
|
||||||
|
root.currentRoom.connection.addToIgnoredUsers(root.currentRoom.invitingUser());
|
||||||
|
}
|
||||||
|
}
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
Layout.alignment : Qt.AlignHCenter
|
Layout.alignment : Qt.AlignHCenter
|
||||||
text: i18n("Reject")
|
text: i18n("Reject")
|
||||||
|
|||||||
Reference in New Issue
Block a user