diff --git a/static/js/filters/displaynameforsession.js b/static/js/filters/displaynameforsession.js new file mode 100644 index 00000000..31f3a5df --- /dev/null +++ b/static/js/filters/displaynameforsession.js @@ -0,0 +1,35 @@ +/* + * Spreed WebRTC. + * Copyright (C) 2013-2014 struktur AG + * + * This file is part of Spreed WebRTC. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +define(["jquery"], function($) { + + // displayNameForSession + return ["$filter", function($filter) { + + return function(displayName, id) { + if ($.trim(displayName) !== "") { + return displayName; + } + return $filter("displayName")(id) + }; + + }]; + +}); diff --git a/static/js/filters/filters.js b/static/js/filters/filters.js index 5af39a67..b5f7a29e 100644 --- a/static/js/filters/filters.js +++ b/static/js/filters/filters.js @@ -24,13 +24,15 @@ define([ 'filters/displayname', 'filters/buddyimagesrc', 'filters/displayconference', - 'filters/displayuserid'], function(_, displayName, buddyImageSrc, displayConference, displayUserid) { + 'filters/displayuserid', + 'filters/displaynameforsession'], function(_, displayName, buddyImageSrc, displayConference, displayUserid, displayNameForSession) { var filters = { displayName: displayName, buddyImageSrc: buddyImageSrc, displayConference: displayConference, - displayUserid: displayUserid + displayUserid: displayUserid, + displayNameForSession: displayNameForSession }; var initialize = function(angModule) { diff --git a/static/partials/buddyactions.html b/static/partials/buddyactions.html index 62caa00d..b3898e2b 100644 --- a/static/partials/buddyactions.html +++ b/static/partials/buddyactions.html @@ -10,7 +10,7 @@
  • -
    {{s.Status.displayName}}, {{s.Status.message}}
    +
    {{s.Status.displayName|displayNameForSession:s.Id}}, {{s.Status.message}}