FIX: Hide full-page chat exit button when chat isolated (#221)

FIX: Hide full-page chat exit button when chat isolated (#221)

diff --git a/assets/javascripts/discourse/components/topic-chat-float.js b/assets/javascripts/discourse/components/topic-chat-float.js
index 1e3baa4..027ad65 100644
--- a/assets/javascripts/discourse/components/topic-chat-float.js
+++ b/assets/javascripts/discourse/components/topic-chat-float.js
@@ -1,5 +1,6 @@
 import Component from "@ember/component";
 import discourseComputed, { observes } from "discourse-common/utils/decorators";
+import getURL from "discourse-common/lib/get-url";
 import { action } from "@ember/object";
 import {
   CHAT_VIEW,
@@ -211,8 +212,14 @@ export default Component.extend({
   },
 
   @action
-  openInFullPage() {
+  openInFullPage(e) {
     const channel = this.activeChannel;
+    if (e.which === 2) {
+      // Middle mouse click
+      window.open(getURL(`/chat/channel/${channel.title}`), "_blank").focus();
+      return false;
+    }
+
     // Set activeChannel to null to avoid a moment where the chat composer is rendered twice.
     // Since the mobile-file-upload button has an ID, a JS error will break things otherwise.
     this.setProperties({
diff --git a/assets/javascripts/discourse/templates/components/chat-live-pane.hbs b/assets/javascripts/discourse/templates/components/chat-live-pane.hbs
index 9109b02..4bc5548 100644
--- a/assets/javascripts/discourse/templates/components/chat-live-pane.hbs
+++ b/assets/javascripts/discourse/templates/components/chat-live-pane.hbs
@@ -15,12 +15,14 @@
         label="chat.join_channel"
       }}
     {{/if}}
-    {{d-button
-      action=(action "exitChat")
-      class="btn-flat exit-chat-btn"
-      icon="times"
-      title="chat.exit"
-    }}
+    {{#unless currentUser.chat_isolated}}
+      {{d-button
+        action=(action "exitChat")
+        class="btn-flat exit-chat-btn"
+        icon="times"
+        title="chat.exit"
+      }}
+    {{/unless}}
   </div>
 {{/if}}
 
diff --git a/assets/javascripts/discourse/templates/components/topic-chat-float.hbs b/assets/javascripts/discourse/templates/components/topic-chat-float.hbs
index a986968..3d053e3 100644
--- a/assets/javascripts/discourse/templates/components/topic-chat-float.hbs
+++ b/assets/javascripts/discourse/templates/components/topic-chat-float.hbs
@@ -24,7 +24,15 @@
         </div>
       {{/if}}
 
-      {{flat-button icon="discourse-expand" class="tc-full-screen-btn" action=(action "openInFullPage") title="chat.open_full_page"}}
+      <button
+        class="btn-flat tc-full-screen-btn"
+        onmousedown={{action "openInFullPage"}}
+        icon="discourse-expand"
+        title="chat.open_full_page"
+        type="button"
+      >
+        {{d-icon "discourse-expand"}}
+      </button>
       {{flat-button icon=this.expandIcon class="tc-expand" action=(action "toggleExpand") title="chat.collapse"}}
 
       {{#if showClose}}

GitHub sha: 3fff6268df939112a84ed05b6c2449c6775dcb0a

This commit appears in #221 which was approved by romanrizzi. It was merged by markvanlan.