Forum Message UI Improvement (Thesis Board #3470) #61

Merged
tozh4728 merged 20 commits from 3470-forum-msg-ui-improvement into develop 2024-12-19 15:28:23 +01:00
4 changed files with 6 additions and 17 deletions
Showing only changes of commit d5bc04e90c - Show all commits

View File

@ -23,7 +23,5 @@ public interface ProjectForumService {
// TODO: Get these away from here // TODO: Get these away from here
List<Pair<ProjectThread, ForumPost>> latestPost(Project a, int amount); List<Pair<ProjectThread, ForumPost>> latestPost(Project a, int amount);
boolean hasUnreadThreads(Project project, User user);
long getUnreadThreadsCount(Project project, User user); long getUnreadThreadsCount(Project project, User user);
} }

View File

@ -3,7 +3,10 @@ package se.su.dsv.scipro.forum;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import java.util.*;
import java.util.List;
import java.util.Set;
import se.su.dsv.scipro.file.FileSource; import se.su.dsv.scipro.file.FileSource;
import se.su.dsv.scipro.file.ProjectFileService; import se.su.dsv.scipro.file.ProjectFileService;
import se.su.dsv.scipro.forum.dataobjects.ForumPost; import se.su.dsv.scipro.forum.dataobjects.ForumPost;
@ -113,17 +116,6 @@ public class ProjectForumServiceImpl implements ProjectForumService {
return postRepository.latestPost(project, amount); return postRepository.latestPost(project, amount);
} }
@Override
public boolean hasUnreadThreads(Project project, User user) {
List<ProjectThread> threads = getThreads(project);
for (ProjectThread thread : threads) {
if (!basicForumService.isThreadRead(user, thread.getForumThread())) {
return true;
}
}
return false;
}
@Override @Override
public long getUnreadThreadsCount(Project project, User user) { public long getUnreadThreadsCount(Project project, User user) {
List<ProjectThread> threads = getThreads(project); List<ProjectThread> threads = getThreads(project);

View File

@ -105,9 +105,9 @@ public class ProjectForumServiceImplTest extends ForumModuleTest {
final ProjectThread thread = service.createThread(project, supervisor, "subject", "content", Set.of()); final ProjectThread thread = service.createThread(project, supervisor, "subject", "content", Set.of());
service.createReply(thread, author, "reply", Set.of()); service.createReply(thread, author, "reply", Set.of());
boolean hasUnreadThreads = service.hasUnreadThreads(project, supervisor); long count = service.getUnreadThreadsCount(project, supervisor);
assertTrue(hasUnreadThreads); assertEquals(1, count);
} }
private void assertNewForumThread( private void assertNewForumThread(

View File

@ -39,7 +39,6 @@ import se.su.dsv.scipro.datatables.project.ProjectTitleColumn;
import se.su.dsv.scipro.forum.ProjectForumService; import se.su.dsv.scipro.forum.ProjectForumService;
import se.su.dsv.scipro.forum.pages.threaded.SupervisorThreadedForumPage; import se.su.dsv.scipro.forum.pages.threaded.SupervisorThreadedForumPage;
import se.su.dsv.scipro.forum.panels.AbstractReadStatePanel; import se.su.dsv.scipro.forum.panels.AbstractReadStatePanel;
import se.su.dsv.scipro.forum.panels.NumberOfMessagesPanel;
import se.su.dsv.scipro.project.Project; import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.project.ProjectService; import se.su.dsv.scipro.project.ProjectService;
import se.su.dsv.scipro.project.ProjectStatus; import se.su.dsv.scipro.project.ProjectStatus;