mirror of
https://github.com/flarum/core.git
synced 2025-10-15 17:04:26 +02:00
Merge branch 'master' into 1236-database-changes
This commit is contained in:
@@ -115,6 +115,12 @@ export default class DiscussionPage extends Page {
|
||||
);
|
||||
}
|
||||
|
||||
config() {
|
||||
if (this.discussion) {
|
||||
app.setTitle(this.discussion.title());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear and reload the discussion.
|
||||
*/
|
||||
@@ -160,7 +166,6 @@ export default class DiscussionPage extends Page {
|
||||
this.discussion = discussion;
|
||||
|
||||
app.history.push('discussion', discussion.title());
|
||||
app.setTitle(discussion.title());
|
||||
app.setTitleCount(0);
|
||||
|
||||
// When the API responds with a discussion, it will also include a number of
|
||||
|
@@ -38,7 +38,7 @@ export default class Search extends Component {
|
||||
*
|
||||
* @type {SearchSource[]}
|
||||
*/
|
||||
this.sources = this.sourceItems().toArray();
|
||||
this.sources = null;
|
||||
|
||||
/**
|
||||
* The number of sources that are still loading results.
|
||||
@@ -74,6 +74,15 @@ export default class Search extends Component {
|
||||
this.value(currentSearch || '');
|
||||
}
|
||||
|
||||
// Initialize search sources in the view rather than the constructor so
|
||||
// that we have access to app.forum.
|
||||
if (!this.sources) {
|
||||
this.sources = this.sourceItems().toArray();
|
||||
}
|
||||
|
||||
// Hide the search view if no sources were loaded
|
||||
if (!this.sources.length) return <div></div>;
|
||||
|
||||
return (
|
||||
<div className={'Search ' + classList({
|
||||
open: this.value() && this.hasFocus,
|
||||
@@ -210,8 +219,8 @@ export default class Search extends Component {
|
||||
sourceItems() {
|
||||
const items = new ItemList();
|
||||
|
||||
items.add('discussions', new DiscussionsSearchSource());
|
||||
items.add('users', new UsersSearchSource());
|
||||
if (app.forum.attribute('canViewDiscussions')) items.add('discussions', new DiscussionsSearchSource());
|
||||
if (app.forum.attribute('canViewUserList')) items.add('users', new UsersSearchSource());
|
||||
|
||||
return items;
|
||||
}
|
||||
|
Reference in New Issue
Block a user