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.

  @prop discussion {Discussion} The discussion to display the post for
  @prop lastPost {Boolean} Whether or not to display the last/start post
  @class TerminalPost
  @constructor
  @extends Component
 */
export default class TerminalPost extends Component {
  view() {
    var discussion = this.props.discussion;
    var lastPost = this.props.lastPost && discussion.repliesCount();

    return m('span', [
      username(discussion[lastPost ? 'lastUser' : 'startUser']()),
      lastPost ? ' replied ' : ' started ',
      m('time', humanTime(discussion[lastPost ? 'lastTime' : 'startTime']()))
    ])
  }
}

@@ -69,12 +69,14 @@
 rum/
-util
+helper
 s/hu
@@ -604,42 +604,19 @@
     
-return m('span', %5B%0A      username(
+var user = 
 disc
@@ -664,17 +664,36 @@
 '%5D()
-),
+;
 %0A    
-  
+var time = discussion%5B
 last
@@ -704,71 +704,88 @@
  ? '
- replied 
+lastTime
 ' : '
- 
 start
-ed ',%0A      m('time', humanTime(discussion%5B
+Time'%5D();%0A%0A    return m('span', %5B%0A      username(user),%0A      
 last
@@ -796,35 +796,54 @@
  ? '
-lastTime
+ replied 
 ' : '
+ 
 start
-Time'%5D())
+ed ',%0A      humanTime(time
 )%0A  

Clean up, use time helper rather than util