1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 13:10:24 +02:00

Add Content for User page, preload user & throw 404 accordingly (#1901)

This commit is contained in:
David Sevilla Martín
2020-01-22 18:01:26 -05:00
committed by Franz Liedke
parent 76f7d566b2
commit 02899d4f68
3 changed files with 89 additions and 2 deletions

View File

@@ -88,8 +88,13 @@ export default class UserPage extends Page {
loadUser(username) {
const lowercaseUsername = username.toLowerCase();
// Load the preloaded user object, if any, into the global app store
// We don't use the output of the method because it returns raw JSON
// instead of the parsed models
app.preloadedApiDocument();
app.store.all('users').some(user => {
if (user.username().toLowerCase() === lowercaseUsername && user.joinTime()) {
if ((user.username().toLowerCase() === lowercaseUsername || user.id() === username) && user.joinTime()) {
this.show(user);
return true;
}