mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
SYWEB-98: Add redactEvent matrix API call.
This commit is contained in:
parent
70137409ed
commit
6d4617960d
@ -438,6 +438,14 @@ angular.module('matrixService', [])
|
|||||||
return this.sendMessage(room_id, msg_id, content);
|
return this.sendMessage(room_id, msg_id, content);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
redactEvent: function(room_id, event_id) {
|
||||||
|
var path = "/rooms/$room_id/redact/$event_id";
|
||||||
|
path = path.replace("$room_id", room_id);
|
||||||
|
path = path.replace("$event_id", event_id);
|
||||||
|
var content = {};
|
||||||
|
return doRequest("POST", path, undefined, content);
|
||||||
|
},
|
||||||
|
|
||||||
// get a snapshot of the members in a room.
|
// get a snapshot of the members in a room.
|
||||||
getMemberList: function(room_id) {
|
getMemberList: function(room_id) {
|
||||||
// Like the cmd client, escape room ids
|
// Like the cmd client, escape room ids
|
||||||
|
@ -995,6 +995,26 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
|||||||
controller: 'EventInfoController',
|
controller: 'EventInfoController',
|
||||||
scope: $scope
|
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)+
|
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);
|
" Redact level = "+$scope.events.rooms[$scope.room_id]["m.room.ops_levels"].content.redact_level);
|
||||||
console.log("Redact event >> " + JSON.stringify($scope.event_selected));
|
console.log("Redact event >> " + JSON.stringify($scope.event_selected));
|
||||||
$modalInstance.dismiss();
|
$modalInstance.close("redact");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button ng-click="redact()" type="button" class="btn btn-danger"
|
<button ng-click="redact()" type="button" class="btn btn-danger"
|
||||||
ng-disabled="pow(room_id, state.user_id) < events.rooms[room_id]['m.room.ops_levels'].content.redact_level"
|
ng-disabled="!events.rooms[room_id]['m.room.ops_levels'].content.redact_level || !pow(room_id, state.user_id) || pow(room_id, state.user_id) < events.rooms[room_id]['m.room.ops_levels'].content.redact_level"
|
||||||
title="Delete this event on all home servers. This cannot be undone.">
|
title="Delete this event on all home servers. This cannot be undone.">
|
||||||
Redact
|
Redact
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user