mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
Display flag and note counts
This commit is contained in:
parent
ba5f12bb14
commit
c16130d991
@ -62,14 +62,14 @@
|
||||
{{ $t('project.actions.adminActions') }}
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list-item :to="'/' + slug + '/flags'">
|
||||
<v-list-item :to="slug + '/flags'">
|
||||
<v-list-item-title>
|
||||
{{ $t('project.actions.flagHistory', []) }}
|
||||
{{ $t('project.actions.flagHistory', [project.info.flagCount]) }}
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item :to="'/' + slug + '/notes'">
|
||||
<v-list-item :to="slug + '/notes'">
|
||||
<v-list-item-title>
|
||||
{{ $t('project.actions.staffNotes', []) }}
|
||||
{{ $t('project.actions.staffNotes', [project.info.noteCount]) }}
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item :to="'/admin/log/?projectFilter=' + slug">
|
||||
|
1
frontend/types/internal/projects.d.ts
vendored
1
frontend/types/internal/projects.d.ts
vendored
@ -11,6 +11,7 @@ declare module 'hangar-internal' {
|
||||
|
||||
interface HangarProjectInfo {
|
||||
publicVersions: number;
|
||||
flagCount: number;
|
||||
noteCount: number;
|
||||
starCount: number;
|
||||
watcherCount: number;
|
||||
|
@ -71,6 +71,7 @@ public interface HangarProjectsDAO {
|
||||
|
||||
@RegisterConstructorMapper(HangarProjectInfo.class)
|
||||
@SqlQuery("SELECT count(pv.*) public_versions," +
|
||||
" count(pf.*) flag_count," +
|
||||
" count(ps.*) star_count," +
|
||||
" count(pw.*) watcher_count," +
|
||||
" coalesce(jsonb_array_length(p.notes->'messages'), 0) note_count" +
|
||||
@ -78,6 +79,7 @@ public interface HangarProjectsDAO {
|
||||
" LEFT JOIN project_versions pv ON p.id = pv.project_id AND pv.visibility = 0" +
|
||||
" LEFT JOIN project_stars ps ON p.id = ps.project_id" +
|
||||
" LEFT JOIN project_watchers pw ON p.id = pw.project_id" +
|
||||
" LEFT JOIN project_flags pf ON p.id = pf.project_id" +
|
||||
" WHERE p.id = :projectId" +
|
||||
" GROUP BY p.id")
|
||||
HangarProjectInfo getHangarProjectInfo(long projectId);
|
||||
|
@ -20,7 +20,7 @@ public class HangarProject extends Project implements Joinable<ProjectRoleTable>
|
||||
private final String lastVisibilityChangeUserName;
|
||||
private final HangarProjectInfo info;
|
||||
private final Collection<HangarProjectPage> pages;
|
||||
|
||||
|
||||
public HangarProject(Project project, long id, ProjectOwner owner, List<JoinableMember<ProjectRoleTable>> members, String lastVisibilityChangeComment, String lastVisibilityChangeUserName, HangarProjectInfo info, Collection<HangarProjectPage> pages) {
|
||||
super(project.getCreatedAt(), project.getName(), project.getNamespace(), project.getPromotedVersions(), project.getStats(), project.getCategory(), project.getDescription(), project.getLastUpdated(), project.getVisibility(), project.getUserActions(), project.getSettings());
|
||||
this.id = id;
|
||||
@ -82,12 +82,14 @@ public class HangarProject extends Project implements Joinable<ProjectRoleTable>
|
||||
public static class HangarProjectInfo {
|
||||
|
||||
private final int publicVersions;
|
||||
private final int flagCount;
|
||||
private final int noteCount;
|
||||
private final long starCount;
|
||||
private final long watcherCount;
|
||||
|
||||
public HangarProjectInfo(int publicVersions, int noteCount, long starCount, long watcherCount) {
|
||||
public HangarProjectInfo(int publicVersions, int flagCount, int noteCount, long starCount, long watcherCount) {
|
||||
this.publicVersions = publicVersions;
|
||||
this.flagCount = flagCount;
|
||||
this.noteCount = noteCount;
|
||||
this.starCount = starCount;
|
||||
this.watcherCount = watcherCount;
|
||||
@ -97,6 +99,11 @@ public class HangarProject extends Project implements Joinable<ProjectRoleTable>
|
||||
return publicVersions;
|
||||
}
|
||||
|
||||
@RequiresPermission(NamedPermission.MOD_NOTES_AND_FLAGS)
|
||||
public int getFlagCount() {
|
||||
return flagCount;
|
||||
}
|
||||
|
||||
@RequiresPermission(NamedPermission.MOD_NOTES_AND_FLAGS)
|
||||
public int getNoteCount() {
|
||||
return noteCount;
|
||||
|
Loading…
Reference in New Issue
Block a user