Fix error when rendering deleted user

This commit is contained in:
Toby Zerner 2015-05-26 18:02:04 +09:30
parent 652e41a235
commit 5a266ed305
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import { dasherize } from 'flarum/utils/string';
export default class EventPost extends Post {
view(iconName, content, attrs) {
var post = this.props.post;
var user = post.user();
attrs = attrs || {};
attrs.className = 'event-post post-'+dasherize(post.contentType())+' '+(attrs.className || '');
@ -14,7 +15,7 @@ export default class EventPost extends Post {
return super.view([
icon(iconName+' post-icon'),
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
]),
m('div.event-post-time', humanTime(post.time()))

View File

@ -34,4 +34,10 @@ export default function(app) {
near: post.number()
});
};
app.route.user = function(user) {
return app.route('user', {
username: user.username()
});
};
}