import { Component, linkEvent } from 'inferno';
-import { Helmet } from 'inferno-helmet';
import { Subscription } from 'rxjs';
import {
UserOperation,
setAuth,
} from '../utils';
import { PostListing } from './post-listing';
+import { HtmlTags } from './html-tags';
import { UserListing } from './user-listing';
import { CommunityLink } from './community-link';
import { SortSelect } from './sort-select';
};
static getSearchQueryFromProps(q: string): string {
- return q || '';
+ return decodeURIComponent(q) || '';
}
static getSearchTypeFromProps(type_: string): SearchType {
}
get documentTitle(): string {
- if (this.state.site.name) {
- if (this.state.q) {
- return `${i18n.t('search')} - ${this.state.q} - ${
- this.state.site.name
- }`;
- } else {
- return `${i18n.t('search')} - ${this.state.site.name}`;
- }
+ if (this.state.q) {
+ return `${i18n.t('search')} - ${this.state.q} - ${this.state.site.name}`;
} else {
- return 'Lemmy';
+ return `${i18n.t('search')} - ${this.state.site.name}`;
}
}
render() {
return (
<div class="container">
- <Helmet title={this.documentTitle} />
+ <HtmlTags
+ title={this.documentTitle}
+ path={this.context.router.route.match.url}
+ />
<h5>{i18n.t('search')}</h5>
{this.selects()}
{this.searchForm()}
updateUrl(paramUpdates: UrlParams) {
const qStr = paramUpdates.q || this.state.q;
+ const qStrEncoded = encodeURIComponent(qStr);
const typeStr = paramUpdates.type_ || this.state.type_;
const sortStr = paramUpdates.sort || this.state.sort;
const page = paramUpdates.page || this.state.page;
this.props.history.push(
- `/search/q/${qStr}/type/${typeStr}/sort/${sortStr}/page/${page}`
+ `/search/q/${qStrEncoded}/type/${typeStr}/sort/${sortStr}/page/${page}`
);
}