1
0
mirror of https://github.com/flarum/core.git synced 2025-10-15 00:44:40 +02:00

Gracefully handle non-existent/deleted users during rendering

This commit is contained in:
Toby Zerner
2015-05-03 12:08:41 +09:30
parent f2e2d59e6f
commit d9d190b772
4 changed files with 13 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
import Component from 'flarum/component';
import humanTime from 'flarum/utils/human-time';
import username from 'flarum/helpers/username';
/**
Displays information about a the first or last post in a discussion.
@@ -16,7 +17,7 @@ export default class TerminalPost extends Component {
var lastPost = this.props.lastPost && discussion.repliesCount();
return m('span', [
m('span.username', discussion[lastPost ? 'lastUser' : 'startUser']().username()),
username(discussion[lastPost ? 'lastUser' : 'startUser']()),
lastPost ? ' replied ' : ' started ',
m('time', humanTime(discussion[lastPost ? 'lastTime' : 'startTime']()))
])