Add Ban to member context menu
Also don't try to load past messages in rooms we've left/been kicked/banned from.
This commit is contained in:
parent
2d231b7af1
commit
2cc3f27247
3
TODO.md
3
TODO.md
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
- Make clicking on user/room mentions open relevant UI instead of matrix.to
|
- Make clicking on user/room mentions open relevant UI instead of matrix.to
|
||||||
URL in browser
|
URL in browser
|
||||||
- Make rooms fully manageable within Mirage: settings, permissions, kick, etc
|
- Make rooms fully manageable within Mirage: settings, permissions, unban
|
||||||
|
|
||||||
- Labeled text area component, use it for room creation/settings topic
|
- Labeled text area component, use it for room creation/settings topic
|
||||||
- Linkify URLs in topic text areas
|
- Linkify URLs in topic text areas
|
||||||
|
@ -185,7 +185,6 @@
|
||||||
- `RoomMessageMedia` and `RoomAvatarEvent` info attributes
|
- `RoomMessageMedia` and `RoomAvatarEvent` info attributes
|
||||||
- Handle `m.room.aliases` events
|
- Handle `m.room.aliases` events
|
||||||
|
|
||||||
- Support "Empty room (was ...)" after peer left
|
|
||||||
- Left room events after client reboot
|
- Left room events after client reboot
|
||||||
- Previewing room without joining
|
- Previewing room without joining
|
||||||
|
|
||||||
|
|
|
@ -698,7 +698,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
|
|
||||||
if room_id in self.fully_loaded_rooms or \
|
if room_id in self.fully_loaded_rooms or \
|
||||||
room_id in self.invited_rooms or \
|
room_id in self.invited_rooms or \
|
||||||
room_id in self.cleared_events_rooms:
|
room_id in self.cleared_events_rooms or \
|
||||||
|
self.models[self.user_id, "rooms"][room_id].left:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
await self.first_sync_done.wait()
|
await self.first_sync_done.wait()
|
||||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick 2.12
|
||||||
import Clipboard 0.1
|
import Clipboard 0.1
|
||||||
import "../../../Base"
|
import "../../../Base"
|
||||||
import "../../../Base/HTile"
|
import "../../../Base/HTile"
|
||||||
|
import "../../../Popups"
|
||||||
|
|
||||||
HTileDelegate {
|
HTileDelegate {
|
||||||
id: member
|
id: member
|
||||||
|
@ -59,14 +60,17 @@ HTileDelegate {
|
||||||
text: model.invited ? qsTr("Disinvite") : qsTr("Kick")
|
text: model.invited ? qsTr("Disinvite") : qsTr("Kick")
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
popup: "Popups/KickPopup.qml"
|
popup: "Popups/RemoveMemberPopup.qml"
|
||||||
popupParent: chat
|
popupParent: chat
|
||||||
properties: ({
|
properties: ({
|
||||||
userId: chat.userId,
|
userId: chat.userId,
|
||||||
roomId: chat.roomId,
|
roomId: chat.roomId,
|
||||||
targetUserId: model.id,
|
targetUserId: model.id,
|
||||||
targetDisplayName: model.display_name,
|
targetDisplayName: model.display_name,
|
||||||
targetIsInvited: model.invited,
|
operation:
|
||||||
|
model.invited ?
|
||||||
|
RemoveMemberPopup.Operation.Disinvite :
|
||||||
|
RemoveMemberPopup.Operation.Kick,
|
||||||
})
|
})
|
||||||
|
|
||||||
Component.onCompleted: py.callClientCoro(
|
Component.onCompleted: py.callClientCoro(
|
||||||
|
@ -76,6 +80,30 @@ HTileDelegate {
|
||||||
can => { enabled = can },
|
can => { enabled = can },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HMenuItemPopupSpawner {
|
||||||
|
icon.name: "room-ban"
|
||||||
|
icon.color: theme.colors.negativeBackground
|
||||||
|
text: qsTr("Ban")
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
popup: "Popups/RemoveMemberPopup.qml"
|
||||||
|
popupParent: chat
|
||||||
|
properties: ({
|
||||||
|
userId: chat.userId,
|
||||||
|
roomId: chat.roomId,
|
||||||
|
targetUserId: model.id,
|
||||||
|
targetDisplayName: model.display_name,
|
||||||
|
operation: RemoveMemberPopup.Operation.Ban,
|
||||||
|
})
|
||||||
|
|
||||||
|
Component.onCompleted: py.callClientCoro(
|
||||||
|
chat.userId,
|
||||||
|
"can_ban",
|
||||||
|
[chat.roomId, model.id],
|
||||||
|
can => { enabled = can },
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,39 @@ import "../Base"
|
||||||
BoxPopup {
|
BoxPopup {
|
||||||
summary.textFormat: Text.StyledText
|
summary.textFormat: Text.StyledText
|
||||||
summary.text:
|
summary.text:
|
||||||
targetIsInvited ?
|
operation === RemoveMemberPopup.Operation.Disinvite ?
|
||||||
qsTr("Withdraw %1's invitation?").arg(coloredTarget) :
|
qsTr("Disinvite %1 from the room?").arg(coloredTarget) :
|
||||||
qsTr("Kick %1 out of the room?").arg(coloredTarget)
|
|
||||||
|
|
||||||
okText: qsTr("Kick")
|
operation === RemoveMemberPopup.Operation.Kick ?
|
||||||
|
qsTr("Kick %1 out of the room?").arg(coloredTarget) :
|
||||||
|
|
||||||
|
qsTr("Ban %1 from the room?").arg(coloredTarget)
|
||||||
|
|
||||||
|
okText:
|
||||||
|
operation === RemoveMemberPopup.Operation.Disinvite ?
|
||||||
|
qsTr("Disinvite") :
|
||||||
|
|
||||||
|
operation === RemoveMemberPopup.Operation.Kick ?
|
||||||
|
qsTr("Kick") :
|
||||||
|
|
||||||
|
qsTr("Ban")
|
||||||
|
|
||||||
onOpened: reasonField.field.forceActiveFocus()
|
onOpened: reasonField.field.forceActiveFocus()
|
||||||
onOk: py.callClientCoro(
|
onOk: py.callClientCoro(
|
||||||
userId,
|
userId,
|
||||||
"room_kick",
|
operation === RemoveMemberPopup.Operation.Ban ?
|
||||||
|
"room_ban" : "room_kick",
|
||||||
[roomId, targetUserId, reasonField.field.text || null],
|
[roomId, targetUserId, reasonField.field.text || null],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
enum Operation { Disinvite, Kick, Ban }
|
||||||
|
|
||||||
property string userId
|
property string userId
|
||||||
property string roomId
|
property string roomId
|
||||||
property string targetUserId
|
property string targetUserId
|
||||||
property string targetDisplayName
|
property string targetDisplayName
|
||||||
property bool targetIsInvited: false
|
property int operation
|
||||||
|
|
||||||
readonly property string coloredTarget:
|
readonly property string coloredTarget:
|
||||||
utils.coloredNameHtml(targetDisplayName, targetUserId)
|
utils.coloredNameHtml(targetDisplayName, targetUserId)
|
3
src/icons/thin/room-ban.svg
Normal file
3
src/icons/thin/room-ban.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="m12 0c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm9 12c0 1.94-.624 3.735-1.672 5.207l-12.535-12.535c1.472-1.048 3.267-1.672 5.207-1.672 4.962 0 9 4.038 9 9zm-18 0c0-1.94.624-3.735 1.672-5.207l12.534 12.534c-1.471 1.049-3.266 1.673-5.206 1.673-4.962 0-9-4.038-9-9z"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 397 B |
Loading…
Reference in New Issue
Block a user