only display links to users' comments if they are active.

pull/1720/head
Richard 10 years ago
parent 2cdfdf1a4c
commit 3f81dc9b07
  1. 5
      app/assets/javascripts/angular/work_packages/tabs/user-activity-directive.js
  2. 1
      lib/api/v3/users/user_representer.rb
  3. 3
      public/templates/work_packages/tabs/_user_activity.html
  4. 1
      spec/lib/api/v3/users/user_representer_spec.rb

@ -28,7 +28,9 @@
angular.module('openproject.workPackages.tabs')
.directive('userActivity', ['$uiViewScroll', 'I18n', 'PathHelper', 'ActivityService', function($uiViewScroll, I18n, PathHelper, ActivityService) {
.constant('ACTIVE_USER_STATUSES', [1, 2])
.directive('userActivity', ['$uiViewScroll', 'I18n', 'PathHelper', 'ActivityService', 'ACTIVE_USER_STATUSES', function($uiViewScroll, I18n, PathHelper, ActivityService, ACTIVE_USER_STATUSES) {
return {
restrict: 'E',
replace: true,
@ -59,6 +61,7 @@ angular.module('openproject.workPackages.tabs')
scope.userId = user.props.id;
scope.userName = user.props.name;
scope.userAvatar = user.props.avatar;
scope.userActive = ACTIVE_USER_STATUSES.indexOf(user.props.status) >= 0;
});
scope.editComment = function() {

@ -71,6 +71,7 @@ module API
property :avatar, getter: ->(*) { gravatar_image_url(mail) }, render_nil: true
property :created_at, getter: -> (*) { model.created_on.utc.iso8601 }, render_nil: true
property :updated_at, getter: -> (*) { model.updated_on.utc.iso8601 }, render_nil: true
property :status, getter: -> (*) { model.status }, render_nil: true
def _type
'User'

@ -13,7 +13,8 @@
</div>
</div>
<img class="avatar" ng-src="{{ userAvatar }}" />
<span class="user"><a ng-href="{{ userPath(userId) }}" name="{{ currentAnchor }}" ng-bind="userName"></a></span>
<span class="user" ng-if="userActive"><a ng-href="{{ userPath(userId) }}" name="{{ currentAnchor }}" ng-bind="userName"></a></span>
<span class="user" ng-if="!userActive">{{ userName }}</span>
<span class="date">{{ I18n.t('js.label_commented_on') }} <date-time date-time-value="activity.props.createdAt"/></date-time>
<span class="comment wiki">
<div ng-if="inEdit">

@ -48,6 +48,7 @@ describe ::API::V3::Users::UserRepresenter do
it { should have_json_path('avatar') }
it { should have_json_path('createdAt') }
it { should have_json_path('updatedAt') }
it { should have_json_path('status') }
end
describe '_links' do

Loading…
Cancel
Save