discourse/plugins/automation/test/javascripts/integration/components/da-pms-field-test.gjs
Régis Hanol a94a001c64
DEV: Remove defunct "Encrypts PM if available" option from automation (#36973)
The "Encrypts PM if available" checkbox in automation script options was
a leftover from the discourse-encrypt plugin, which was archived almost
a year ago. Since `EncryptedPostCreator` no longer exists, the option
had no effect - the code always fell back to using the regular
`PostCreator`.

This removes all traces of the `prefers_encrypt` feature:
- The checkbox UI in the PM field component
- The `prefers_encrypt` parameter from `Utils.send_pm`
- References in send_pms and gift_exchange scripts
- The column from the pending_pms table (via post-deploy migration)
- Associated translations and tests

The column removal follows the standard two-phase approach: first
declaring `ignored_columns` in the model, then dropping the column in a
post-deploy migration.

Ref - https://meta.discourse.org/t/-/392664
2026-01-08 11:01:49 +01:00

43 lines
1.2 KiB
Text
Vendored

import { getOwner } from "@ember/owner";
import { click, fillIn, render } from "@ember/test-helpers";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import AutomationField from "discourse/plugins/automation/admin/components/automation-field";
import AutomationFabricators from "discourse/plugins/automation/admin/lib/fabricators";
module("Integration | Component | da-pms-field", function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
this.automation = new AutomationFabricators(getOwner(this)).automation();
});
test("set value", async function (assert) {
this.field = new AutomationFabricators(getOwner(this)).field({
component: "pms",
});
await render(
<template>
<AutomationField
@automation={{this.automation}}
@field={{this.field}}
/>
</template>
);
await click(".insert-pm");
await fillIn(".pm-title", "title");
await fillIn(".d-editor-input", "raw");
await fillIn(".pm-delay", 6);
assert.deepEqual(this.field.metadata.value, [
{
delay: "6",
raw: "raw",
title: "title",
},
]);
});
});