mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 22:53:37 +08:00
Fix error when rendering deleted user
This commit is contained in:
parent
652e41a235
commit
5a266ed305
|
@ -7,6 +7,7 @@ import { dasherize } from 'flarum/utils/string';
|
||||||
export default class EventPost extends Post {
|
export default class EventPost extends Post {
|
||||||
view(iconName, content, attrs) {
|
view(iconName, content, attrs) {
|
||||||
var post = this.props.post;
|
var post = this.props.post;
|
||||||
|
var user = post.user();
|
||||||
|
|
||||||
attrs = attrs || {};
|
attrs = attrs || {};
|
||||||
attrs.className = 'event-post post-'+dasherize(post.contentType())+' '+(attrs.className || '');
|
attrs.className = 'event-post post-'+dasherize(post.contentType())+' '+(attrs.className || '');
|
||||||
|
@ -14,7 +15,7 @@ export default class EventPost extends Post {
|
||||||
return super.view([
|
return super.view([
|
||||||
icon(iconName+' post-icon'),
|
icon(iconName+' post-icon'),
|
||||||
m('div.event-post-info', [
|
m('div.event-post-info', [
|
||||||
m('a.post-user', {href: app.route('user', { username: post.user().username() }), config: m.route}, username(post.user())), ' ',
|
user ? m('a.post-user', {href: app.route.user(user), config: m.route}, username(user)) : username(user), ' ',
|
||||||
content
|
content
|
||||||
]),
|
]),
|
||||||
m('div.event-post-time', humanTime(post.time()))
|
m('div.event-post-time', humanTime(post.time()))
|
||||||
|
|
|
@ -34,4 +34,10 @@ export default function(app) {
|
||||||
near: post.number()
|
near: post.number()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
app.route.user = function(user) {
|
||||||
|
return app.route('user', {
|
||||||
|
username: user.username()
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user