FIX: Topic map should be expanded by default when > 50 posts

This commit is contained in:
Robin Ward 2016-03-09 12:12:43 -05:00
parent 25dc5043e3
commit 1009dc9be1
2 changed files with 3 additions and 3 deletions

View File

@ -185,8 +185,8 @@ export default createWidget('topic-map', {
tagName: 'div.topic-map',
buildKey: attrs => `topic-map-${attrs.id}`,
defaultState() {
return { collapsed: true };
defaultState(attrs) {
return { collapsed: attrs.topicPostsCount < 50 };
},
html(attrs, state) {

View File

@ -140,7 +140,7 @@ export default class Widget {
if (prev && prev.state) {
this.state = prev.state;
} else {
this.state = this.defaultState();
this.state = this.defaultState(this.attrs, this.state);
}
// Sometimes we pass state down from the parent