mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Add moderates to MyUserInfo
This commit is contained in:
parent
a900cec1bf
commit
32062ecfab
2 changed files with 10 additions and 0 deletions
|
@ -8,6 +8,7 @@ use lemmy_db_views::{
|
|||
use lemmy_db_views_actor::{
|
||||
community_block_view::CommunityBlockView,
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
community_view::CommunityView,
|
||||
person_block_view::PersonBlockView,
|
||||
person_view::PersonViewSafe,
|
||||
|
@ -124,6 +125,7 @@ pub struct GetSiteResponse {
|
|||
pub struct MyUserInfo {
|
||||
pub local_user_view: LocalUserSettingsView,
|
||||
pub follows: Vec<CommunityFollowerView>,
|
||||
pub moderates: Vec<CommunityModeratorView>,
|
||||
pub community_blocks: Vec<CommunityBlockView>,
|
||||
pub person_blocks: Vec<PersonBlockView>,
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use lemmy_db_views::site_view::SiteView;
|
|||
use lemmy_db_views_actor::{
|
||||
community_block_view::CommunityBlockView,
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
person_block_view::PersonBlockView,
|
||||
person_view::PersonViewSafe,
|
||||
};
|
||||
|
@ -113,9 +114,16 @@ impl PerformCrud for GetSite {
|
|||
.await?
|
||||
.map_err(|_| ApiError::err("system_err_login"))?;
|
||||
|
||||
let moderates = blocking(context.pool(), move |conn| {
|
||||
CommunityModeratorView::for_person(conn, person_id)
|
||||
})
|
||||
.await?
|
||||
.map_err(|_| ApiError::err("system_err_login"))?;
|
||||
|
||||
Some(MyUserInfo {
|
||||
local_user_view,
|
||||
follows,
|
||||
moderates,
|
||||
community_blocks,
|
||||
person_blocks,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue