fix: JS errors

This commit is contained in:
Sami Mazouz 2024-09-28 13:36:43 +01:00
parent ae03e6d473
commit 5ff66fd033
No known key found for this signature in database
2 changed files with 12 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import username from '../../common/helpers/username';
import highlight from '../../common/helpers/highlight';
import classList from '../../common/utils/classList';
import type Mithril from 'mithril';
import type ForumApplication from '../../forum/ForumApplication';
export interface IUserSearchResultAttrs extends ComponentAttrs {
user: User;
@ -26,7 +27,17 @@ export default class UserSearchResult<CustomAttrs extends IUserSearchResultAttrs
data-id={user.id()}
onclick={this.attrs.onclick}
>
{this.attrs.onclick ? <button type="button">{this.content(vnode)}</button> : <Link href={app.route.user(user)}>{this.content(vnode)}</Link>}
{this.attrs.onclick ? (
<button type="button">{this.content(vnode)}</button>
) : (
<Link
href={
'user' in app.route ? (app as unknown as ForumApplication).route.user(user) : app.forum.attribute('baseUrl') + '/u/' + user.username()
}
>
{this.content(vnode)}
</Link>
)}
</li>
);
}

View File

@ -1,7 +1,5 @@
import Forum from './ForumApplication';
console.error('No');
const app = new Forum();
// @ts-expect-error We need to do this for backwards compatibility purposes.