Description
In many ways user naming is backward for all private chat applications. By this I mean what is important is the name I know you by. For instance I might know two Thiago's. One I might call Thiago and the other Theo. In our ideal case, when I look at a chat I would see Theo and Theago regardless of what they called themselves. The wonderful thing that this would allow is people could effectively choose any screen name they wanted because there would never be a conflict. All chat would be based on user ids, but when rendered would use a mapping of user ids to screen names from the perspective of the reader of the chat. Of course, this would only work for private groups, but that is the service we are building.
A simple way to do to this would be to provide a userid mapping object when a specific user is created and also support the 'me' object in the message template, e.g.
const me = new Talk.User({
id: `xfgtxh3`,
name: `Simon`,
email: `syblackwell@anywhichway.com`,
welcomeMessage: 'Hi!',
contacts: { xfgtxh4: "Theo", fghtyc1: "Theago"}
});
<div t:if="{{ showAuthor }}" class="message-author" style="color: {{ sender.id | random_color }}">
{{ me.contacts[sender.id] || sender.email }}</div>
For the time being we are going to allow duplicate screen names in our system and just append email addresses when connecting to TalkJS
const me = new Talk.User({
id: `xfgtxh3`,
name: `Simon (syblackwell@anywhichway.com)`, email: `syblackwell@anywhichway.com`, welcomeMessage: 'Hi!'});
<div t:if="{{ showAuthor }}" class="message-author" style="color: {{ sender.id | random_color }}">
<div style="inline-block">{{ sender.name }}<br/><span style="font-size:80%">{{ sender.email }}</span></div>
</div>