mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Missing User objects in Utilities
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Post from "discourse/models/post";
|
||||
import createStore from "helpers/create-store";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
QUnit.module("model:post-stream");
|
||||
|
||||
@@ -549,7 +550,7 @@ QUnit.test("staging and undoing a new post", assert => {
|
||||
"the original post is lastAppended"
|
||||
);
|
||||
|
||||
const user = Discourse.User.create({
|
||||
const user = User.create({
|
||||
username: "eviltrout",
|
||||
name: "eviltrout",
|
||||
id: 321
|
||||
@@ -650,7 +651,7 @@ QUnit.test("staging and committing a post", assert => {
|
||||
"the original post is lastAppended"
|
||||
);
|
||||
|
||||
const user = Discourse.User.create({
|
||||
const user = User.create({
|
||||
username: "eviltrout",
|
||||
name: "eviltrout",
|
||||
id: 321
|
||||
@@ -772,7 +773,7 @@ QUnit.test("comitting and triggerNewPostInStream race condition", assert => {
|
||||
const store = postStream.store;
|
||||
|
||||
postStream.appendPost(store.createRecord("post", { id: 1, post_number: 1 }));
|
||||
const user = Discourse.User.create({
|
||||
const user = User.create({
|
||||
username: "eviltrout",
|
||||
name: "eviltrout",
|
||||
id: 321
|
||||
@@ -804,8 +805,8 @@ QUnit.test("comitting and triggerNewPostInStream race condition", assert => {
|
||||
QUnit.test("triggerNewPostInStream for ignored posts", async assert => {
|
||||
const postStream = buildStream(280, [1]);
|
||||
const store = postStream.store;
|
||||
Discourse.User.resetCurrent(
|
||||
Discourse.User.create({
|
||||
User.resetCurrent(
|
||||
User.create({
|
||||
username: "eviltrout",
|
||||
name: "eviltrout",
|
||||
id: 321,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Post from "discourse/models/post";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
QUnit.module("model: Post");
|
||||
|
||||
@@ -56,7 +57,7 @@ QUnit.test("updateFromPost", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("destroy by staff", assert => {
|
||||
var user = Discourse.User.create({ username: "staff", moderator: true }),
|
||||
var user = User.create({ username: "staff", moderator: true }),
|
||||
post = buildPost({ user: user });
|
||||
|
||||
post.destroy(user);
|
||||
@@ -81,7 +82,7 @@ QUnit.test("destroy by staff", assert => {
|
||||
|
||||
QUnit.test("destroy by non-staff", assert => {
|
||||
var originalCooked = "this is the original cooked value",
|
||||
user = Discourse.User.create({ username: "evil trout" }),
|
||||
user = User.create({ username: "evil trout" }),
|
||||
post = buildPost({ user: user, cooked: originalCooked });
|
||||
|
||||
return post.destroy(user).then(() => {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import User from "discourse/models/user";
|
||||
|
||||
QUnit.module("model:topic-details");
|
||||
|
||||
import Topic from "discourse/models/topic";
|
||||
@@ -25,5 +27,5 @@ QUnit.test("updateFromJson", assert => {
|
||||
1,
|
||||
"it loaded the allowed users"
|
||||
);
|
||||
assert.containsInstance(details.get("allowed_users"), Discourse.User);
|
||||
assert.containsInstance(details.get("allowed_users"), User);
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import EmberObject from "@ember/object";
|
||||
import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
|
||||
import Category from "discourse/models/category";
|
||||
import Topic from "discourse/models/topic";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
QUnit.module("model:topic");
|
||||
|
||||
@@ -108,7 +109,7 @@ QUnit.test("updateFromJson", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("destroy", assert => {
|
||||
const user = Discourse.User.create({ username: "eviltrout" });
|
||||
const user = User.create({ username: "eviltrout" });
|
||||
const topic = Topic.create({ id: 1234 });
|
||||
|
||||
topic.destroy(user);
|
||||
@@ -117,7 +118,7 @@ QUnit.test("destroy", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("recover", assert => {
|
||||
const user = Discourse.User.create({ username: "eviltrout" });
|
||||
const user = User.create({ username: "eviltrout" });
|
||||
const topic = Topic.create({
|
||||
id: 1234,
|
||||
deleted_at: new Date(),
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import UserDraft from "discourse/models/user-draft";
|
||||
import { NEW_TOPIC_KEY } from "discourse/models/composer";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
QUnit.module("model:user-drafts");
|
||||
|
||||
QUnit.test("stream", assert => {
|
||||
const user = Discourse.User.create({ id: 1, username: "eviltrout" });
|
||||
const user = User.create({ id: 1, username: "eviltrout" });
|
||||
const stream = user.get("userDraftsStream");
|
||||
assert.present(stream, "a user has a drafts stream by default");
|
||||
assert.equal(stream.get("itemsLoaded"), 0, "no items are loaded by default");
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import UserAction from "discourse/models/user-action";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
QUnit.module("Discourse.UserStream");
|
||||
QUnit.module("model: UserStream");
|
||||
|
||||
QUnit.test("basics", assert => {
|
||||
var user = Discourse.User.create({ id: 1, username: "eviltrout" });
|
||||
var user = User.create({ id: 1, username: "eviltrout" });
|
||||
var stream = user.get("stream");
|
||||
assert.present(stream, "a user has a stream by default");
|
||||
assert.equal(stream.get("user"), user, "the stream points back to the user");
|
||||
@@ -16,7 +17,7 @@ QUnit.test("basics", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("filterParam", assert => {
|
||||
var user = Discourse.User.create({ id: 1, username: "eviltrout" });
|
||||
var user = User.create({ id: 1, username: "eviltrout" });
|
||||
var stream = user.get("stream");
|
||||
|
||||
// defaults to posts/topics
|
||||
|
||||
Reference in New Issue
Block a user