This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 6b65c95f authored by Eduard Frankford's avatar Eduard Frankford
Browse files

refactor code

parent d2e2fb78
2 merge requests!211Merge new meta data indexing,!210414 resource link wrong
......@@ -2,6 +2,7 @@ import { HttpResponse } from '@angular/common/http';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { Router } from '@angular/router';
import { faFolder } from '@fortawesome/free-solid-svg-icons';
import { ReviewManagementService } from 'app/admin/review-management/review-management.service';
import { ApplicationInfoService } from 'app/core/application/applicationInfo.service';
import { Account } from 'app/core/auth/account.model';
import { AccountService } from 'app/core/auth/account.service';
......@@ -98,6 +99,7 @@ export class ExerciseBodyComponent implements OnInit, OnDestroy {
oerExerciseMatch = /([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/;
constructor(
private reviewManagementService: ReviewManagementService,
private accountService: AccountService,
protected pluginService: PluginService,
private searchService: SearchService,
......@@ -171,13 +173,7 @@ export class ExerciseBodyComponent implements OnInit, OnDestroy {
}
getGitLabUrl(): string {
const lastSlashPos = this.exercise?.file.path.lastIndexOf('/');
if (!lastSlashPos || lastSlashPos <= 0) {
return this.exercise!.project.url;
}
const prefix = this.exercise!.file.path.substring(0, lastSlashPos);
const branch = 'main';
return `${this.exercise!.project.url}/-/tree/${branch}/${prefix}`;
return this.reviewManagementService.getGitLabUrl(this.exercise!);
}
openLink(link: string): void {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment