How to NOT store plain text messages in the database?
There is a web app.
It has chat, in which you can write only text. Messages are stored in a field of type `text`.
How to be able to specify users in the message, so they know about it?
For example, one user writes in the General chat
@Vasily Pupkin, see here.
Text "@Vasily Pupkin" it needs to stand out somehow, so you can click on it to go to the user profile.
A variant of this: in the database will be saved "[user=48754], look at this." The backend before sending to the browser esparcet the message and show it beautifully. Obviously not the best option.
As this task is (at least approximately) implemented at large sites (social. networking, for example)? And how to implement it on the frontend? To display text, and to the server to send a specially formed message "[user=48754], look at this."?
Jocelyn.Jakubowski43 answered on August 23rd 19 at 11:03
Option 2: Parsim the message on the server, looking for the pattern "@letters" (through regular season), if the user is in the database - replace ACC. code (reference, selection, etc.).
So vskidku, the first option is suitable for selection of personal messages, the second for what would be the names stood out at all as such (as e.g. here on the Toaster).