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-29 15:31:50 +0000
committerKegan Dougal <kegan@matrix.org>2014-10-29 15:31:50 +0000
commit6d4617960d0223c13f8145b31df86e1f1f8d43ec (patch)
tree6b813a1daa4daaa3b31ec12add810487ffef4ac1 /webclient/room/room-controller.js
parentSYWEB-98: Add a 'Redact' button to the event info modal dialog. (diff)
downloadsynapse-6d4617960d0223c13f8145b31df86e1f1f8d43ec.tar.xz
SYWEB-98: Add redactEvent matrix API call.
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index c4014b2fe0..841b5cccdd 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -995,6 +995,26 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
             controller: 'EventInfoController',
             scope: $scope
         });
+
+        modalInstance.result.then(function(action) {
+            if (action === "redact") {
+                var eventId = $scope.event_selected.event_id;
+                console.log("Redacting event ID " + eventId);
+                matrixService.redactEvent(
+                    $scope.event_selected.room_id,
+                    eventId
+                ).then(function(response) {
+                    console.log("Redaction = " + JSON.stringify(response));
+                }, function(error) {
+                    console.error("Failed to redact event: "+JSON.stringify(error));
+                    if (error.data.error) {
+                        $scope.feedback = error.data.error;
+                    }
+                });
+            }
+        }, function() {
+            // any dismiss code
+        });
     };
 
 }])
@@ -1004,6 +1024,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
         console.log("User level = "+$scope.pow($scope.room_id, $scope.state.user_id)+
                     " Redact level = "+$scope.events.rooms[$scope.room_id]["m.room.ops_levels"].content.redact_level);
         console.log("Redact event >> " + JSON.stringify($scope.event_selected));
-        $modalInstance.dismiss();
+        $modalInstance.close("redact");
     };
 });