Prevent typing events double-bridging
This commit is contained in:
@@ -412,6 +412,7 @@ module.exports = {
|
|||||||
* @param {DiscordTypes.GatewayTypingStartDispatchData} data
|
* @param {DiscordTypes.GatewayTypingStartDispatchData} data
|
||||||
*/
|
*/
|
||||||
async TYPING_START(client, data) {
|
async TYPING_START(client, data) {
|
||||||
|
if (data.user_id === client.user.id) return
|
||||||
const roomID = select("channel_room", "room_id", {channel_id: data.channel_id}).pluck().get()
|
const roomID = select("channel_room", "room_id", {channel_id: data.channel_id}).pluck().get()
|
||||||
if (!roomID) return
|
if (!roomID) return
|
||||||
const mxid = from("sim").join("sim_member", "mxid").where({user_id: data.user_id, room_id: roomID}).pluck("mxid").get()
|
const mxid = from("sim").join("sim_member", "mxid").where({user_id: data.user_id, room_id: roomID}).pluck("mxid").get()
|
||||||
|
|||||||
@@ -31,10 +31,8 @@ function refreshTyping(channelID) {
|
|||||||
|
|
||||||
/** @param {string} channelID */
|
/** @param {string} channelID */
|
||||||
function stopTyping(channelID) {
|
function stopTyping(channelID) {
|
||||||
if (isTyping.has(channelID)) {
|
// Schedule typing session to end
|
||||||
// Schedule typing session to end
|
isTyping.delete(channelID)
|
||||||
isTyping.delete(channelID)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.startTyping = startTyping
|
module.exports.startTyping = startTyping
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ sync.addTemporaryListener(as, "ephemeral_type:m.typing", guard("m.typing",
|
|||||||
async event => {
|
async event => {
|
||||||
const channelID = select("channel_room", "channel_id", {room_id: event.room_id}).pluck().get()
|
const channelID = select("channel_room", "channel_id", {room_id: event.room_id}).pluck().get()
|
||||||
if (!channelID) return
|
if (!channelID) return
|
||||||
if (event.content.user_ids.length) {
|
if (event.content.user_ids.some(mxid => !utils.eventSenderIsFromDiscord(mxid))) {
|
||||||
typing.startTyping(channelID)
|
typing.startTyping(channelID)
|
||||||
} else {
|
} else {
|
||||||
typing.stopTyping(channelID)
|
typing.stopTyping(channelID)
|
||||||
|
|||||||
Reference in New Issue
Block a user