summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-10-30 16:21:27 +0000
committerKegan Dougal <kegan@matrix.org>2014-10-30 16:21:27 +0000
commit9de9661baaa232da170e45534a7d335bf96ef606 (patch)
tree82a709a3a048855a35f8a4e003cef9cfee074f1a /webclient/room/room-controller.js
parentSYWEB-12: More formatting. (diff)
downloadsynapse-9de9661baaa232da170e45534a7d335bf96ef606.tar.xz
SYWEB-12: More formatting and tweaking of state event JSON.
Use a proper elastic directive to make the <textarea> resize dynamically.
Use an 'asjson' directive to turn an ngModel of a JSON object into a
formatted JSON string so it can be displayed on the textarea. Also, deep
copy the state events being displayed, else it actually alters the underlying
data structures when playing around with the JSON in the textarea!
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index fcbcd75364..ce513990f2 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -1018,6 +1018,13 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
     };
 
     $scope.openRoomInfo = function() {
+        var stateFilter = $filter("stateEventsFilter");
+        var stateEvents = stateFilter($scope.events.rooms[$scope.room_id]);
+        // The modal dialog will 2-way bind this field, so we MUST make a deep
+        // copy of the state events else we will be *actually adjusing our view
+        // of the world* when fiddling with the JSON!! Apparently parse/stringify
+        // is faster than jQuery's extend when doing deep copies.
+        $scope.roomInfoStateEvents = JSON.parse(JSON.stringify(stateEvents));
         var modalInstance = $modal.open({
             templateUrl: 'roomInfoTemplate.html',
             controller: 'RoomInfoController',
@@ -1040,7 +1047,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
     console.log("Displaying room info.");
 
     $scope.submit = function(event) {
-        console.error("submit >>> " + JSON.stringify(event));
+        if (event.content) {
+            console.error("submit >>> " + JSON.stringify(event));
+        }
     };
 
     $scope.dismiss = $modalInstance.dismiss;