FIX: Sending message with no recipients should work.

FIX: Sending message with no recipients should work.

From c657a6d1c6bd9bff43d748297a178a972509971f Mon Sep 17 00:00:00 2001
From: Dan Ungureanu <dan@ungureanu.me>
Date: Fri, 30 Nov 2018 16:23:38 +0200
Subject: [PATCH] FIX: Sending message with no recipients should work.


diff --git a/assets/javascripts/discourse/initializers/hook-composer.js.es6 b/assets/javascripts/discourse/initializers/hook-composer.js.es6
index 4b50c73..4268da9 100644
--- a/assets/javascripts/discourse/initializers/hook-composer.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-composer.js.es6
@@ -221,9 +221,9 @@ export default {
 
       @computed("targetUsernames")
       recipients(targetUsernames) {
-        return targetUsernames !== ""
-          ? targetUsernames.split(",").concat([this.get("user.username")])
-          : [];
+        const recipients = targetUsernames ? targetUsernames.split(",") : [];
+        recipients.push(this.get("user.username"));
+        return recipients;
       }
     });
   }

GitHub

2 Likes