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 = this.emptyState;
this.state.registerForm.captcha_answer = undefined; this.state.registerForm.captcha_answer = undefined;
// Refetch another captcha // Refetch another captcha
WebSocketService.Instance.send(wsClient.getCaptcha()); // WebSocketService.Instance.send(wsClient.getCaptcha());
this.setState(this.state); this.setState(this.state);
return; return;
} else { } else {

View file

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

View file

@ -269,7 +269,7 @@ export class Post extends Component<any, PostState> {
} }
isBottom(el: Element) { 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 = () => { trackCommentsBoxScrolling = () => {
const wrappedElement = document.getElementsByClassName("comments")[0]; const wrappedElement = document.getElementsByClassName("comments")[0];
if (this.isBottom(wrappedElement)) { if (wrappedElement && this.isBottom(wrappedElement)) {
this.state.maxCommentsShown += commentsShownInterval; this.state.maxCommentsShown += commentsShownInterval;
this.setState(this.state); this.setState(this.state);
} }

View file

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