update notifications UI for new default messages structure

This commit is contained in:
Keith Grant
2019-08-13 09:13:03 -07:00
committed by Jim Ladd
parent 150de6a70b
commit 965dc79a0a
3 changed files with 103 additions and 48 deletions

View File

@@ -41,7 +41,7 @@ export default ['Rest', 'Wait',
Rest.setUrl(GetBasePath('notification_templates'));
Rest.options()
.then(({data}) => {
defaultMessages = data.actions.GET.messages.default;
defaultMessages = data.actions.GET.messages;
});
GetChoices({
@@ -257,8 +257,13 @@ export default ['Rest', 'Wait',
$scope.toggleForm = function(key) {
$scope[key] = !$scope[key];
};
$scope.$watch('notification_type', (value) => {
if (value) {
$scope.$watch('notification_type', (newValue, oldValue = {}) => {
if (newValue) {
MessageUtils.updateDefaultsOnScope(
$scope,
defaultMessages[oldValue.value],
defaultMessages[newValue.value]
);
$scope.$broadcast('reset-code-mirror', {
customize_messages: $scope.customize_messages,
});