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

Cleanup condensed appendMessage #1437

Merged
merged 1 commit into from
Aug 20, 2017
Merged

Cleanup condensed appendMessage #1437

merged 1 commit into from
Aug 20, 2017

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Aug 19, 2017

I have not yet tested this, but it should be logically the same. The PR is open for @YaManicKill to review the code.

@xPaw xPaw requested a review from AlMcKinlay August 19, 2017 18:57
if (lastChild && $(lastChild).hasClass("condensed")) {
lastChild.append(msg);
condensed.updateText(lastChild, [messageType]);
} else if (lastChild && $(lastChild).is(constants.condensedTypesQuery)) {
Copy link
Member

Choose a reason for hiding this comment

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

Since this is used only once, remove the export and use "." + constants.condensedTypes.join(", .") directly here. I'm not a fan of constants exporting this.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's no reason constantly imploding an array into string every time a message is processed.

} else {
container.append(msg);
}
// TODO: To fix #1432, statusMessage option should entirely be implemented in CSS
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I guess that could simplify the logic here and fix #1432 as well.

condensed.updateText(newCondensed, [messageType, lastChild.attr("data-type")]);
container.append(newCondensed);
newCondensed.append(lastChild);
newCondensed.append(msg);
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why you are changing the order of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Condensed text will update in memory before it's inserted into DOM.
  2. Last child will be moved into condensed container without being removed from DOM first.

@astorije
Copy link
Member

I have not yet tested this, but it should be logically the same.

lol, famous last words. I haven't studied the code in details, but it seems to work fine indeed.

Copy link
Member

@AlMcKinlay AlMcKinlay left a comment

Choose a reason for hiding this comment

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

In theory looks fine. Not tested it, one of us should test before merging.

@@ -7,7 +7,7 @@ const renderPreview = require("./renderPreview");
const utils = require("./utils");
const sorting = require("./sorting");
const constants = require("./constants");
const condense = require("./condensed");
const condensed = require("./condensed");
Copy link
Member

Choose a reason for hiding this comment

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

I think this was coming from when I couldn't decide whether to say "condense" or "condensed".

} else {
container.append(msg);
}
// TODO: To fix #1432, statusMessage option should entirely be implemented in CSS
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I guess that could simplify the logic here and fix #1432 as well.

@AlMcKinlay AlMcKinlay added this to the 2.5.0 milestone Aug 20, 2017
@xPaw xPaw merged commit 1e9910f into master Aug 20, 2017
@xPaw xPaw added the Type: Feature Tickets that describe a desired feature or PRs that add them to the project. label Aug 20, 2017
@xPaw xPaw deleted the xpaw/cleanup-condensed branch August 20, 2017 16:37
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
@astorije astorije changed the title Cleanup condensed appendMessage Cleanup condensed appendMessage Sep 29, 2017
@astorije astorije added the Meta: Internal This is an internal codebase change (testing, linting, etc.). label Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta: Internal This is an internal codebase change (testing, linting, etc.). Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants