Forum Message UI Improvement (Thesis Board #3470) #61
@ -23,7 +23,5 @@ public interface ProjectForumService {
|
||||
// TODO: Get these away from here
|
||||
List<Pair<ProjectThread, ForumPost>> latestPost(Project a, int amount);
|
||||
|
||||
boolean hasUnreadThreads(Project project, User user);
|
||||
|
||||
long getUnreadThreadsCount(Project project, User user);
|
||||
}
|
||||
|
@ -3,7 +3,10 @@ package se.su.dsv.scipro.forum;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import jakarta.inject.Inject;
|
||||
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.ProjectFileService;
|
||||
import se.su.dsv.scipro.forum.dataobjects.ForumPost;
|
||||
@ -113,17 +116,6 @@ public class ProjectForumServiceImpl implements ProjectForumService {
|
||||
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
|
||||
public long getUnreadThreadsCount(Project project, User user) {
|
||||
List<ProjectThread> threads = getThreads(project);
|
||||
|
@ -105,9 +105,9 @@ public class ProjectForumServiceImplTest extends ForumModuleTest {
|
||||
final ProjectThread thread = service.createThread(project, supervisor, "subject", "content", 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(
|
||||
|
@ -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.pages.threaded.SupervisorThreadedForumPage;
|
||||
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.ProjectService;
|
||||
import se.su.dsv.scipro.project.ProjectStatus;
|
||||
|
Loading…
x
Reference in New Issue
Block a user