简体   繁体   English

PHP-MySQL电子邮件类型消息发件人的名称存储辩论

[英]PHP-MySQL Email type Messages sender's name storing debate

I'm working on building a database for a messaging system that will work more like an email rather than a Chat. 我正在为消息传递系统构建数据库,该数据库将更像电子邮件而不是聊天。

I've come across a little debate whether I should allow for the sender's name to be static or dynamic. 我曾经争论过是否应该允许发件人的姓名是静态的还是动态的。

What I mean is, should I save the current user's display name as is when the message is sent or for the name to be pulled from the user's personal details? 我的意思是,我应该将当前用户的显示名称保存为发送消息时的原样,还是将其从用户的个人详细信息中提取出来? This means that if the user changes his/her display name, it would take effect on every message ever received by others. 这意味着,如果用户更改他/她的显示名称,它将对其他人曾经收到的每条消息生效。

In my project, I do not forsee users changing their display names frequently but it is bound to happen and I am not sure which approach to take. 在我的项目中,我不希望用户经常更改其显示名称,但是它一定会发生,并且我不确定采用哪种方法。

The only thing that comes to mind is that if I do it dynamically, it could be confusing for someone to look for the messages of a given user and not find them because the name has changed. 想到的唯一一件事是,如果我动态地执行此操作,则由于名称已更改,某人查找给定用户的消息而找不到它们可能会造成混淆。

Any pointers? 有指针吗?

This will really come down to how you want your application to function. 这实际上取决于您希望应用程序如何运行。 Both points you raised are valid. 您提出的两点均有效。

If I were implementing this feature I believe I would go the route of having the usernames change dynamically. 如果我要实现此功能,我相信我会采用动态更改用户名的方法。 However I would save all past aliases of each user in a separate table, and have a page/widget that would display them. 但是,我会将每个用户的所有过去别名保存在单独的表中,并具有一个显示它们的页面/小部件。 For example, when a user opens a message from x user they could hover over the name and all past aliases would show in a modal. 例如,当用户打开x用户发送的消息时,他们可以将鼠标悬停在名称上,所有过去的别名都将以模式显示。 Or they could click on the name, be directed to the user's profile where you would have a link that they could click on that took them to a page that showed all past user aliases. 或者他们可以单击名称,直接转到用户的个人资料,您将在其中找到一个链接,他们可以单击该链接将他们带到显示所有过去用户别名的页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM