Revert: required time bomb (#93)

Revert: required time bomb (#93)

  • Revert “DEV: Attempt to fix flaky tests (#91)”

This reverts commit a088f8afc0e46776f4445b209e505b96985d64a1.

  • Revert “Build(deps): Bump y18n from 5.0.2 to 5.0.8 (#89)”

This reverts commit 6f198a2fdaa81db5b0c3ee6c0c95a36bcd4db4a3.

  • Revert “DEV: Remove .replace that isn’t used anymore (#90)”

This reverts commit 5269c22b4d0b624d300920ae9c3297e1e22f4421.

  • Revert “DEV: Remove package-lock.json (#88)”

This reverts commit 321a6963806ef2671dbd2692e6afbb156465197e.

  • Revert “Require time bomb (#86)”

This reverts commit cae5923ad056789c67a25e355fdff166b5d096eb.

diff --git a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.hbs b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.hbs
index 262b882..349866b 100644
--- a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.hbs
+++ b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.hbs
@@ -8,7 +8,7 @@
       {{~#if model.isEncrypted}}
         {{~#unless model.editingPost~}}
           <div class="composer-action-divider"></div>
-          {{~encrypted-post-timer-dropdown topicDeleteAt=this.model.topic.delete_at disabled=timeBombRequired onChange=(action "timerClicked")}}
+          {{~encrypted-post-timer-dropdown topicDeleteAt=this.model.topic.delete_at onChange=(action "timerClicked")}}
           <span title={{ i18n "encrypt.time_bomb.title" after=this.model.deleteAfterMinutesLabel}}>{{this.model.deleteAfterMinutesLabel}}</span>
         {{/unless}}
       {{/if}}
diff --git a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6 b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6
index 66d549b..ca7231e 100644
--- a/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6
+++ b/assets/javascripts/discourse/connectors/composer-action-after/encrypt.js.es6
@@ -10,21 +10,10 @@ export default {
   setupComponent(args, component) {
     const currentUser = getOwner(component).lookup("current-user:main");
     const status = getEncryptionStatus(currentUser);
-    const timerOptions = {
-      "3 minutes": "3",
-      "1 hour": "60",
-      "3 hours": "180",
-      "12 hours": "720",
-      "24 hours": "1440",
-      "3 days": "4320",
-      "7 days": "10080",
-    };
 
     component.setProperties({
       isEncryptEnabled: status !== ENCRYPT_DISABLED,
       isEncryptActive: status === ENCRYPT_ACTIVE,
-      timeBombRequired: this.siteSettings.require_time_bombs,
-      timeBombLength: this.siteSettings.required_time_bomb_length,
 
       /** Listens for encryption status updates. */
       listener() {
@@ -38,16 +27,6 @@ export default {
       didInsertElement() {
         this._super(...arguments);
         this.appEvents.on("encrypt:status-changed", this, this.listener);
-        if (this.timeBombRequired) {
-          this.model.setProperties({
-            deleteAfterMinutes: this.timeBombRequired
-              ? timerOptions[this.timeBombLength]
-              : null,
-            deleteAfterMinutesLabel: this.timeBombRequired
-              ? I18n.t("encrypt.time_bomb." + this.timeBombLength)
-              : null,
-          });
-        }
       },
 
       willDestroyElement() {
@@ -61,12 +40,8 @@ export default {
             isEncrypted: !this.model.isEncrypted,
             isEncryptedChanged: true,
             showEncryptError: !this.model.isEncrypted,
-            deleteAfterMinutes: this.timeBombRequired
-              ? timerOptions[this.timeBombLength]
-              : null,
-            deleteAfterMinutesLabel: this.timeBombRequired
-              ? I18n.t("encrypt.time_bomb." + this.timeBombLength)
-              : null,
+            deleteAfterMinutes: null,
+            deleteAfterMinutesLabel: null,
           });
         } else {
           this.model.set("showEncryptError", !this.model.showEncryptError);
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 671fe70..a752a5e 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -9,5 +9,3 @@ en:
     auto_enable_encrypt: "Automatically enable encrypt for all logged in users"
     encrypt_groups: "The name of groups that are able to use encryption (empty means everyone)."
     encrypt_pms_default: "Encrypt all new private messages by default"
-    require_time_bombs: "Require that all encrypted PMs are automatically destroyed"
-    required_time_bomb_length: "The length of time encrypted PMs will live if required_time_bombs is enabled"
\ No newline at end of file
diff --git a/config/settings.yml b/config/settings.yml
index 8872573..4ed300a 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -15,18 +15,3 @@ plugins:
   encrypt_pms_default:
     client: true
     default: true
-  require_time_bombs:
-    client: true
-    default: true
-  required_time_bomb_length:
-    client: true
-    default: "3 minutes"
-    type: enum
-    choices:
-      - "3 minutes"
-      - "1 hour"
-      - "3 hours"
-      - "12 hours"
-      - "24 hours"
-      - "3 days"
-      - "7 days"
diff --git a/test/javascripts/acceptance/encrypt-test.js.es6 b/test/javascripts/acceptance/encrypt-test.js.es6
index 8776ba7..a70fd71 100644
--- a/test/javascripts/acceptance/encrypt-test.js.es6
+++ b/test/javascripts/acceptance/encrypt-test.js.es6
@@ -148,8 +148,6 @@ acceptance("Encrypt", function (needs) {
     encrypt_enabled: true,
     encrypt_groups: "",
     encrypt_pms_default: true,
-    require_time_bombs: false,
-    required_time_bomb_length: "3 minutes",
   });
 
   needs.hooks.beforeEach(() => {
@@ -244,9 +242,6 @@ acceptance("Encrypt", function (needs) {
     });
 
     const composerActions = selectKit(".composer-actions");
-    const encryptedPostTimerDropdown = selectKit(
-      ".encrypted-post-timer-dropdown"
-    );
 
     await visit("/");
     await click("#create-topic");
@@ -262,10 +257,6 @@ acceptance("Encrypt", function (needs) {
     await fillIn("#private-message-users .filter-input", "evilt");
     await keyEvent("#private-message-users .filter-input", "keydown", 13);
 
-    // can click on timer
-    assert.ok(!encryptedPostTimerDropdown.isHidden());
-    assert.ok(!encryptedPostTimerDropdown.isDisabled());
-
     requests = [];
     await wait(
       () => requests.includes("/draft.json"),
@@ -287,48 +278,6 @@ acceptance("Encrypt", function (needs) {
     globalAssert = null;
   });
 
-  test("cannot adjust exploding pms when required", async (assert) => {
-    needs.settings({
-      encrypt_enabled: true,
-      encrypt_groups: "",
-      encrypt_pms_default: true,
-      require_time_bombs: true,
-      required_time_bomb_length: "3 minutes",
-    });
-
-    const composerActions = selectKit(".composer-actions");
-    const encryptedPostTimerDropdown = selectKit(
-      ".encrypted-post-timer-dropdown"
-    );
-
-    await visit("/");
-    await click("#create-topic");
-    await composerActions.expand();
-    await composerActions.selectRowByValue("reply_as_private_message");
-
-    if (find(".users-input").text().trim() !== "") {
-      globalAssert = null;
-      throw new Error("Another test is leaking composer state");
-    }
-
-    // simulate selecting from autocomplete suggestions
-    await fillIn("#private-message-users .filter-input", "evilt");
-    await keyEvent("#private-message-users .filter-input", "keydown", 13);
-
-    // cannot click on timer
-    assert.ok(!encryptedPostTimerDropdown.isHidden());
-    assert.ok(!encryptedPostTimerDropdown.isDisabled());
-
-    // reset these settings back
-    needs.settings({
-      encrypt_enabled: true,
-      encrypt_groups: "",
-      encrypt_pms_default: true,
-      require_time_bombs: false,
-      required_time_bomb_length: "3 minutes",
-    });
-  });
-
   test("new draft for public topic is not encrypted", async (assert) => {
     await setEncryptionStatus(ENCRYPT_ACTIVE);
 
diff --git a/yarn.lock b/yarn.lock
index 8ccf26e..a6f7fb5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1470,9 +1470,9 @@ write@1.0.3:
     mkdirp "^0.5.1"
 
 y18n@^5.0.1:
-  version "5.0.8"
-  resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
-  integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
+  version "5.0.2"
+  resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.2.tgz#48218df5da2731b4403115c39a1af709c873f829"
+  integrity sha512-CkwaeZw6dQgqgPGeTWKMXCRmMcBgETFlTml1+ZOO+q7kGst8NREJ+eWwFNPVUQ4QGdAaklbqCZHH6Zuep1RjiA==
 

[... diff too long, it was truncated ...]

GitHub sha: ddf20aa8

1 Like

This commit appears in #93 which was approved by SamSaffron. It was merged by SamSaffron.