-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fname
to subscriptions in memory
#6597
Conversation
fname
to subscriptions in memoryfname
to subscriptions in memory
const messages = records.map((message) => { | ||
message.starred = _.findWhere(message.starred, { | ||
_id: fromId | ||
}); | ||
if (message.u && message.u._id && UI_Use_Real_Name) { | ||
const user = RocketChat.models.Users.findOneById(message.u._id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this going to make quite a lot of request to the db to get the users name?
Would it be better to collect an array of user ids then fetch the full names all at once outside the loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to the DB, to the memory cache, it's really fast cuz is indexed using a hash map
server/stream/messages.js
Outdated
@@ -45,6 +45,10 @@ msgStream.allowEmit('__my_messages__', function(eventName, msg, options) { | |||
Meteor.startup(function() { | |||
function publishMessage(type, record) { | |||
if (record._hidden !== true && (record.imported == null)) { | |||
if (record.u && record.u._id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check for the UI_Use_Real_Name
setting before doing this?
const messages = _.map(records, (message) => { | ||
message.starred = _.findWhere(message.starred, { _id: fromUserId }); | ||
if (message.u && message.u._id && UI_Use_Real_Name) { | ||
const user = RocketChat.models.Users.findOneById(message.u._id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as my other comment, would it be better to fetch all users in result at once, then map the name on to message.u.name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same answer 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be an issue with showing the real name in the suggestions when mentioning a user, however this appears to be an issue in the develop branch as well, rather than something with this PR.
Hm, where is the real name setting (Running 0.55.1) EDIT: Okay, it's Layout -> User Interface |
But the user ist is sorted by user name, not real name? That is a bit strange ... |
Also the quick search (Ctrl+K) does not seem to take the fullname into account |
@RocketChat/core