mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-05 06:00:31 +00:00
Spamtimer
This commit is contained in:
parent
cd03fa5e03
commit
009b3b5079
@ -969,7 +969,7 @@ impl Perform for ListCommunities {
|
|||||||
|
|
||||||
let sort = SortType::from_str(&self.sort)?;
|
let sort = SortType::from_str(&self.sort)?;
|
||||||
|
|
||||||
let communities: Vec<CommunityView> = CommunityView::list(&conn, user_id, sort, self.page, Some(50))?;
|
let communities: Vec<CommunityView> = CommunityView::list(&conn, user_id, sort, self.page, self.limit)?;
|
||||||
|
|
||||||
// Return the jwt
|
// Return the jwt
|
||||||
Ok(
|
Ok(
|
||||||
|
@ -33,7 +33,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
|||||||
|
|
||||||
let listCommunitiesForm: ListCommunitiesForm = {
|
let listCommunitiesForm: ListCommunitiesForm = {
|
||||||
sort: SortType[SortType.TopAll],
|
sort: SortType[SortType.TopAll],
|
||||||
limit: 9999,
|
limit: 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketService.Instance.listCommunities(listCommunitiesForm);
|
WebSocketService.Instance.listCommunities(listCommunitiesForm);
|
||||||
|
@ -10,6 +10,7 @@ interface State {
|
|||||||
registerForm: RegisterForm;
|
registerForm: RegisterForm;
|
||||||
loginLoading: boolean;
|
loginLoading: boolean;
|
||||||
registerLoading: boolean;
|
registerLoading: boolean;
|
||||||
|
spamTimer: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +29,8 @@ export class Login extends Component<any, State> {
|
|||||||
admin: false,
|
admin: false,
|
||||||
},
|
},
|
||||||
loginLoading: false,
|
loginLoading: false,
|
||||||
registerLoading: false
|
registerLoading: false,
|
||||||
|
spamTimer: new Date().getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
@ -124,6 +126,7 @@ export class Login extends Component<any, State> {
|
|||||||
<input type="password" value={this.state.registerForm.password_verify} onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)} class="form-control" required />
|
<input type="password" value={this.state.registerForm.password_verify} onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)} class="form-control" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" value={this.state.spamTimer} />
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<button type="submit" class="btn btn-secondary">{this.state.registerLoading ?
|
<button type="submit" class="btn btn-secondary">{this.state.registerLoading ?
|
||||||
@ -157,9 +160,14 @@ export class Login extends Component<any, State> {
|
|||||||
i.state.registerLoading = true;
|
i.state.registerLoading = true;
|
||||||
i.setState(i.state);
|
i.setState(i.state);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setTimeout(function(){
|
|
||||||
|
let endTimer = new Date().getTime();
|
||||||
|
let elapsed = endTimer - i.state.spamTimer;
|
||||||
|
if (elapsed > 4500) {
|
||||||
WebSocketService.Instance.register(i.state.registerForm);
|
WebSocketService.Instance.register(i.state.registerForm);
|
||||||
}, 10000);
|
} else {
|
||||||
|
location.reload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRegisterUsernameChange(i: Login, event: any) {
|
handleRegisterUsernameChange(i: Login, event: any) {
|
||||||
|
Loading…
Reference in New Issue
Block a user