diff --git a/app/assets/javascripts/discourse/models/user-stream.js.es6 b/app/assets/javascripts/discourse/models/user-stream.js.es6 index d411b58cee2..19e3d2ee62b 100644 --- a/app/assets/javascripts/discourse/models/user-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/user-stream.js.es6 @@ -19,7 +19,7 @@ export default RestModel.extend({ @discourseComputed("filter") filterParam(filter) { - if (filter === Discourse.UserAction.TYPES.replies) { + if (filter === UserAction.TYPES.replies) { return [UserAction.TYPES.replies, UserAction.TYPES.quotes].join(","); } diff --git a/app/assets/javascripts/discourse/routes/build-private-messages-route.js.es6 b/app/assets/javascripts/discourse/routes/build-private-messages-route.js.es6 index 7331705f8fb..abae09a2550 100644 --- a/app/assets/javascripts/discourse/routes/build-private-messages-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-private-messages-route.js.es6 @@ -1,10 +1,11 @@ import UserTopicListRoute from "discourse/routes/user-topic-list"; import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list"; +import UserAction from "discourse/models/user-action"; // A helper to build a user topic list route export default (viewName, path, channel) => { return UserTopicListRoute.extend({ - userActionType: Discourse.UserAction.TYPES.messages_received, + userActionType: UserAction.TYPES.messages_received, titleToken() { const key = viewName === "index" ? "inbox" : viewName; diff --git a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb index cd73d608e9a..fde7cfdd391 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -86,7 +86,6 @@ JS @@whitelisted ||= Set.new( ["discourse/models/nav-item", - "discourse/models/user-action", "discourse/routes/discourse", "discourse/models/category", "discourse/models/site", diff --git a/test/javascripts/models/user-action-test.js.es6 b/test/javascripts/models/user-action-test.js.es6 index c39d7d828f0..51399858079 100644 --- a/test/javascripts/models/user-action-test.js.es6 +++ b/test/javascripts/models/user-action-test.js.es6 @@ -1,21 +1,23 @@ -QUnit.module("Discourse.UserAction"); +import UserAction from "discourse/models/user-action"; + +QUnit.module("model: user-action"); QUnit.test("collapsing likes", assert => { - var actions = Discourse.UserAction.collapseStream([ - Discourse.UserAction.create({ - action_type: Discourse.UserAction.TYPES.likes_given, + var actions = UserAction.collapseStream([ + UserAction.create({ + action_type: UserAction.TYPES.likes_given, topic_id: 1, user_id: 1, post_number: 1 }), - Discourse.UserAction.create({ - action_type: Discourse.UserAction.TYPES.edits, + UserAction.create({ + action_type: UserAction.TYPES.edits, topic_id: 2, user_id: 1, post_number: 1 }), - Discourse.UserAction.create({ - action_type: Discourse.UserAction.TYPES.likes_given, + UserAction.create({ + action_type: UserAction.TYPES.likes_given, topic_id: 1, user_id: 2, post_number: 1 @@ -23,7 +25,6 @@ QUnit.test("collapsing likes", assert => { ]); assert.equal(actions.length, 2); - assert.equal(actions[0].get("children.length"), 1); assert.equal(actions[0].get("children")[0].items.length, 2); }); diff --git a/test/javascripts/models/user-stream-test.js.es6 b/test/javascripts/models/user-stream-test.js.es6 index d8be562c7ac..a0fef540142 100644 --- a/test/javascripts/models/user-stream-test.js.es6 +++ b/test/javascripts/models/user-stream-test.js.es6 @@ -1,3 +1,5 @@ +import UserAction from "discourse/models/user-action"; + QUnit.module("Discourse.UserStream"); QUnit.test("basics", assert => { @@ -20,12 +22,9 @@ QUnit.test("filterParam", assert => { // defaults to posts/topics assert.equal(stream.get("filterParam"), "4,5"); - stream.set("filter", Discourse.UserAction.TYPES.likes_given); - assert.equal( - stream.get("filterParam"), - Discourse.UserAction.TYPES.likes_given - ); + stream.set("filter", UserAction.TYPES.likes_given); + assert.equal(stream.get("filterParam"), UserAction.TYPES.likes_given); - stream.set("filter", Discourse.UserAction.TYPES.replies); + stream.set("filter", UserAction.TYPES.replies); assert.equal(stream.get("filterParam"), "6,9"); });