A few fixes.

This commit is contained in:
Dessalines 2021-11-22 15:04:20 -05:00
parent ebf216ccc9
commit d6f651568b
4 changed files with 12 additions and 8 deletions

View file

@ -426,7 +426,7 @@ export class Signup extends Component<any, State> {
this.state = this.emptyState;
this.state.registerForm.captcha_answer = undefined;
// Refetch another captcha
WebSocketService.Instance.send(wsClient.getCaptcha());
// WebSocketService.Instance.send(wsClient.getCaptcha());
this.setState(this.state);
return;
} else {

View file

@ -606,7 +606,7 @@ export class Profile extends Component<any, ProfileState> {
if (
UserService.Instance.myUserInfo &&
data.comment_view.creator.id ==
UserService.Instance.myUserInfo.local_user_view.person.id
UserService.Instance.myUserInfo?.local_user_view.person.id
) {
toast(i18n.t("reply_sent"));
}

View file

@ -269,7 +269,7 @@ export class Post extends Component<any, PostState> {
}
isBottom(el: Element) {
return el.getBoundingClientRect().bottom <= window.innerHeight;
return el?.getBoundingClientRect().bottom <= window.innerHeight;
}
/**
@ -277,7 +277,7 @@ export class Post extends Component<any, PostState> {
*/
trackCommentsBoxScrolling = () => {
const wrappedElement = document.getElementsByClassName("comments")[0];
if (this.isBottom(wrappedElement)) {
if (wrappedElement && this.isBottom(wrappedElement)) {
this.state.maxCommentsShown += commentsShownInterval;
this.setState(this.state);
}

View file

@ -809,10 +809,14 @@ export class Search extends Component<any, SearchState> {
this.creatorChoices.passedElement.element.addEventListener(
"search",
debounce(async (e: any) => {
let creators = (await fetchUsers(e.detail.value)).users;
let choices = creators.map(pvs => personToChoice(pvs));
choices.unshift({ value: "0", label: i18n.t("all") });
this.creatorChoices.setChoices(choices, "value", "label", true);
try {
let creators = (await fetchUsers(e.detail.value)).users;
let choices = creators.map(pvs => personToChoice(pvs));
choices.unshift({ value: "0", label: i18n.t("all") });
this.creatorChoices.setChoices(choices, "value", "label", true);
} catch (err) {
console.log(err);
}
}, 400),
false
);