OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
display user name as link for non admins
ulferts633a82dff871
diff --git a/frontend/src/app/components/wp-activity/user/user-activity.component.html b/frontend/src/app/components/wp-activity/user/user-activity.component.htmlindex b4d78915e13..d176803966c 100644--- a/frontend/src/app/components/wp-activity/user/user-activity.component.html+++ b/frontend/src/app/components/wp-activity/user/user-activity.component.html@@ -8,13 +8,13 @@data-class-list="avatar"></user-avatar>- <span class="user" *ngIf="userActive">+ <span class="user" *ngIf="userPath"><a [attr.href]="userPath"[attr.aria-label]="userLabel"[textContent]="userName"></a></span>- <span class="user" *ngIf="!userActive">{{ userName }}</span>+ <span class="user" *ngIf="!userPath">{{ userName }}</span><span class="date">{{ isInitial ? text.label_created_on : text.label_updated_on }}<op-date-time [dateTimeValue]="activity.createdAt"></op-date-time>diff --git a/frontend/src/app/components/wp-activity/user/user-activity.component.ts b/frontend/src/app/components/wp-activity/user/user-activity.component.tsindex bf90260eda3..1d4fc7bd431 100644--- a/frontend/src/app/components/wp-activity/user/user-activity.component.ts+++ b/frontend/src/app/components/wp-activity/user/user-activity.component.ts@@ -66,7 +66,6 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implempublic userId:string | number;public userName:string;- public userActive:boolean;public userPath:string | null;public userLabel:string;public userAvatar:string;@@ -128,9 +127,10 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implem.then((user:UserResource) => {this.userId = user.id!;this.userName = user.name;- this.userActive = user.isActive;this.userAvatar = user.avatar;- this.userPath = user.showUser.href;+ if (user.showUser) {+ this.userPath = user.showUser.href;+ }this.userLabel = this.I18n.t('js.label_author', {user: this.userName});this.cdRef.detectChanges();});diff --git a/lib/api/v3/users/user_representer.rb b/lib/api/v3/users/user_representer.rbindex cd31e40d86d..0bcaf665b7c 100644--- a/lib/api/v3/users/user_representer.rb+++ b/lib/api/v3/users/user_representer.rb@@ -48,6 +48,8 @@ module APIself_linklink :showUser do+ next if represented.locked?+{href: api_v3_paths.show_user(represented.id),type: 'text/html'diff --git a/spec/lib/api/v3/users/user_representer_spec.rb b/spec/lib/api/v3/users/user_representer_spec.rbindex 5b1e0787a88..9b617a1672f 100644--- a/spec/lib/api/v3/users/user_representer_spec.rb+++ b/spec/lib/api/v3/users/user_representer_spec.rb@@ -29,7 +29,8 @@require 'spec_helper'describe ::API::V3::Users::UserRepresenter do- let(:user) { FactoryBot.build_stubbed(:user, status: 1) }+ let(:status) { Principal::STATUSES[:active] }+ let(:user) { FactoryBot.build_stubbed(:user, status: status) }let(:current_user) { FactoryBot.build_stubbed(:user) }let(:representer) { described_class.new(user, current_user: current_user) }@@ -150,9 +151,19 @@ describe ::API::V3::Users::UserRepresenter doexpect(subject).to have_json_path('_links/self/href')end- it_behaves_like 'has an untitled link' do- let(:link) { 'showUser' }- let(:href) { "/users/#{user.id}" }+ context 'showUser' do+ it_behaves_like 'has an untitled link' do+ let(:link) { 'showUser' }+ let(:href) { "/users/#{user.id}" }+ end++ context 'with a locked user' do+ let(:status) { Principal::STATUSES[:locked] }++ it_behaves_like 'has no link' do+ let(:link) { 'showUser' }+ end+ endendcontext 'when regular current_user' do