FIX: when switching reply type update options

Previously we were not correctly updating reply types leading to inconsistent
behavior when using drop down in composer (for reply type)
This commit is contained in:
Sam Saffron 2020-03-31 14:40:00 +11:00
parent d282233d31
commit fcc5ef9625
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
1 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,7 @@ export function _clearSnapshots() {
} }
export default DropdownSelectBoxComponent.extend({ export default DropdownSelectBoxComponent.extend({
_seq: 0,
pluginApiIdentifiers: ["composer-actions"], pluginApiIdentifiers: ["composer-actions"],
classNames: ["composer-actions"], classNames: ["composer-actions"],
@ -29,6 +30,10 @@ export default DropdownSelectBoxComponent.extend({
showFullTitle: false showFullTitle: false
}, },
contentChanged() {
this.set("_seq", this._seq + 1);
},
didReceiveAttrs() { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
@ -40,6 +45,7 @@ export default DropdownSelectBoxComponent.extend({
) { ) {
_topicSnapshot = this.get("composerModel.topic"); _topicSnapshot = this.get("composerModel.topic");
_postSnapshot = this.get("composerModel.post"); _postSnapshot = this.get("composerModel.post");
this.contentChanged();
} }
// if we hit reply on a different post we want to change postSnapshot // if we hit reply on a different post we want to change postSnapshot
@ -48,6 +54,7 @@ export default DropdownSelectBoxComponent.extend({
(!_postSnapshot || this.get("composerModel.post.id") !== _postSnapshot.id) (!_postSnapshot || this.get("composerModel.post.id") !== _postSnapshot.id)
) { ) {
_postSnapshot = this.get("composerModel.post"); _postSnapshot = this.get("composerModel.post");
this.contentChanged();
} }
if (isEmpty(this.content)) { if (isEmpty(this.content)) {
@ -59,7 +66,7 @@ export default DropdownSelectBoxComponent.extend({
return {}; return {};
}, },
content: computed(function() { content: computed("_seq", function() {
let items = []; let items = [];
if ( if (
@ -304,6 +311,7 @@ export default DropdownSelectBoxComponent.extend({
), ),
this.composerModel this.composerModel
); );
this.contentChanged();
} else { } else {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(`No method '${action}' found`); console.error(`No method '${action}' found`);