diff --git a/src/views/app.js b/src/views/app.js index dcdb7b810..54b623beb 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -154,13 +154,17 @@ angular.module('Application').controller('AppController', ['$scope', '$location' }, 1000); } - // TODO break those apart - Client.configureApp($scope.app.id, 'label', { label: $scope.display.label }, function (error) { + var NOOP = function (next) { return next(); }; + var configureLabel = $scope.display.label === $scope.app.label ? NOOP : Client.configureApp.bind(null, $scope.app.id, 'label', { label: $scope.display.label }); + + configureLabel(function (error) { if (error) return Client.error(error); var tags = $scope.display.tags.split(',').map(function (t) { return t.trim(); }).filter(function (t) { return !!t; }); - Client.configureApp($scope.app.id, 'tags', { tags: tags }, function (error) { + var configureTags = angular.equals(tags, $scope.app.tags) ? NOOP : Client.configureApp.bind(null, $scope.app.id, 'tags', { tags: tags }); + + configureTags(function (error) { if (error) return Client.error(error); // skip if icon is unchanged