Fix room forget and buttons bugs
This commit is contained in:
parent
5988eccdbb
commit
c7dd602687
|
@ -93,8 +93,6 @@ class Backend(QObject):
|
||||||
room_id, self.past_tokens[room_id], limit
|
room_id, self.past_tokens[room_id], limit
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
raise ValueError(f"Room not found in any client: {room_id}")
|
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
|
@ -23,6 +23,11 @@ class ListModelMap(QObject):
|
||||||
return self.dict[key]
|
return self.dict[key]
|
||||||
|
|
||||||
|
|
||||||
|
@pyqtSlot(str, result=bool)
|
||||||
|
def has(self, key) -> bool:
|
||||||
|
return key in self.dict
|
||||||
|
|
||||||
|
|
||||||
def __getitem__(self, key) -> ListModel:
|
def __getitem__(self, key) -> ListModel:
|
||||||
return self.dict[key]
|
return self.dict[key]
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,10 @@ class SignalManager(QObject):
|
||||||
.fromMSecsSinceEpoch(edict["server_timestamp"])
|
.fromMSecsSinceEpoch(edict["server_timestamp"])
|
||||||
new_event = RoomEvent(type=etype, dateTime=date_time, dict=edict)
|
new_event = RoomEvent(type=etype, dateTime=date_time, dict=edict)
|
||||||
|
|
||||||
|
if etype == "RoomCreateEvent":
|
||||||
|
print(room_id, "ff")
|
||||||
|
self.backend.fully_loaded_rooms.add(room_id)
|
||||||
|
|
||||||
if self._events_in_transfer:
|
if self._events_in_transfer:
|
||||||
local_echoes_met: int = 0
|
local_echoes_met: int = 0
|
||||||
update_at: Optional[int] = None
|
update_at: Optional[int] = None
|
||||||
|
|
|
@ -60,6 +60,7 @@ Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
z: 101
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
|
|
|
@ -81,27 +81,34 @@ Rectangle {
|
||||||
iconName: modelData.iconName
|
iconName: modelData.iconName
|
||||||
display: bannerButtons.displayMode
|
display: bannerButtons.displayMode
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
propagateComposedEvents: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (alreadyClicked) { return }
|
if (alreadyClicked) { return }
|
||||||
|
|
||||||
iconName = "hourglass"
|
iconName = "hourglass"
|
||||||
alreadyClicked = true
|
alreadyClicked = true
|
||||||
|
|
||||||
// modelData might become undefined after Backend call
|
// modelData might be undefined after Backend call
|
||||||
var signalId = modelData.signalId
|
var signalId = modelData.signalId
|
||||||
var iconName_ = modelData.iconName
|
var isForget =
|
||||||
|
modelData.clientFunction === "forgetRoom"
|
||||||
|
|
||||||
var future =
|
var future =
|
||||||
Backend.clientManager.clients[chatPage.userId].
|
Backend.clientManager.clients[chatPage.userId].
|
||||||
call(modelData.clientFunction,
|
call(modelData.clientFunction,
|
||||||
modelData.clientArgs)
|
modelData.clientArgs)
|
||||||
|
|
||||||
|
if (! isForget) {
|
||||||
future.onGotResult.connect(function() {
|
future.onGotResult.connect(function() {
|
||||||
iconName = iconName_
|
iconName = modelData.iconName
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (signalId) { buttonClicked(signalId) }
|
if (signalId) { buttonClicked(signalId) }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Layout.maximumWidth: bannerButtons.compact ? height : -1
|
Layout.maximumWidth: bannerButtons.compact ? height : -1
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
|
@ -111,6 +111,7 @@ Image {
|
||||||
Base.HButton {
|
Base.HButton {
|
||||||
text: qsTr("Login")
|
text: qsTr("Login")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
}
|
}
|
||||||
Base.HButton {
|
Base.HButton {
|
||||||
text: qsTr("Forgot?")
|
text: qsTr("Forgot?")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user