Merge pull request #502 from LemmyNet/a_few_small_fixes

A few fixes.
This commit is contained in:
Dessalines 2021-11-22 15:08:11 -05:00 committed by GitHub
commit b1158b9f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
);