Ver código fonte

UX: Randomize passwords, remove password inputs, disallow adding entry without a meeting ID

Penar Musaraj 4 anos atrás
pai
commit
0960fa0eee

+ 18 - 1
assets/javascripts/discourse-bbb/controllers/insert-bbb.js.es6

@@ -1,5 +1,7 @@
 import Controller from "@ember/controller";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
+import discourseComputed from "discourse-common/utils/decorators";
+import { isEmpty } from "@ember/utils";
 
 export default Controller.extend(ModalFunctionality, {
   keyDown(e) {
@@ -21,11 +23,26 @@ export default Controller.extend(ModalFunctionality, {
     });
   },
 
+  randomID() {
+    return Math.random()
+      .toString(36)
+      .slice(-8);
+  },
+
+  @discourseComputed("meetingID")
+  insertDisabled(meetingID) {
+    return isEmpty(meetingID);
+  },
+
   actions: {
     insert() {
       const btnTxt = this.buttonText ? ` label="${this.buttonText}"` : "";
       this.toolbarEvent.addText(
-        `[wrap=discourse-bbb meetingID="${this.meetingID}"${btnTxt} attendeePW="${this.attendeePW}" moderatorPW="${this.moderatorPW}" mobileIframe="${this.mobileIframe}" desktopIframe="${this.desktopIframe}"][/wrap]`
+        `[wrap=discourse-bbb meetingID="${
+          this.meetingID
+        }"${btnTxt} attendeePW="${this.randomID()}" moderatorPW="${this.randomID()}" mobileIframe="${
+          this.mobileIframe
+        }" desktopIframe="${this.desktopIframe}"][/wrap]`
       );
       this.send("closeModal");
     },

+ 1 - 11
assets/javascripts/discourse/templates/modal/insert-bbb.hbs

@@ -5,21 +5,11 @@
     {{text-field value=meetingID}}
   </div>
 
-  <div class="insert-bbb-input">
+  <div class="insert-bbb-input bbb-button-text">
     <label>{{i18n "bbb.button_text"}}</label>
     {{text-field value=buttonText placeholderKey="bbb.launch"}}
   </div>
 
-  <div class="insert-bbb-input">
-    <label>{{i18n "bbb.attendeePW"}}</label>
-    {{text-field value=attendeePW}}
-  </div>
-
-  <div class="insert-bbb-input">
-    <label>{{i18n "bbb.moderatorPW"}}</label>
-    {{text-field value=moderatorPW}}
-  </div>
-
   <div class="insert-bbb-input">
     <label class='checkbox-label'>
       {{input type="checkbox" checked=mobileIframe}}

+ 4 - 0
assets/stylesheets/common/bbb.scss

@@ -6,3 +6,7 @@
 .bbb-status img {
   margin-left: 0.5em;
 }
+
+.bbb-button-text {
+  margin-bottom: 1em;
+}

+ 0 - 2
config/locales/client.en.yml

@@ -4,8 +4,6 @@ en:
       composer_title: Add BigBlueButton
       meetingID: Meeting ID
       button_text: Button label (optional)
-      attendeePW: Attendee password
-      moderatorPW: Moderator password
       launch: Start Video Conference
       modal:
         insert: Insert