summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-04-15 16:12:06 -0700
committerDessalines <tyhou13@gmx.com>2019-04-15 16:12:06 -0700
commite94885eb97b3240ed9cec7f97d0f405b2819e922 (patch)
treeb407f0b6ed9be27682e3767271e34933c947cb2a
parent8590a612f633fe6ba8f8b18379a8a822a3b3019b (diff)
Commiting before I lose everything. I'll do this properly in a merge
-rw-r--r--server/migrations/2019-02-26-002946_create_user/down.sql3
-rw-r--r--server/migrations/2019-02-26-002946_create_user/up.sql9
-rw-r--r--server/migrations/2019-02-27-170003_create_community/down.sql1
-rw-r--r--server/migrations/2019-02-27-170003_create_community/up.sql15
-rw-r--r--server/migrations/2019-03-03-163336_create_post/up.sql2
-rw-r--r--server/migrations/2019-03-05-233828_create_comment/up.sql1
-rw-r--r--server/migrations/2019-03-30-212058_create_post_view/up.sql33
-rw-r--r--server/migrations/2019-04-03-155205_create_community_view/down.sql1
-rw-r--r--server/migrations/2019-04-03-155205_create_community_view/up.sql12
-rw-r--r--server/migrations/2019-04-03-155309_create_comment_view/up.sql10
-rw-r--r--server/migrations/2019-04-07-003142_create_moderation_logs/down.sql4
-rw-r--r--server/migrations/2019-04-07-003142_create_moderation_logs/up.sql30
-rw-r--r--server/migrations/2019-04-08-015947_create_user_view/up.sql3
-rw-r--r--server/migrations/2019-04-11-144915_create_mod_views/down.sql8
-rw-r--r--server/migrations/2019-04-11-144915_create_mod_views/up.sql61
-rw-r--r--server/src/actions/comment.rs10
-rw-r--r--server/src/actions/comment_view.rs24
-rw-r--r--server/src/actions/community.rs65
-rw-r--r--server/src/actions/community_view.rs49
-rw-r--r--server/src/actions/mod.rs2
-rw-r--r--server/src/actions/moderator.rs655
-rw-r--r--server/src/actions/moderator_views.rs427
-rw-r--r--server/src/actions/post.rs13
-rw-r--r--server/src/actions/post_view.rs26
-rw-r--r--server/src/actions/user.rs8
-rw-r--r--server/src/actions/user_view.rs4
-rw-r--r--server/src/apub.rs2
-rw-r--r--server/src/lib.rs9
-rw-r--r--server/src/schema.rs136
-rw-r--r--server/src/websocket_server/server.rs430
-rw-r--r--ui/src/components/comment-form.tsx13
-rw-r--r--ui/src/components/comment-node.tsx169
-rw-r--r--ui/src/components/comment-nodes.tsx11
-rw-r--r--ui/src/components/communities.tsx3
-rw-r--r--ui/src/components/community.tsx6
-rw-r--r--ui/src/components/modlog.tsx184
-rw-r--r--ui/src/components/moment-time.tsx6
-rw-r--r--ui/src/components/navbar.tsx3
-rw-r--r--ui/src/components/post-form.tsx6
-rw-r--r--ui/src/components/post-listing.tsx122
-rw-r--r--ui/src/components/post.tsx22
-rw-r--r--ui/src/components/sidebar.tsx151
-rw-r--r--ui/src/components/user.tsx19
-rw-r--r--ui/src/index.tsx2
-rw-r--r--ui/src/interfaces.ts371
-rw-r--r--ui/src/main.css5
-rw-r--r--ui/src/services/WebSocketService.ts16
-rw-r--r--ui/src/utils.ts8
-rw-r--r--ui/src/version.ts2
49 files changed, 2881 insertions, 291 deletions
diff --git a/server/migrations/2019-02-26-002946_create_user/down.sql b/server/migrations/2019-02-26-002946_create_user/down.sql
index 606be6e1..67a280d6 100644
--- a/server/migrations/2019-02-26-002946_create_user/down.sql
+++ b/server/migrations/2019-02-26-002946_create_user/down.sql
@@ -1 +1,2 @@
-drop table user_
+drop table user_ban;
+drop table user_;
diff --git a/server/migrations/2019-02-26-002946_create_user/up.sql b/server/migrations/2019-02-26-002946_create_user/up.sql
index 80e6e92a..83112e9b 100644
--- a/server/migrations/2019-02-26-002946_create_user/up.sql
+++ b/server/migrations/2019-02-26-002946_create_user/up.sql
@@ -6,9 +6,18 @@ create table user_ (
password_encrypted text not null,
email text unique,
icon bytea,
+ admin boolean default false,
+ banned boolean default false,
published timestamp not null default now(),
updated timestamp,
unique(name, fedi_name)
);
+create table user_ban (
+ id serial primary key,
+ user_id int references user_ on update cascade on delete cascade not null,
+ published timestamp not null default now(),
+ unique (user_id)
+);
+
insert into user_ (name, fedi_name, password_encrypted) values ('admin', 'TBD', 'TBD');
diff --git a/server/migrations/2019-02-27-170003_create_community/down.sql b/server/migrations/2019-02-27-170003_create_community/down.sql
index f293dfad..d5bd3994 100644
--- a/server/migrations/2019-02-27-170003_create_community/down.sql
+++ b/server/migrations/2019-02-27-170003_create_community/down.sql
@@ -1,3 +1,4 @@
+drop table community_user_ban;;
drop table community_moderator;
drop table community_follower;
drop table community;
diff --git a/server/migrations/2019-02-27-170003_create_community/up.sql b/server/migrations/2019-02-27-170003_create_community/up.sql
index 46b4df52..ad47adfe 100644
--- a/server/migrations/2019-02-27-170003_create_community/up.sql
+++ b/server/migrations/2019-02-27-170003_create_community/up.sql
@@ -38,6 +38,7 @@ create table community (
description text,
category_id int references category on update cascade on delete cascade not null,
creator_id int references user_ on update cascade on delete cascade not null,
+ removed boolean default false,
published timestamp not null default now(),
updated timestamp
);
@@ -46,14 +47,24 @@ create table community_moderator (
id serial primary key,
community_id int references community on update cascade on delete cascade not null,
user_id int references user_ on update cascade on delete cascade not null,
- published timestamp not null default now()
+ published timestamp not null default now(),
+ unique (community_id, user_id)
);
create table community_follower (
id serial primary key,
community_id int references community on update cascade on delete cascade not null,
user_id int references user_ on update cascade on delete cascade not null,
- published timestamp not null default now()
+ published timestamp not null default now(),
+ unique (community_id, user_id)
+);
+
+create table community_user_ban (
+ id serial primary key,
+ community_id int references community on update cascade on delete cascade not null,
+ user_id int references user_ on update cascade on delete cascade not null,
+ published timestamp not null default now(),
+ unique (community_id, user_id)
);
insert into community (name, title, category_id, creator_id) values ('main', 'The Default Community', 1, 1);
diff --git a/server/migrations/2019-03-03-163336_create_post/up.sql b/server/migrations/2019-03-03-163336_create_post/up.sql
index aaa6911e..c3b7c0b8 100644
--- a/server/migrations/2019-03-03-163336_create_post/up.sql
+++ b/server/migrations/2019-03-03-163336_create_post/up.sql
@@ -5,6 +5,8 @@ create table post (
body text,
creator_id int references user_ on update cascade on delete cascade not null,
community_id int references community on update cascade on delete cascade not null,
+ removed boolean default false,
+ locked boolean default false,
published timestamp not null default now(),
updated timestamp
);
diff --git a/server/migrations/2019-03-05-233828_create_comment/up.sql b/server/migrations/2019-03-05-233828_create_comment/up.sql
index aa20d358..214d50a6 100644
--- a/server/migrations/2019-03-05-233828_create_comment/up.sql
+++ b/server/migrations/2019-03-05-233828_create_comment/up.sql
@@ -4,6 +4,7 @@ create table comment (
post_id int references post on update cascade on delete cascade not null,
parent_id int references comment on update cascade on delete cascade,
content text not null,
+ removed boolean default false,
published timestamp not null default now(),
updated timestamp
);
diff --git a/server/migrations/2019-03-30-212058_create_post_view/up.sql b/server/migrations/2019-03-30-212058_create_post_view/up.sql
index 95789c73..ecf3280a 100644
--- a/server/migrations/2019-03-30-212058_create_post_view/up.sql
+++ b/server/migrations/2019-03-30-212058_create_post_view/up.sql
@@ -30,7 +30,8 @@ select
ap.*,
u.id as user_id,
coalesce(pl.score, 0) as my_vote,
-(select cf.id::bool from community_follower cf where u.id = cf.user_id and cf.community_id = ap.community_id) as subscribed
+(select cf.id::bool from community_follower cf where u.id = cf.user_id and cf.community_id = ap.community_id) as subscribed,
+u.admin or (select cm.id::bool from community_moderator cm where u.id = cm.user_id and cm.community_id = ap.community_id) as am_mod
from user_ u
cross join all_post ap
left join post_like pl on u.id = pl.user_id and ap.id = pl.post_id
@@ -41,33 +42,7 @@ select
ap.*,
null as user_id,
null as my_vote,
-null as subscribed
+null as subscribed,
+null as am_mod
from all_post ap
;
-
-/* The old post view */
-/* create view post_view as */
-/* select */
-/* u.id as user_id, */
-/* pl.score as my_vote, */
-/* p.id as id, */
-/* p.name as name, */
-/* p.url, */
-/* p.body, */
-/* p.creator_id, */
-/* (select name from user_ where p.creator_id = user_.id) creator_name, */
-/* p.community_id, */
-/* (select name from community where p.community_id = community.id) as community_name, */
-/* (select count(*) from comment where comment.post_id = p.id) as number_of_comments, */
-/* coalesce(sum(pl.score) over (partition by p.id), 0) as score, */
-/* count (case when pl.score = 1 then 1 else null end) over (partition by p.id) as upvotes, */
-/* count (case when pl.score = -1 then 1 else null end) over (partition by p.id) as downvotes, */
-/* hot_rank(coalesce(sum(pl.score) over (partition by p.id) , 0), p.published) as hot_rank, */
-/* p.published, */
-/* p.updated */
-/* from user_ u */
-/* cross join post p */
-/* left join post_like pl on u.id = pl.user_id and p.id = pl.post_id; */
-
-
-
diff --git a/server/migrations/2019-04-03-155205_create_community_view/down.sql b/server/migrations/2019-04-03-155205_create_community_view/down.sql
index 6c7e8708..0c7a33c8 100644
--- a/server/migrations/2019-04-03-155205_create_community_view/down.sql
+++ b/server/migrations/2019-04-03-155205_create_community_view/down.sql
@@ -1,3 +1,4 @@
drop view community_view;
drop view community_moderator_view;
drop view community_follower_view;
+drop view community_user_ban_view;
diff --git a/server/migrations/2019-04-03-155205_create_community_view/up.sql b/server/migrations/2019-04-03-155205_create_community_view/up.sql
index 7c608742..510fd0f2 100644
--- a/server/migrations/2019-04-03-155205_create_community_view/up.sql
+++ b/server/migrations/2019-04-03-155205_create_community_view/up.sql
@@ -13,7 +13,8 @@ with all_community as
select
ac.*,
u.id as user_id,
-cf.id::boolean as subscribed
+cf.id::boolean as subscribed,
+u.admin or (select cm.id::bool from community_moderator cm where u.id = cm.user_id and cm.community_id = ac.id) as am_mod
from user_ u
cross join all_community ac
left join community_follower cf on u.id = cf.user_id and ac.id = cf.community_id
@@ -23,7 +24,8 @@ union all
select
ac.*,
null as user_id,
-null as subscribed
+null as subscribed,
+null as am_mod
from all_community ac
;
@@ -38,3 +40,9 @@ select *,
(select name from user_ u where cf.user_id = u.id) as user_name,
(select name from community c where cf.community_id = c.id) as community_name
from community_follower cf;
+
+create view community_user_ban_view as
+select *,
+(select name from user_ u where cm.user_id = u.id) as user_name,
+(select name from community c where cm.community_id = c.id) as community_name
+from community_user_ban cm;
diff --git a/server/migrations/2019-04-03-155309_create_comment_view/up.sql b/server/migrations/2019-04-03-155309_create_comment_view/up.sql
index a4d2be9f..a73b6182 100644
--- a/server/migrations/2019-04-03-155309_create_comment_view/up.sql
+++ b/server/migrations/2019-04-03-155309_create_comment_view/up.sql
@@ -3,7 +3,9 @@ with all_comment as
(
select
c.*,
- (select name from user_ where c.creator_id = user_.id) creator_name,
+ (select community_id from post p where p.id = c.post_id),
+ (select cb.id::bool from community_user_ban cb where c.creator_id = cb.user_id) as banned,
+ (select name from user_ where c.creator_id = user_.id) as creator_name,
coalesce(sum(cl.score), 0) as score,
count (case when cl.score = 1 then 1 else null end) as upvotes,
count (case when cl.score = -1 then 1 else null end) as downvotes
@@ -15,7 +17,8 @@ with all_comment as
select
ac.*,
u.id as user_id,
-coalesce(cl.score, 0) as my_vote
+coalesce(cl.score, 0) as my_vote,
+u.admin or (select cm.id::bool from community_moderator cm, post p where u.id = cm.user_id and ac.post_id = p.id and p.community_id = cm.community_id) as am_mod
from user_ u
cross join all_comment ac
left join comment_like cl on u.id = cl.user_id and ac.id = cl.comment_id
@@ -25,6 +28,7 @@ union all
select
ac.*,
null as user_id,
- null as my_vote
+ null as my_vote,
+ null as am_mod
from all_comment ac
;
diff --git a/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql b/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql
index 15718917..888a87fe 100644
--- a/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql
+++ b/server/migrations/2019-04-07-003142_create_moderation_logs/down.sql
@@ -3,4 +3,6 @@ drop table mod_lock_post;
drop table mod_remove_comment;
drop table mod_remove_community;
drop table mod_ban;
-drop table mod_add_mod;
+drop table mod_ban_from_community;
+drop table mod_add;
+drop table mod_add_community;
diff --git a/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql b/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql
index 41929e50..3b320d81 100644
--- a/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql
+++ b/server/migrations/2019-04-07-003142_create_moderation_logs/up.sql
@@ -1,4 +1,3 @@
-
create table mod_remove_post (
id serial primary key,
mod_user_id int references user_ on update cascade on delete cascade not null,
@@ -12,6 +11,7 @@ create table mod_lock_post (
id serial primary key,
mod_user_id int references user_ on update cascade on delete cascade not null,
post_id int references post on update cascade on delete cascade not null,
+ locked boolean default true,
when_ timestamp not null default now()
);
@@ -30,25 +30,47 @@ create table mod_remove_community (
community_id int references community on update cascade on delete cascade not null,
reason text,
removed boolean default true,
+ expires timestamp,
when_ timestamp not null default now()
);
-- TODO make sure you can't ban other mods
+create table mod_ban_from_community (
+ id serial primary key,
+ mod_user_id int references user_ on update cascade on delete cascade not null,
+ other_user_id int references user_ on update cascade on delete cascade not null,
+ community_id int references community on update cascade on delete cascade not null,
+ reason text,
+ banned boolean default true,
+ expires timestamp,
+ when_ timestamp not null default now()
+);
+
create table mod_ban (
id serial primary key,
mod_user_id int references user_ on update cascade on delete cascade not null,
other_user_id int references user_ on update cascade on delete cascade not null,
reason text,
- removed boolean default true,
+ banned boolean default true,
expires timestamp,
when_ timestamp not null default now()
);
+create table mod_add_community (
+ id serial primary key,
+ mod_user_id int references user_ on update cascade on delete cascade not null,
+ other_user_id int references user_ on update cascade on delete cascade not null,
+ community_id int references community on update cascade on delete cascade not null,
+ removed boolean default false,
+ when_ timestamp not null default now()
+);
+
-- When removed is false that means kicked
-create table mod_add_mod (
+create table mod_add (
id serial primary key,
mod_user_id int references user_ on update cascade on delete cascade not null,
other_user_id int references user_ on update cascade on delete cascade not null,
removed boolean default false,
when_ timestamp not null default now()
-)
+);
+
diff --git a/server/migrations/2019-04-08-015947_create_user_view/up.sql b/server/migrations/2019-04-08-015947_create_user_view/up.sql
index 69d052de..08eb56ca 100644
--- a/server/migrations/2019-04-08-015947_create_user_view/up.sql
+++ b/server/migrations/2019-04-08-015947_create_user_view/up.sql
@@ -2,10 +2,11 @@ create view user_view as
select id,
name,
fedi_name,
+admin,
+banned,
published,
(select count(*) from post p where p.creator_id = u.id) as number_of_posts,
(select coalesce(sum(score), 0) from post p, post_like pl where u.id = p.creator_id and p.id = pl.post_id) as post_score,
(select count(*) from comment c where c.creator_id = u.id) as number_of_comments,
(select coalesce(sum(score), 0) from comment c, comment_like cl where u.id = c.creator_id and c.id = cl.comment_id) as comment_score
from user_ u;
-
diff --git a/server/migrations/2019-04-11-144915_create_mod_views/down.sql b/server/migrations/2019-04-11-144915_create_mod_views/down.sql
new file mode 100644
index 00000000..95018f35
--- /dev/null
+++ b/server/migrations/2019-04-11-144915_create_mod_views/down.sql
@@ -0,0 +1,8 @@
+drop view mod_remove_post_view;
+drop view mod_lock_post_view;
+drop view mod_remove_comment_view;
+drop view mod_remove_community_view;
+drop view mod_ban_from_community_view;
+drop view mod_ban_view;
+drop view mod_add_community_view;
+drop view mod_add_view;
diff --git a/server/migrations/2019-04-11-144915_create_mod_views/up.sql b/server/migrations/2019-04-11-144915_create_mod_views/up.sql
new file mode 100644
index 00000000..908028d0
--- /dev/null
+++ b/server/migrations/2019-04-11-144915_create_mod_views/up.sql
@@ -0,0 +1,61 @@
+create view mod_remove_post_view as
+select mrp.*,
+(select name from user_ u where mrp.mod_user_id = u.id) as mod_user_name,
+(select name from post p where mrp.post_id = p.id) as post_name,
+(select c.id from post p, community c where mrp.post_id = p.id and p.community_id = c.id) as community_id,
+(select c.name from post p, community c where mrp.post_id = p.id and p.community_id = c.id) as community_name
+from mod_remove_post mrp;
+
+create view mod_lock_post_view as
+select mlp.*,
+(select name from user_ u where mlp.mod_user_id = u.id) as mod_user_name,
+(select name from post p where mlp.post_id = p.id) as post_name,
+(select c.id from post p, community c where mlp.post_id = p.id and p.community_id = c.id) as community_id,
+(select c.name from post p, community c where mlp.post_id = p.id and p.community_id = c.id) as community_name
+from mod_lock_post mlp;
+
+create view mod_remove_comment_view as
+select mrc.*,
+(select name from user_ u where mrc.mod_user_id = u.id) as mod_user_name,
+(select c.id from comment c where mrc.comment_id = c.id) as comment_user_id,
+(select name from user_ u, comment c where mrc.comment_id = c.id and u.id = c.creator_id) as comment_user_name,
+(select content from comment c where mrc.comment_id = c.id) as comment_content,
+(select p.id from post p, comment c where mrc.comment_id = c.id and c.post_id = p.id) as post_id,
+(select p.name from post p, comment c where mrc.comment_id = c.id and c.post_id = p.id) as post_name,
+(select co.id from comment c, post p, community co where mrc.comment_id = c.id and c.post_id = p.id and p.community_id = co.id) as community_id,
+(select co.name from comment c, post p, community co where mrc.comment_id = c.id and c.post_id = p.id and p.community_id = co.id) as community_name
+from mod_remove_comment mrc;
+
+create view mod_remove_community_view as
+select mrc.*,
+(select name from user_ u where mrc.mod_user_id = u.id) as mod_user_name,
+(select c.name from community c where mrc.community_id = c.id) as community_name
+from mod_remove_community mrc;
+
+create view mod_ban_from_community_view as
+select mb.*,
+(select name from user_ u where mb.mod_user_id = u.id) as mod_user_name,
+(select name from user_ u where mb.other_user_id = u.id) as other_user_name,
+(select name from community c where mb.community_id = c.id) as community_name
+from mod_ban_from_community mb;
+
+create view mod_ban_view as
+select mb.*,
+(select name from user_ u where mb.mod_user_id = u.id) as mod_user_name,
+(select name from user_ u where mb.other_user_id = u.id) as other_user_name
+from mod_ban_from_community mb;
+
+
+create view mod_add_community_view as
+select ma.*,
+(select name from user_ u where ma.mod_user_id = u.id) as mod_user_name,
+(select name from user_ u where ma.other_user_id = u.id) as other_user_name,
+(select name from community c where ma.community_id = c.id) as community_name
+from mod_add_community ma;
+
+
+create view mod_add_view as
+select ma.*,
+(select name from user_ u where ma.mod_user_id = u.id) as mod_user_name,
+(select name from user_ u where ma.other_user_id = u.id) as other_user_name
+from mod_add ma;
diff --git a/server/src/actions/comment.rs b/server/src/actions/comment.rs
index ff502850..2c5c570e 100644
--- a/server/src/actions/comment.rs
+++ b/server/src/actions/comment.rs
@@ -22,6 +22,7 @@ pub struct Comment {
pub post_id: i32,
pub parent_id: Option<i32>,
pub content: String,
+ pub removed: Option<bool>,
pub published: chrono::NaiveDateTime,
pub updated: Option<chrono::NaiveDateTime>
}
@@ -33,6 +34,7 @@ pub struct CommentForm {
pub post_id: i32,
pub parent_id: Option<i32>,
pub content: String,
+ pub removed: Option<bool>,
pub updated: Option<chrono::NaiveDateTime>
}
@@ -135,6 +137,8 @@ mod tests {
preferred_username: None,
password_encrypted: "nope".into(),
email: None,
+ admin: None,
+ banned: None,
updated: None
};
@@ -146,6 +150,7 @@ mod tests {
description: None,
category_id: 1,
creator_id: inserted_user.id,
+ removed: None,
updated: None
};
@@ -157,6 +162,8 @@ mod tests {
url: None,
body: None,
community_id: inserted_community.id,
+ removed: None,
+ locked: None,
updated: None
};
@@ -166,6 +173,7 @@ mod tests {
content: "A test comment".into(),
creator_id: inserted_user.id,
post_id: inserted_post.id,
+ removed: None,
parent_id: None,
updated: None
};
@@ -177,6 +185,7 @@ mod tests {
content: "A test comment".into(),
creator_id: inserted_user.id,
post_id: inserted_post.id,
+ removed: Some(false),
parent_id: None,
published: inserted_comment.published,
updated: None
@@ -187,6 +196,7 @@ mod tests {
creator_id: inserted_user.id,
post_id: inserted_post.id,
parent_id: Some(inserted_comment.id),
+ removed: None,
updated: None
};
diff --git a/server/src/actions/comment_view.rs b/server/src/actions/comment_view.rs
index 3b4e00bb..e1cc4117 100644
--- a/server/src/actions/comment_view.rs
+++ b/server/src/actions/comment_view.rs
@@ -13,14 +13,18 @@ table! {
post_id -> Int4,
parent_id -> Nullable<Int4>,
content -> Text,
+ removed -> Nullable<Bool>,
published -> Timestamp,
updated -> Nullable<Timestamp>,
+ community_id -> Int4,
+ banned -> Nullable<Bool>,
creator_name -> Varchar,
score -> BigInt,
upvotes -> BigInt,
downvotes -> BigInt,
user_id -> Nullable<Int4>,
my_vote -> Nullable<Int4>,
+ am_mod -> Nullable<Bool>,
}
}
@@ -32,14 +36,18 @@ pub struct CommentView {
pub post_id: i32,
pub parent_id: Option<i32>,
pub content: String,
+ pub removed: Option<bool>,
pub published: chrono::NaiveDateTime,
pub updated: Option<chrono::NaiveDateTime>,
+ pub community_id: i32,
+ pub banned: Option<bool>,
pub creator_name: String,
pub score: i64,
pub upvotes: i64,
pub downvotes: i64,
pub user_id: Option<i32>,
pub my_vote: Option<i32>,
+ pub am_mod: Option<bool>,
}
impl CommentView {
@@ -130,6 +138,8 @@ mod tests {
preferred_username: None,
password_encrypted: "nope".into(),
email: None,
+ admin: None,
+ banned: None,
updated: None
};
@@ -141,6 +151,7 @@ mod tests {
description: None,
category_id: 1,
creator_id: inserted_user.id,
+ removed: None,
updated: None
};
@@ -152,6 +163,8 @@ mod tests {
url: None,
body: None,
community_id: inserted_community.id,
+ removed: None,
+ locked: None,
updated: None
};
@@ -162,6 +175,7 @@ mod tests {
creator_id: inserted_user.id,
post_id: inserted_post.id,
parent_id: None,
+ removed: None,
updated: None
};
@@ -181,7 +195,10 @@ mod tests {
content: "A test comment 32".into(),
creator_id: inserted_user.id,
post_id: inserted_post.id,
+ community_id: inserted_community.id,
parent_id: None,
+ removed: Some(false),
+ banned: None,
published: inserted_comment.published,
updated: None,
creator_name: inserted_user.name.to_owned(),
@@ -189,7 +206,8 @@ mod tests {
downvotes: 0,
upvotes: 1,
user_id: None,
- my_vote: None
+ my_vote: None,
+ am_mod: None,
};
let expected_comment_view_with_user = CommentView {
@@ -197,7 +215,10 @@ mod tests {
content: "A test comment 32".into(),
creator_id: inserted_user.id,
post_id: inserted_post.id,
+ community_id: inserted_community.id,
parent_id: None,
+ removed: Some(false),
+ banned: None,
published: inserted_comment.published,