Show composer after discussion is reloaded following login

This commit is contained in:
Toby Zerner 2015-05-18 15:38:19 +09:30
parent 8b7e7c0afd
commit 96c3c2cc25
3 changed files with 17 additions and 2 deletions

View File

@ -11,8 +11,10 @@ import LoadingIndicator from 'flarum/components/loading-indicator';
import DropdownSplit from 'flarum/components/dropdown-split';
import Separator from 'flarum/components/separator';
import listItems from 'flarum/helpers/list-items';
import mixin from 'flarum/utils/mixin';
import evented from 'flarum/utils/evented';
export default class DiscussionPage extends Component {
export default class DiscussionPage extends mixin(Component, evented) {
/**
*/
@ -102,6 +104,8 @@ export default class DiscussionPage extends Component {
this.streamContent.goToNumber(this.currentNear, true);
app.setTitle(discussion.title());
this.trigger('loaded');
}
onload(element, isInitialized, context) {

View File

@ -25,7 +25,7 @@ export default function(app) {
} else if (!app.session.user()) {
app.modal.show(new LoginModal({
message: 'You must be logged in to do that.',
callback: this.replyAction.bind(this)
callback: () => app.current.one('loaded', this.replyAction.bind(this, goToLast, forceRefresh))
}));
}
}

View File

@ -23,6 +23,17 @@ export default {
this.getHandlers(event).push(handler);
},
/**
*/
one(event, handler) {
var wrapper = function() {
handler.apply(this, arguments);
this.off(event, wrapper);
};
this.getHandlers(event).push(wrapper);
},
/**
*/