tasking-manager
tasking-manager copied to clipboard
Preventing the tagging of non-existent users.
This PR prevents the tagging of non-existent users, changes made:
- Everytime method
get_message
is called, it parses the usernames tagged, checks whether they exist and sends a list of validated usernames to frontend along with message. - Frontend while link-ifying the username checks whether this username is present in validated list.
I thought of a bit optimized approach in which we store the tagged usernames in db for every message, and just iterate over usernames(rather than whole message) to check existence on every GET. Also I felt checking user's existence for every GET is necessary because the user might not be existing while comment was created but exists now !
@ramyaragupathy @willemarcel please review !
Closes #2498
Hey, thanks for this! Tested this and behaviour is fine.
I agree that we somehow have to cover the edge case of people linking to users that appear later on. However I do think this is the edge case, and doing this check on each get_message
seems to be quite complex and i fear this has negative effects on the performance.
I'm wondering whether it would make sense to do the following:
- When saving a comment check if a @[...] to a non-existing user is inside the text. If this is the case set a flag on the db for this message.
- Only run the check within
get_message
on the ones that have this flag set, but not on all.
@ramyaragupathy, @willemarcel what do you think is a good solution for this problem?
we can only do the check, if the message contains a not existing user
stale, but bumped the priority on issue cc @royallsilwallz @manjitapandey