Skip to content

Commit 969d0c1

Browse files
committed
Dont tell admins they are part of every project
1 parent b106631 commit 969d0c1

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

backend/src/services/rating-service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ export class RatingService implements IRatingService {
228228
*/
229229
private async checkPermission(rating: Rating, user: User): Promise<void> {
230230
if (!user.admitted) {
231-
throw new ForbiddenError(
232-
"Only admitted users may rate projects",
233-
);
231+
throw new ForbiddenError("Only admitted users may rate projects");
234232
}
235233

236234
const settings = await this._settings.getSettings();

backend/test/services/rating-service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe("RatingService", () => {
103103
it("throws ForbiddenError if user is not admitted", async () => {
104104
expect.assertions(1);
105105

106-
ratingUser.admitted = false
106+
ratingUser.admitted = false;
107107

108108
const rating = Object.assign(new Rating(), {
109109
project: mockProject,

frontend/src/components/pages/view-project.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ const EditProject = ({ project }) => {
119119
!updateProjectInProgress &&
120120
!updateProjectError;
121121

122+
const isAdmin = user?.role == UserRole.Root;
123+
122124
return (
123125
<Page>
124126
<PageHeader
125127
pageTitle={`Edit Project - ${project?.title}`}
126128
buttonText="Save Changes"
127129
buttonOnClick={sendSaveProjectRequest}
128130
buttonLoading={updateProjectInProgress}
129-
subTitle="You are part of the team of this project"
131+
subTitle={isAdmin ? null : "You are part of the team of this project"}
130132
/>
131133
{updateProjectError && (
132134
<div style={{ marginBottom: "1rem" }}>

0 commit comments

Comments
 (0)