Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/src/main/java/io/meeds/task/mcp/TaskMcpTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,8 @@ private ProjectModel toProjectModel(ProjectDto project) {
Space space = getProjectSpace(project);
return new ProjectModel(project.getId(),
project.getName(),
getUrl(project),
transformHtmlContent(project.getDescription(), aclIdentity, locale),
getUrl(project),
getProjectStatuses(project.getId()),
getProjectLabels(project.getId()),
space == null ? null : space.getSpaceId(),
Expand Down
25 changes: 25 additions & 0 deletions services/src/test/java/io/meeds/task/mcp/TaskMcpToolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,31 @@ public void listProjectsShouldUseProjectCountAndReturnCollection() throws Except
verify(projectService).countProjects(any(), eq(null));
}

/**
* A project carries its description in the description and its permanent
* link in the url, not the one in the other's place.
* Mutant: the description and the link are passed in each other's position.
*/
@Test
public void getProjectByIdShouldKeepTheDescriptionAndTheUrlEachInItsOwnField() throws Exception { // NOSONAR
ProjectDto project = mock(ProjectDto.class);

when(projectService.getProject(PROJECT_ID)).thenReturn(project);
when(project.canView(currentIdentity)).thenReturn(true);
when(project.getId()).thenReturn(PROJECT_ID);
when(project.getName()).thenReturn(PROJECT_NAME);
when(project.getDescription()).thenReturn("Reworks the Shortcuts portlet");
when(project.getManager()).thenReturn(Collections.emptySet());
when(statusService.getStatuses(PROJECT_ID)).thenReturn(Collections.emptyList());
when(labelService.findLabelsByProject(PROJECT_ID, currentIdentity, 0, 100)).thenReturn(Collections.emptyList());
when(permanentLinkService.getLink(any())).thenReturn("/project-link");

ProjectModel model = runWithDateFormatMockResult(() -> tool.getProjectById(PROJECT_ID));

assertTrue(model.getDescription(), model.getDescription().contains("Reworks the Shortcuts portlet"));
assertTrue(model.getUrl(), model.getUrl().endsWith("/project-link"));
}

/**
* In a run limited to a space, the query gets the user's roles of that space
* group and nothing of the user's other memberships, and only the projects
Expand Down
Loading