mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
parent
fc15276c10
commit
9f36fd50b4
4 changed files with 13 additions and 7 deletions
|
@ -157,7 +157,10 @@ impl UserView {
|
||||||
|
|
||||||
pub fn admins(conn: &PgConnection) -> Result<Vec<Self>, Error> {
|
pub fn admins(conn: &PgConnection) -> Result<Vec<Self>, Error> {
|
||||||
use super::user_view::user_fast::dsl::*;
|
use super::user_view::user_fast::dsl::*;
|
||||||
|
use diesel::sql_types::{Text, Nullable};
|
||||||
user_fast
|
user_fast
|
||||||
|
// The select is necessary here to not get back emails
|
||||||
|
.select((id, actor_id, name, avatar, "".into_sql::<Nullable<Text>>(), matrix_user_id, bio, local, admin, banned, show_avatars, send_notifications_to_email, published, number_of_posts, post_score, number_of_comments, comment_score))
|
||||||
.filter(admin.eq(true))
|
.filter(admin.eq(true))
|
||||||
.order_by(published)
|
.order_by(published)
|
||||||
.load::<Self>(conn)
|
.load::<Self>(conn)
|
||||||
|
@ -165,6 +168,9 @@ impl UserView {
|
||||||
|
|
||||||
pub fn banned(conn: &PgConnection) -> Result<Vec<Self>, Error> {
|
pub fn banned(conn: &PgConnection) -> Result<Vec<Self>, Error> {
|
||||||
use super::user_view::user_fast::dsl::*;
|
use super::user_view::user_fast::dsl::*;
|
||||||
user_fast.filter(banned.eq(true)).load::<Self>(conn)
|
use diesel::sql_types::{Text, Nullable};
|
||||||
|
user_fast
|
||||||
|
.select((id, actor_id, name, avatar, "".into_sql::<Nullable<Text>>(), matrix_user_id, bio, local, admin, banned, show_avatars, send_notifications_to_email, published, number_of_posts, post_score, number_of_comments, comment_score))
|
||||||
|
.filter(banned.eq(true)).load::<Self>(conn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,12 +639,10 @@ impl Perform 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 its not the same user, remove the email, and settings
|
||||||
if let Some(user_id) = user_id {
|
// TODO an if let chain would be better here, but can't figure it out
|
||||||
if user_details_id != user_id {
|
// TODO separate out settings into its own thing
|
||||||
user_view.email = None;
|
if user_id.is_none() || user_details_id != user_id.unwrap_or(0) {
|
||||||
}
|
|
||||||
} else {
|
|
||||||
user_view.email = None;
|
user_view.email = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
ui/src/components/user-details.tsx
vendored
1
ui/src/components/user-details.tsx
vendored
|
@ -234,6 +234,7 @@ export class UserDetails extends Component<UserDetailsProps, UserDetailsState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseMessage(msg: WebSocketJsonResponse) {
|
parseMessage(msg: WebSocketJsonResponse) {
|
||||||
|
console.log(msg);
|
||||||
const res = wsJsonToRes(msg);
|
const res = wsJsonToRes(msg);
|
||||||
|
|
||||||
if (msg.error) {
|
if (msg.error) {
|
||||||
|
|
1
ui/src/components/user.tsx
vendored
1
ui/src/components/user.tsx
vendored
|
@ -1001,6 +1001,7 @@ export class User extends Component<any, UserState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseMessage(msg: WebSocketJsonResponse) {
|
parseMessage(msg: WebSocketJsonResponse) {
|
||||||
|
console.log(msg);
|
||||||
const res = wsJsonToRes(msg);
|
const res = wsJsonToRes(msg);
|
||||||
if (msg.error) {
|
if (msg.error) {
|
||||||
toast(i18n.t(msg.error), 'danger');
|
toast(i18n.t(msg.error), 'danger');
|
||||||
|
|
Loading…
Reference in a new issue