diff --git a/www/plugins/es/js/controllers/user-controllers.js b/www/plugins/es/js/controllers/user-controllers.js index 92cb73f0cfd9af93a1cd72369d6b2bfc319ad410..90206521d6ce37e1ab63064e843caa6ac9dd0029 100644 --- a/www/plugins/es/js/controllers/user-controllers.js +++ b/www/plugins/es/js/controllers/user-controllers.js @@ -186,6 +186,12 @@ function ProfileController($scope, $rootScope, $timeout, $state, $focus, $transl }; var doFinishSave = function(formData) { + // Social url must be unique in socials links - Fix #306: + if (formData.socials && formData.socials.length) { + formData.socials = _.uniq(formData.socials, false, function(social) { + return social.url; + }); + } if (!$scope.existing) { return esUser.profile.add(formData) .then(function() { diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js index 9b096a43428fc7659f8ab9b04e4e2492895bccc6..d4fc8f3027f3ec0cbe4d4c95f938194442be9d23 100644 --- a/www/plugins/es/js/services/user-services.js +++ b/www/plugins/es/js/services/user-services.js @@ -389,6 +389,14 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se data.name = profile.name; data.avatar = profile.avatar; data.profile = profile.source; + + // Social url must be unique in socials links - Workaround for issue #306: + if (data.profile && data.profile.socials && data.profile.socials.length) { + data.profile.socials = _.uniq(data.profile.socials, false, function(social) { + return social.url; + }); + } + } deferred.resolve(data); }),