mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 19:31:05 +00:00
Fixes for login screen, server
This commit is contained in:
parent
5683cd3987
commit
f914c4862c
2 changed files with 19 additions and 19 deletions
|
@ -1311,12 +1311,12 @@ impl Perform for EditComment {
|
||||||
|
|
||||||
let user_id = claims.id;
|
let user_id = claims.id;
|
||||||
|
|
||||||
|
let orig_comment = CommentView::read(&conn, self.edit_id, None)?;
|
||||||
|
|
||||||
// You are allowed to mark the comment as read even if you're banned.
|
// You are allowed to mark the comment as read even if you're banned.
|
||||||
if self.read.is_none() {
|
if self.read.is_none() {
|
||||||
|
|
||||||
// Verify its the creator or a mod, or an admin
|
// Verify its the creator or a mod, or an admin
|
||||||
let orig_comment = CommentView::read(&conn, self.edit_id, None)?;
|
|
||||||
let mut editors: Vec<i32> = vec![self.creator_id];
|
let mut editors: Vec<i32> = vec![self.creator_id];
|
||||||
editors.append(
|
editors.append(
|
||||||
&mut CommunityModeratorView::for_community(&conn, orig_comment.community_id)
|
&mut CommunityModeratorView::for_community(&conn, orig_comment.community_id)
|
||||||
|
@ -1358,7 +1358,7 @@ impl Perform for EditComment {
|
||||||
creator_id: self.creator_id,
|
creator_id: self.creator_id,
|
||||||
removed: self.removed.to_owned(),
|
removed: self.removed.to_owned(),
|
||||||
read: self.read.to_owned(),
|
read: self.read.to_owned(),
|
||||||
updated: if self.read.is_some() { None } else {Some(naive_now())}
|
updated: if self.read.is_some() { orig_comment.updated } else {Some(naive_now())}
|
||||||
};
|
};
|
||||||
|
|
||||||
let _updated_comment = match Comment::update(&conn, self.edit_id, &comment_form) {
|
let _updated_comment = match Comment::update(&conn, self.edit_id, &comment_form) {
|
||||||
|
|
|
@ -12,28 +12,29 @@ interface State {
|
||||||
registerLoading: boolean;
|
registerLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
let emptyState: State = {
|
|
||||||
loginForm: {
|
|
||||||
username_or_email: undefined,
|
|
||||||
password: undefined
|
|
||||||
},
|
|
||||||
registerForm: {
|
|
||||||
username: undefined,
|
|
||||||
password: undefined,
|
|
||||||
password_verify: undefined,
|
|
||||||
admin: false,
|
|
||||||
},
|
|
||||||
loginLoading: false,
|
|
||||||
registerLoading: false
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Login extends Component<any, State> {
|
export class Login extends Component<any, State> {
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
|
|
||||||
|
emptyState: State = {
|
||||||
|
loginForm: {
|
||||||
|
username_or_email: undefined,
|
||||||
|
password: undefined
|
||||||
|
},
|
||||||
|
registerForm: {
|
||||||
|
username: undefined,
|
||||||
|
password: undefined,
|
||||||
|
password_verify: undefined,
|
||||||
|
admin: false,
|
||||||
|
},
|
||||||
|
loginLoading: false,
|
||||||
|
registerLoading: false
|
||||||
|
}
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
|
|
||||||
this.state = emptyState;
|
this.state = this.emptyState;
|
||||||
|
|
||||||
this.subscription = WebSocketService.Instance.subject
|
this.subscription = WebSocketService.Instance.subject
|
||||||
.pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
|
.pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
|
||||||
|
@ -183,8 +184,7 @@ export class Login extends Component<any, State> {
|
||||||
let op: UserOperation = msgOp(msg);
|
let op: UserOperation = msgOp(msg);
|
||||||
if (msg.error) {
|
if (msg.error) {
|
||||||
alert(msg.error);
|
alert(msg.error);
|
||||||
this.state.loginLoading = false;
|
this.state = this.emptyState;
|
||||||
this.state.registerLoading = false;
|
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue