!GsmxjHfeAYLsTEQmjS:nixos.org

Matrix Meta (Nix)

632 Members
Discuss your proposals for the Matrix space here, before suggesting them in #matrix-suggestions:nixos.org181 Servers

Load older messages


SenderMessageTime
1 May 2025
@emma:rory.gay@emma:rory.gaytl;dr it splits the string by litteral @ characters, and checks if the result count is above the limit15:38:47
@joepie91:pixie.town@joepie91:pixie.townyes, and that's a terrible way to check this...15:38:54
@emma:rory.gay@emma:rory.gayyes, the correct way would be to grab the member list, and count instances of user.displayname ?? user.mxid15:39:19
@emma:rory.gay@emma:rory.gay * yes, the correct way would be to grab the member list, and count instances of user.displayname ?? user.mxid 15:39:22
@emma:rory.gay@emma:rory.gayand well, obviously thats very slow because extra api call15:39:36
@joepie91:pixie.town@joepie91:pixie.town like, this feels really illustrative for the problem with a lot of element/matrix code, actually. someone implemented the absolute most naive implementation of the idea, even though with barely any extra effort they could've substantially improved the reliability, but they just didn't do that step at all 15:40:18
@joepie91:pixie.town@joepie91:pixie.town I've been seeing this in so many places 15:40:32
@emma:rory.gay@emma:rory.gaywell, originally they didnt use displayname so it was actually sensible15:40:41
@joepie91:pixie.town@joepie91:pixie.townno it wasn't15:40:47
@joepie91:pixie.town@joepie91:pixie.townthere are no circumstances under which this check is a reasonable implementation15:40:56
@joepie91:pixie.town@joepie91:pixie.townI literally provided the improved version above15:41:05
@emma:rory.gay@emma:rory.gaybesides, friendly reminder that you dont need a word boundary15:41:18
@emma:rory.gay@emma:rory.gayjoepie91 🏳️‍🌈Yorusaka Miyabi [DO NOT DM]WeetHet15:41:45
@joepie91:pixie.town@joepie91:pixie.townI feel like you keep missing my point here15:41:49
@emma:rory.gay@emma:rory.gaymaybe i am, but i dont see a point besides "you should add word boundary checks"15:42:34
@joepie91:pixie.town@joepie91:pixie.town if you are assuming that a mention contains an @, which that code does, then it should have done an additional check for the @ actually being attached to something instead of just counting @s 15:42:53
@joepie91:pixie.town@joepie91:pixie.townand this is like, table stakes string matching stuff, this is not something obscure or complicated, this is pretty much the answer you end up at after a few minutes of thinking about it15:43:20
@joepie91:pixie.town@joepie91:pixie.town it's the lowest of low-hanging fruit for preventing false positives, and it clearly wasn't done 15:43:34
@emma:rory.gay@emma:rory.gayi mean, i would assume that it is? i dont see what wrong with the current code15:43:44
@emma:rory.gay@emma:rory.gayanything more than this would completely miss the actual behavior of legacy mentions on matrix, which is just a string.contains()15:44:15
* @joepie91:pixie.town@joepie91:pixie.town sighs15:44:25
@joepie91:pixie.town@joepie91:pixie.townstring.contains does not involve @s at any point and so is in no way relevant to the point I am making here15:44:50
@joepie91:pixie.town@joepie91:pixie.townI am running out of ways to say this15:45:10
@emma:rory.gay@emma:rory.gayunless you meant to say that this would be right solution15:45:14
@joepie91:pixie.town@joepie91:pixie.townthere is the @ case and the non-@ case15:45:17
@joepie91:pixie.town@joepie91:pixie.townI am talking about the @ case, not about the non-@ case15:45:23
@joepie91:pixie.town@joepie91:pixie.townstring.contains is the non-@ case15:45:48
@joepie91:pixie.town@joepie91:pixie.townthere is presumably an @ case because otherwise this @-counting code would not exist15:46:03
@emma:rory.gay@emma:rory.gay the @ case isnt really a real case either 15:46:18
@joepie91:pixie.town@joepie91:pixie.townand the @ case is implemented wrong in a very trivial-to-improve way that has nevertheless not been done15:46:23

Show newer messages


Back to Room ListRoom Version: 6