Configure label and tags only if changed
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user