Skip to content

FEATURE: Add experimental plugin API to register messages nav dropdown #19294

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

Merged

Conversation

tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Dec 2, 2022

This commit also removes the user-messages-nav plugin outlet without
deprecation in the redesigned user page navigation.

This commit also removes the `user-messages-nav` plugin outlet without
deprecation in the redesigned user page navigation.
@tgxworld
Copy link
Contributor Author

tgxworld commented Dec 5, 2022

@lis2 Can you review this for me? Thank you!

}

export function resetCustomUserNavMessagesDropdownRows() {
customUserNavMessagesDropdownRows.length = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting way to reset. Is there a benefit of this approach over = []?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting .length = 0 clears the original array whereas = [] is setting the variable to another array. If there is a spot in the code that has already referenced this constant, using = [] will actually not work properly.

return this.router.urlFor(parentRoute.name, this.model.username);
let value;

for (let i = this.messagesDropdownContent.length - 1; i >= 0; i--) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you used for loop to have access to value. Maybe it would better to use forEach but with old way function. Something like

this.messagesDropdownContent.forEach(function(content) {

})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm actually looping in reverse here which is why I can't use forEach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for clarifying :)

@tgxworld tgxworld merged commit 02f4841 into discourse:main Dec 5, 2022
@tgxworld
Copy link
Contributor Author

tgxworld commented Dec 5, 2022

Thank you for reviewing @lis2

@tgxworld tgxworld deleted the add_plugin_api_to_register_messages_nav branch December 5, 2022 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants