8

@DFox @trogus found a bug- not sure how easy it will be to fix... if you change your username, mentions in rants and comments still have the old username which will be confusing for people trying to figure out who the mention is for.

Is it possible that on editing a username, all mentions in all comments and rants are renamed as well?

Comments
  • 0
  • 2
    Even Instagram doesn't have that. It can resource intensive if you think about it.
  • 1
    I think it's not possible if devrant stores the comment and the username (of the person being mentioned) on a single database column.
  • 1
    What if...
    When you type @username the comment only stores a user ID. Whenever the comment is loaded, you search for the username by the ID.

    When the user changes his username, the string in the table accessed by the user id will be changed. And whenever a comment with @ is loaded, you dereference the ID and find the username which is always up to date.

    Don't know how expensive this would be. I guess the biggest problem will be to find the user id by a string when posting a new comment with a mention
  • 8
    @stimulate when you typed @username, I've got notification on my mobile.
  • 0
    @stimulate that's what I think also. But it would somehow slow down the retrieval of comments since it would do another 'task' which is to search the user. 🤔
  • 1
    @Username downside of having 'username' as your username haha
  • 1
    @stimulate but you could maybe optimize it by only searching for the users who have already posted on the rant at first. If the username to be mentioned is outside of the rant you will have to go all the way to fetch the ID tho..
  • 1
    @stimulate good point! Thanks for the input. I think you just solved my problem on one of my projects. I love this app man. 🤗
  • 1
    @vinceurag IDs are often a great solution. Instead of storing all the data in an object and always having to push around this whole pile of data but only using half of it, you store all data in a bunch of arrays. So you have an array of all usernames, one for user descriptions, one for ++'s... And the "User"-object only stores indices into those arrays (tho you have to mind that this only makes sense if the data the index is for is bigger than an int or whatever type you are using for the index)
  • 5
    I think this is a valid point, but like some have pointed out, it would be very difficult to change it since usernames are just normal comment text that gets parsed when we read them.

    I'm also not sure if it would be the best behavior to change pre-existing rants. It opens up room for abuse. Someone can theoretically change their username to something a user wouldn't have wanted to mention in a comment. Not likely, but still a possibility.

    I think at the very least we can put a warning on the change username screen telling you that comments where you were mentioned will no longer link to your profile. And we already say that someone can take your username right away if they want to.
  • 0
    @dfox fair enough. I was thinking perhaps a hack for it could be to utilize the notifications. When a "mentioned you in a comment" notification is sent, it has to have the target username and reference to the original rant/comment in question. Perhaps that could be persisted in a one to many relationship going from user to the rant/comment with the mention in it. Then have a scheduled batch job that looks for usernames that changed in the past 24 (or however many) hours and looks at that persisted map to update the rants in question. By doing that, you don't need to change how comments and rants are parsed. A little hacky but would work.

    I do understand your concerns regarding abuse. My one question is on setting up a username, do you validate it for a preset list of phrases? IE not allowing curses or insults? Because if you are concerned with users not wanting to mention a certain username, maybe that username should not be allowed to start with.
Add Comment