Skip to content

A platform for community discussion. Free, open, simple.

REFACTOR: Remove `_.max`

Robin Ward1265a5f7c0dd
diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.js
index 07cfe1ade9d..5aaeb4aa19c 100644
--- a/app/assets/javascripts/discourse/app/controllers/topic.js
+++ b/app/assets/javascripts/discourse/app/controllers/topic.js
@@ -1445,7 +1445,7 @@ export default Controller.extend(bufferedProperty("model"), {
this.currentUser.automatically_unpin_topics
) {
// automatically unpin topics when the user reaches the bottom
- const max = _.max(postNumbers);
+ const max = Math.max(...postNumbers);
if (topic.get("pinned") && max >= topic.get("highest_post_number")) {
next(() => topic.clearPin());
}