From 701fb6c1c5ffa470f2bc8bde8c48063d76328ad9 Mon Sep 17 00:00:00 2001
From: Christopher Willis-Ford <cwillisf@media.mit.edu>
Date: Fri, 7 Sep 2018 11:13:13 -0700
Subject: [PATCH] Enable extension monitors, add flag to disable

Extension reporters now offer a monitor checkbox by default, unless the
`disableMonitor` flag is set in the extension block metadata.
---
 src/engine/runtime.js                       | 3 +++
 src/extension-support/extension-metadata.js | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/engine/runtime.js b/src/engine/runtime.js
index c12809c64..50ee722a4 100644
--- a/src/engine/runtime.js
+++ b/src/engine/runtime.js
@@ -745,6 +745,9 @@ class Runtime extends EventEmitter {
         case BlockType.REPORTER:
             blockJSON.output = 'String'; // TODO: distinguish number & string here?
             blockJSON.outputShape = ScratchBlocksConstants.OUTPUT_SHAPE_ROUND;
+            if (!blockInfo.disableMonitor) {
+                blockJSON.checkboxInFlyout = true;
+            }
             break;
         case BlockType.BOOLEAN:
             blockJSON.output = 'Boolean';
diff --git a/src/extension-support/extension-metadata.js b/src/extension-support/extension-metadata.js
index 54a87898f..7fafd881f 100644
--- a/src/extension-support/extension-metadata.js
+++ b/src/extension-support/extension-metadata.js
@@ -19,6 +19,7 @@
  * @property {string} text - the text on the block, with [PLACEHOLDERS] for arguments.
  * @property {Boolean} [hideFromPalette] - true if this block should not appear in the block palette.
  * @property {Boolean} [isTerminal] - true if the block ends a stack - no blocks can be connected after it.
+ * @property {Boolean} [disableMonitor] - true if this block is a reporter but should not allow a monitor.
  * @property {ReporterScope} [reporterScope] - if this block is a reporter, this is the scope/context for its value.
  * @property {Boolean} [isEdgeActivated] - sets whether a hat block is edge-activated.
  * @property {Boolean} [shouldRestartExistingThreads] - sets whether a hat/event block should restart existing threads.