Skip to content

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

Undo the change of making the ID a number as it broke too much and need to be handled separatly

Henriette Darge0eacbcd12ee1
diff --git a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
index d9d2644c136..2ca003ba1cd 100644
--- a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
+++ b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
@@ -163,7 +163,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
}
async initialize(workPackage:WorkPackageResource) {
- this.projectId = String(idFromLink(workPackage.project.href));
+ this.projectId = idFromLink(workPackage.project.href);
this.viewAllowed = await this.bcfAuthorization.isAllowedTo(this.projectId, 'project_actions', 'viewTopic');
this.createAllowed = await this.bcfAuthorization.isAllowedTo(this.projectId, 'topic_actions', 'createViewpoint');
diff --git a/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts b/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
index 0c73d7e9f49..7f0d18d2768 100644
--- a/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
+++ b/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
@@ -167,7 +167,7 @@ export class IFCViewerService extends ViewerBridgeService {
// and redirect to a route with a place to show viewer
// ('bim.partitioned.split')
window.location.href = this.pathHelper.bimDetailsPath(
- String(idFromLink(workPackage.project.href)),
+ idFromLink(workPackage.project.href),
workPackage.id!,
index,
);
diff --git a/frontend/src/app/features/hal/helpers/id-from-link.ts b/frontend/src/app/features/hal/helpers/id-from-link.ts
index ce0c6b07664..a96a5f62305 100644
--- a/frontend/src/app/features/hal/helpers/id-from-link.ts
+++ b/frontend/src/app/features/hal/helpers/id-from-link.ts
@@ -1,4 +1,4 @@
-export default function idFromLink(href:string|null):number {
+export default function idFromLink(href:string|null):string {
const idPart = (href || '').split('/').pop()!;
- return parseInt(decodeURIComponent(idPart), 10);
+ return decodeURIComponent(idPart);
}
diff --git a/frontend/src/app/features/hal/resources/hal-resource.ts b/frontend/src/app/features/hal/resources/hal-resource.ts
index 467264f49b5..dab70598306 100644
--- a/frontend/src/app/features/hal/resources/hal-resource.ts
+++ b/frontend/src/app/features/hal/resources/hal-resource.ts
@@ -146,7 +146,7 @@ export class HalResource {
return this.$source.id.toString();
}
- const id = String(idFromLink(this.href));
+ const id = idFromLink(this.href);
if (/^\d+$/.exec(id)) {
return id;
}
diff --git a/frontend/src/app/features/hal/resources/relation-resource.ts b/frontend/src/app/features/hal/resources/relation-resource.ts
index 922a5a48739..5e08ddcb4fb 100644
--- a/frontend/src/app/features/hal/resources/relation-resource.ts
+++ b/frontend/src/app/features/hal/resources/relation-resource.ts
@@ -118,8 +118,8 @@ export class RelationResource extends HalResource {
*/
public get ids() {
return {
- from: String(idFromLink(this.from.href!)),
- to: String(idFromLink(this.to.href!)),
+ from: idFromLink(this.from.href!),
+ to: idFromLink(this.to.href!),
};
}
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
index 025551f71b3..220104fc7d3 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
@@ -62,7 +62,7 @@ export class IanMenuComponent implements OnInit {
.map((item) => ({
...item,
title: (item.projectHasParent ? '...' : '') + item.value,
- href: this.getHrefForFilters({ filter: 'project', name: String(idFromLink(item._links.valueLink[0].href)) }),
+ href: this.getHrefForFilters({ filter: 'project', name: idFromLink(item._links.valueLink[0].href) }),
}))
.sort((a, b) => {
if (b.projectHasParent && !a.projectHasParent) {
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts
index e7986f69860..5d745130f1a 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts
+++ b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts
@@ -55,7 +55,7 @@ export class IanMenuService {
};
if (data.groups) {
- projectsFilter.filters = [['id', '=', data.groups.map((group) => String(idFromLink(group._links.valueLink[0].href)))]];
+ projectsFilter.filters = [['id', '=', data.groups.map((group) => idFromLink(group._links.valueLink[0].href))]];
}
this.store.update({
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
index 2e6fd282ab0..3b63efb7011 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
@@ -213,7 +213,7 @@ export class InAppNotificationEntryComponent implements OnInit {
if (project) {
this.project = {
...project,
- showUrl: this.pathHelper.projectPath(String(idFromLink(project.href))),
+ showUrl: this.pathHelper.projectPath(idFromLink(project.href)),
};
}
}
diff --git a/frontend/src/app/features/invite-user-modal/project-selection/project-allowed.validator.ts b/frontend/src/app/features/invite-user-modal/project-selection/project-allowed.validator.ts
index 314bf1017a6..18656220324 100644
--- a/frontend/src/app/features/invite-user-modal/project-selection/project-allowed.validator.ts
+++ b/frontend/src/app/features/invite-user-modal/project-selection/project-allowed.validator.ts
@@ -8,7 +8,7 @@ export const ProjectAllowedValidator = (currentUserService:CurrentUserService) =
(control:AbstractControl) =>
currentUserService.hasCapabilities$(
'memberships/create',
- String(idFromLink(control.value.href)),
+ idFromLink(control.value.href),
).pipe(
take(1),
map((isAllowed) => (isAllowed ? null : { lackingPermission: true })),
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
index a1840222071..ac49f15951d 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
@@ -48,7 +48,7 @@ export class NotificationSettingsTableComponent {
) {}
projectLink(href:string) {
- return this.pathHelper.projectPath(String(idFromLink(href)));
+ return this.pathHelper.projectPath(idFromLink(href));
}
addProjectSettings(project:HalSourceLink):void {
diff --git a/frontend/src/app/features/work-packages/components/wp-activity/activity-entry.component.ts b/frontend/src/app/features/work-packages/components/wp-activity/activity-entry.component.ts
index ce00fb8dbc0..9955f7fea22 100644
--- a/frontend/src/app/features/work-packages/components/wp-activity/activity-entry.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-activity/activity-entry.component.ts
@@ -56,7 +56,7 @@ export class ActivityEntryComponent implements OnInit {
}
ngOnInit() {
- this.projectId = String(idFromLink(this.workPackage.project.href));
+ this.projectId = idFromLink(this.workPackage.project.href);
this.activityType = this.activity._type;
}
diff --git a/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts b/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
index 4f3cd7f29a2..c5fd08f59ce 100644
--- a/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
@@ -212,7 +212,7 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
const hasChanges = !change.isEmpty();
const typeEmpty = !changeType && !type;
- const typeMatches = type && changeType && idFromLink(changeType.href) === type;
+ const typeMatches = type && changeType && idFromLink(changeType.href) === type.toString();
if (hasChanges && (typeEmpty || typeMatches)) {
return Promise.resolve(change);
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts
index cdd21518abe..67bea7aa897 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts
@@ -190,7 +190,7 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemen
this.projectContext = { matches: false, href: null };
} else {
this.projectContext = {
- href: this.PathHelper.projectWorkPackagePath(String(idFromLink(resource.project.href)), this.workPackage.id!),
+ href: this.PathHelper.projectWorkPackagePath(idFromLink(resource.project.href), this.workPackage.id!),
matches: resource.project.href === this.currentProject.apiv3Path,
};
}
@@ -261,7 +261,7 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemen
}
public get projectContextText():string {
- const id = String(idFromLink(this.workPackage.project.href));
+ const id = idFromLink(this.workPackage.project.href);
const projectPath = this.PathHelper.projectPath(id);
const project = `<a href="${projectPath}">${this.workPackage.project.name}<a>`;
return this.I18n.t('js.project.work_package_belongs_to', { projectname: project });
diff --git a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/select-input/select-input.component.ts b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/select-input/select-input.component.ts
index 97fd73016a5..1c8afa4ba83 100644
--- a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/select-input/select-input.component.ts
+++ b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/select-input/select-input.component.ts
@@ -12,7 +12,7 @@ export class SelectInputComponent extends FieldType implements OnInit {
public ngOnInit():void {
if (this.model?.project) {
- this.projectId = String(idFromLink(this.model.project?.href));
+ this.projectId = idFromLink(this.model.project?.href);
}
}
}
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/te-work-package-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/te-work-package-edit-field.component.ts
index 3c3922e8213..a2b4fa06b31 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/te-work-package-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/te-work-package-edit-field.component.ts
@@ -93,7 +93,7 @@ export class TimeEntryWorkPackageEditFieldComponent extends WorkPackageEditField
.then((collection) => {
this.recentWorkPackageIds = collection
.elements
- .map((timeEntry) => String(idFromLink(timeEntry.workPackage.href)))
+ .map((timeEntry) => idFromLink(timeEntry.workPackage.href))
.filter((v, i, a) => a.indexOf(v) === i);
return this.fetchAllowedValueQuery(query);
diff --git a/frontend/src/app/shared/components/grids/widgets/news/news.component.ts b/frontend/src/app/shared/components/grids/widgets/news/news.component.ts
index c642e4fa2cf..c7870ae1da1 100644
--- a/frontend/src/app/shared/components/grids/widgets/news/news.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/news/news.component.ts
@@ -63,7 +63,7 @@ export class WidgetNewsComponent extends AbstractWidgetComponent implements OnIn
}
public newsProjectPath(news:NewsResource) {
- return this.pathHelper.projectPath(String(idFromLink(news.project?.href)));
+ return this.pathHelper.projectPath(idFromLink(news.project?.href));
}
public newsProjectName(news:NewsResource) {