Fix sending typing state when no configured alias

This commit is contained in:
miruka 2019-08-30 10:49:41 -04:00
parent 498bee2e20
commit 4587599cf5
3 changed files with 13 additions and 1 deletions

View File

@ -15,7 +15,6 @@
- Using up/down when sidepane focused - Using up/down when sidepane focused
- Missing hourglass when changing avatar and applying - Missing hourglass when changing avatar and applying
- Icons on KDE - Icons on KDE
- Send typing state when no alias
- Greentext for local echo - Greentext for local echo
- Show error if uploading avatar fails - Show error if uploading avatar fails

View File

@ -82,6 +82,14 @@ Rectangle {
} }
onTextChanged: { onTextChanged: {
if (Utils.isEmptyObject(aliases)) {
writingUserId = Qt.binding(() => chatPage.userId)
toSend = text
setTyping(Boolean(text))
textChangedSinceLostFocus = true
return
}
let foundAlias = null let foundAlias = null
for (let [user, writing_alias] of Object.entries(aliases)) { for (let [user, writing_alias] of Object.entries(aliases)) {

View File

@ -1,3 +1,8 @@
function isEmptyObject(obj) {
return Object.entries(obj).length === 0 && obj.constructor === Object
}
function numberWrapAround(num, max) { function numberWrapAround(num, max) {
return num < 0 ? max + (num % max) : (num % max) return num < 0 ? max + (num % max) : (num % max)
} }