UX: Hide all timeline controls when fewer than 3 posts
This commit is contained in:
parent
0e3b275684
commit
b9f82641b0
|
@ -209,6 +209,9 @@ export default createWidget('topic-timeline', {
|
|||
html(attrs) {
|
||||
const { topic } = attrs;
|
||||
const createdAt = new Date(topic.created_at);
|
||||
const stream = attrs.topic.get('postStream.stream');
|
||||
|
||||
if (stream.length < 3) { return; }
|
||||
|
||||
const controls = [];
|
||||
if (attrs.topic.get('details.can_create_post')) {
|
||||
|
@ -225,10 +228,7 @@ export default createWidget('topic-timeline', {
|
|||
controls.push(this.attach('topic-admin-menu-button', { topic }));
|
||||
}
|
||||
|
||||
const result = [ h('div.timeline-controls', controls) ];
|
||||
const stream = attrs.topic.get('postStream.stream');
|
||||
if (stream.length > 2) {
|
||||
return result.concat([
|
||||
return [ h('div.timeline-controls', controls),
|
||||
this.attach('link', {
|
||||
className: 'start-date',
|
||||
rawLabel: moment(createdAt).format(I18n.t('dates.timeline_start')),
|
||||
|
@ -240,10 +240,6 @@ export default createWidget('topic-timeline', {
|
|||
icon: 'dot-circle-o',
|
||||
rawLabel: relativeAge(new Date(topic.last_posted_at), { addAgo: true }),
|
||||
action: 'jumpBottom'
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}) ];
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue