mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-12-21 06:51:19 +08:00
fix(backend): display proper project main page
This commit is contained in:
parent
82f3040283
commit
a9d145cd1c
@ -31,6 +31,14 @@ public interface HangarProjectPagesDAO {
|
||||
" WHERE pp.id = :id")
|
||||
ExtendedProjectPage getProjectPage(long id);
|
||||
|
||||
@SqlQuery("""
|
||||
SELECT pp.*, true as home
|
||||
FROM project_pages pp
|
||||
JOIN project_home_pages php ON pp.id = php.page_id
|
||||
WHERE php.project_id = :projectId
|
||||
""")
|
||||
ExtendedProjectPage getProjectHomePage(long projectId);
|
||||
|
||||
@SqlQuery("SELECT pp.*, TRUE AS home " +
|
||||
" FROM project_pages pp" +
|
||||
" JOIN projects p ON pp.project_id = p.id" +
|
||||
|
@ -130,6 +130,10 @@ public class ProjectPageService extends HangarComponent {
|
||||
return this.hangarProjectPagesDAO.getProjectPage(id);
|
||||
}
|
||||
|
||||
public ExtendedProjectPage getProjectHomePage(final long projectId) {
|
||||
return this.hangarProjectPagesDAO.getProjectHomePage(projectId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public String createProjectPage(final long projectId, final NewProjectPage newProjectPage) {
|
||||
String slug = StringUtils.slugify(newProjectPage.getName());
|
||||
|
@ -132,7 +132,7 @@ public class ProjectService extends HangarComponent {
|
||||
}
|
||||
}
|
||||
|
||||
final ExtendedProjectPage projectPage = projectPageService.getProjectPage(project.getRight().getId());
|
||||
final ExtendedProjectPage projectPage = this.projectPageService.getProjectHomePage(project.getRight().getId());
|
||||
final HangarProject hangarProject = new HangarProject(project.getRight(), projectOwner, members, lastVisibilityChangeComment, lastVisibilityChangeUserName, info, pages.values(), pinnedVersions, mainChannelVersions, projectPage);
|
||||
hangarProject.setAvatarUrl(this.avatarService.getProjectAvatarUrl(hangarProject.getProjectId(), hangarProject.getNamespace().getOwner()));
|
||||
return hangarProject;
|
||||
|
Loading…
Reference in New Issue
Block a user