Skip to content

Add fname to subscriptions in memory#6597

Merged
engelgabriel merged 11 commits into
developfrom
improvements/real-names-in-memory
Apr 6, 2017
Merged

Add fname to subscriptions in memory#6597
engelgabriel merged 11 commits into
developfrom
improvements/real-names-in-memory

Conversation

@rodrigok

@rodrigok rodrigok commented Apr 4, 2017

Copy link
Copy Markdown
Member

@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
_id: fromId
});
if (message.u && message.u._id && UI_Use_Real_Name) {
const user = RocketChat.models.Users.findOneById(message.u._id);

Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread server/stream/messages.js Outdated
Meteor.startup(function() {
function publishMessage(type, record) {
if (record._hidden !== true && (record.imported == null)) {
if (record.u && record.u._id) {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same answer 😄

@alexbrazier alexbrazier left a comment

Copy link
Copy Markdown
Contributor

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

amenk commented Apr 23, 2017

Copy link
Copy Markdown

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

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

@amenk

amenk commented Apr 23, 2017

Copy link
Copy Markdown

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

@amenk

amenk commented Apr 23, 2017

Copy link
Copy Markdown

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

@alexbrazier

alexbrazier commented Apr 23, 2017

Copy link
Copy Markdown
Contributor

@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