...
 
Commits (2)
......@@ -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(",");
}
......
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;
......
......@@ -86,15 +86,14 @@ JS
@@whitelisted ||= Set.new(
["discourse/models/nav-item",
"discourse/models/user-action",
"discourse/routes/discourse",
"discourse/models/category",
"discourse/models/site",
"discourse/models/user",
"discourse/models/session",
"discourse/models/model",
"discourse/models/post",
"discourse/views/grouped"]
"discourse/models/post"
]
)
@@whitelisted.include?(path) || path =~ /discourse\/mixins/
......
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);
});
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");
});