mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 22:49:18 +00:00
Remove email from GetUserDetails when not same user. Fixes #579
This commit is contained in:
parent
ade334b251
commit
876d311706
|
@ -466,7 +466,7 @@ impl Perform<GetUserDetailsResponse> for Oper<GetUserDetails> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let user_view = UserView::read(&conn, user_details_id)?;
|
let mut user_view = UserView::read(&conn, user_details_id)?;
|
||||||
|
|
||||||
let mut posts_query = PostQueryBuilder::create(&conn)
|
let mut posts_query = PostQueryBuilder::create(&conn)
|
||||||
.sort(&sort)
|
.sort(&sort)
|
||||||
|
@ -502,6 +502,15 @@ impl Perform<GetUserDetailsResponse> for Oper<GetUserDetails> {
|
||||||
let creator_user = admins.remove(creator_index);
|
let creator_user = admins.remove(creator_index);
|
||||||
admins.insert(0, creator_user);
|
admins.insert(0, creator_user);
|
||||||
|
|
||||||
|
// If its not the same user, remove the email
|
||||||
|
if let Some(user_id) = user_id {
|
||||||
|
if user_details_id != user_id {
|
||||||
|
user_view.email = None;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
user_view.email = None;
|
||||||
|
}
|
||||||
|
|
||||||
// Return the jwt
|
// Return the jwt
|
||||||
Ok(GetUserDetailsResponse {
|
Ok(GetUserDetailsResponse {
|
||||||
user: user_view,
|
user: user_view,
|
||||||
|
|
Loading…
Reference in a new issue