Skip to content
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

Merged
merged 11 commits into from
Apr 6, 2017

Conversation

rodrigok
Copy link
Member

@rodrigok rodrigok commented Apr 4, 2017

@RocketChat/core

  • Subscriptions
  • Messages
  • Remove undesired updates
  • Update name of messages when user change his name
  • Only do this if the Real Name setting is enabled
  • Do not remove name from subscriptions on update

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6597 April 4, 2017 20:19 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6597 April 4, 2017 20:32 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6597 April 4, 2017 21:19 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-6597 April 4, 2017 21:28 Inactive
@rodrigok rodrigok changed the title [WIP] Add fname to subscriptions in memory Add fname to subscriptions in memory Apr 4, 2017
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);
Copy link
Contributor

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?

Copy link
Member Author

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

@@ -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) {
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer 😄

Copy link
Contributor

@alexbrazier alexbrazier left a 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.

@rodrigok rodrigok added this to the 0.55.0 milestone Apr 6, 2017
@engelgabriel engelgabriel merged commit 9323473 into develop Apr 6, 2017
@amenk
Copy link

amenk commented Apr 23, 2017

Hm, where is the real name setting (Running 0.55.1)

EDIT: Okay, it's Layout -> User Interface

@amenk
Copy link

amenk commented Apr 23, 2017

But the user ist is sorted by user name, not real name? That is a bit strange ...

@amenk
Copy link

amenk commented Apr 23, 2017

Also the quick search (Ctrl+K) does not seem to take the fullname into account

@alexbrazier
Copy link
Contributor

alexbrazier commented Apr 23, 2017

@amenk The order has been resolved in #6758
As for the quick search, it seems to be working for me, but only in the server results, so a fix might be needed to make it faster on the frontend. Does it not work at all for you?

Edit: Fixed in #6767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants