let like_form = CommentLikeForm {
comment_id: inserted_comment.id,
post_id: data.post_id,
- user_id: user_id,
+ user_id,
score: 1,
};
let comment_saved_form = CommentSavedForm {
comment_id: data.comment_id,
- user_id: user_id,
+ user_id,
};
if data.save {
let like_form = CommentLikeForm {
comment_id: data.comment_id,
post_id: data.post_id,
- user_id: user_id,
+ user_id,
score: data.score,
};
Ok(GetCommunityResponse {
op: self.op.to_string(),
community: community_view,
- moderators: moderators,
- admins: admins,
+ moderators,
+ admins,
})
}
}
let community_moderator_form = CommunityModeratorForm {
community_id: inserted_community.id,
- user_id: user_id,
+ user_id,
};
let _inserted_community_moderator =
let community_follower_form = CommunityFollowerForm {
community_id: inserted_community.id,
- user_id: user_id,
+ user_id,
};
let _inserted_community_follower =
community_id: data.edit_id,
removed: Some(removed),
reason: data.reason.to_owned(),
- expires: expires,
+ expires,
};
ModRemoveCommunity::create(&conn, &form)?;
}
// Return the jwt
Ok(ListCommunitiesResponse {
op: self.op.to_string(),
- communities: communities,
+ communities,
})
}
}
let community_follower_form = CommunityFollowerForm {
community_id: data.community_id,
- user_id: user_id,
+ user_id,
};
if data.follow {
// Return the jwt
Ok(GetFollowedCommunitiesResponse {
op: self.op.to_string(),
- communities: communities,
+ communities,
})
}
}
community_id: data.community_id,
reason: data.reason.to_owned(),
banned: Some(data.ban),
- expires: expires,
+ expires,
};
ModBanFromCommunity::create(&conn, &form)?;
Ok(AddModToCommunityResponse {
op: self.op.to_string(),
- moderators: moderators,
+ moderators,
})
}
}
Ok(GetCommunityResponse {
op: self.op.to_string(),
community: community_view,
- moderators: moderators,
- admins: admins,
+ moderators,
+ admins,
})
}
}
impl<T> Oper<T> {
pub fn new(op: UserOperation, data: T) -> Oper<T> {
- Oper { op: op, data: data }
+ Oper { op, data }
}
}
// They like their own post by default
let like_form = PostLikeForm {
post_id: inserted_post.id,
- user_id: user_id,
+ user_id,
score: 1,
};
Ok(GetPostResponse {
op: self.op.to_string(),
post: post_view,
- comments: comments,
- community: community,
- moderators: moderators,
- admins: admins,
+ comments,
+ community,
+ moderators,
+ admins,
})
}
}
Ok(GetPostsResponse {
op: self.op.to_string(),
- posts: posts,
+ posts,
})
}
}
let like_form = PostLikeForm {
post_id: data.post_id,
- user_id: user_id,
+ user_id,
score: data.score,
};
let post_saved_form = PostSavedForm {
post_id: data.post_id,
- user_id: user_id,
+ user_id,
};
if data.save {
// Return the jwt
Ok(ListCategoriesResponse {
op: self.op.to_string(),
- categories: categories,
+ categories,
})
}
}
// Return the jwt
Ok(GetModlogResponse {
op: self.op.to_string(),
- removed_posts: removed_posts,
- locked_posts: locked_posts,
- stickied_posts: stickied_posts,
- removed_comments: removed_comments,
- removed_communities: removed_communities,
- banned_from_community: banned_from_community,
- banned: banned,
- added_to_community: added_to_community,
- added: added,
+ removed_posts,
+ locked_posts,
+ stickied_posts,
+ removed_comments,
+ removed_communities,
+ banned_from_community,
+ banned,
+ added_to_community,
+ added,
})
}
}
Ok(GetSiteResponse {
op: self.op.to_string(),
site: site_view,
- admins: admins,
- banned: banned,
+ admins,
+ banned,
online: 0,
})
}
Ok(SearchResponse {
op: self.op.to_string(),
type_: data.type_.to_owned(),
- comments: comments,
- posts: posts,
- communities: communities,
- users: users,
+ comments,
+ posts,
+ communities,
+ users,
})
}
}
Ok(GetSiteResponse {
op: self.op.to_string(),
site: Some(site_view),
- admins: admins,
- banned: banned,
+ admins,
+ banned,
online: 0,
})
}
Ok(GetUserDetailsResponse {
op: self.op.to_string(),
user: user_view,
- follows: follows,
- moderates: moderates,
- comments: comments,
- posts: posts,
- admins: admins,
+ follows,
+ moderates,
+ comments,
+ posts,
+ admins,
})
}
}
Ok(AddAdminResponse {
op: self.op.to_string(),
- admins: admins,
+ admins,
})
}
}
other_user_id: data.user_id,
reason: data.reason.to_owned(),
banned: Some(data.ban),
- expires: expires,
+ expires,
};
ModBan::create(&conn, &form)?;
Ok(GetRepliesResponse {
op: self.op.to_string(),
- replies: replies,
+ replies,
})
}
}
Ok(GetUserMentionsResponse {
op: self.op.to_string(),
- mentions: mentions,
+ mentions,
})
}
}
ReplyQueryBuilder {
conn,
query,
- for_user_id: for_user_id,
+ for_user_id,
sort: &SortType::New,
unread_only: false,
page: None,