FIX: Don't set `categoryId` on PM drafts (#20475)
This commit is contained in:
parent
ddbe6cf3b5
commit
7c74e4882a
|
@ -142,7 +142,9 @@ const Composer = RestModel.extend({
|
||||||
set(categoryId) {
|
set(categoryId) {
|
||||||
const oldCategoryId = this._categoryId;
|
const oldCategoryId = this._categoryId;
|
||||||
|
|
||||||
if (isEmpty(categoryId)) {
|
if (this.privateMessage) {
|
||||||
|
categoryId = null;
|
||||||
|
} else if (isEmpty(categoryId)) {
|
||||||
// Check if there is a default composer category to set
|
// Check if there is a default composer category to set
|
||||||
const defaultComposerCategoryId = parseInt(
|
const defaultComposerCategoryId = parseInt(
|
||||||
this.siteSettings.default_composer_category,
|
this.siteSettings.default_composer_category,
|
||||||
|
|
|
@ -317,6 +317,20 @@ module("Unit | Model | composer", function (hooks) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("initial category when creating PM and there is a default composer category", function (assert) {
|
||||||
|
this.siteSettings.default_composer_category = 2;
|
||||||
|
const composer = openComposer.call(this, {
|
||||||
|
action: PRIVATE_MESSAGE,
|
||||||
|
draftKey: "abcd",
|
||||||
|
draftSequence: 1,
|
||||||
|
});
|
||||||
|
assert.strictEqual(
|
||||||
|
composer.categoryId,
|
||||||
|
null,
|
||||||
|
"it doesn't save the category"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("open with a quote", function (assert) {
|
test("open with a quote", function (assert) {
|
||||||
const quote =
|
const quote =
|
||||||
'[quote="neil, post:5, topic:413"]\nSimmer down you two.\n[/quote]';
|
'[quote="neil, post:5, topic:413"]\nSimmer down you two.\n[/quote]';
|
||||||
|
|
Loading…
Reference in New Issue