mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Add transactions to methods in ForumManager
This commit is contained in:
@@ -74,6 +74,11 @@ public interface ForumManager {
|
||||
*/
|
||||
Collection<Forum> getForums() throws DbException;
|
||||
|
||||
/**
|
||||
* Returns all forums to which the user subscribes.
|
||||
*/
|
||||
Collection<Forum> getForums(Transaction txn) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the text of the forum post with the given ID.
|
||||
*/
|
||||
@@ -92,8 +97,14 @@ public interface ForumManager {
|
||||
/**
|
||||
* Returns the group count for the given forum.
|
||||
*/
|
||||
@Deprecated
|
||||
GroupCount getGroupCount(GroupId g) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the group count for the given forum.
|
||||
*/
|
||||
GroupCount getGroupCount(Transaction txn, GroupId g) throws DbException;
|
||||
|
||||
/**
|
||||
* Marks a message as read or unread and updates the group count.
|
||||
*/
|
||||
|
||||
@@ -165,8 +165,12 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
|
||||
@Override
|
||||
public Collection<Forum> getForums() throws DbException {
|
||||
Collection<Group> groups = db.transactionWithResult(true, txn ->
|
||||
db.getGroups(txn, CLIENT_ID, MAJOR_VERSION));
|
||||
return db.transactionWithResult(true, this::getForums);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Forum> getForums(Transaction txn) throws DbException {
|
||||
Collection<Group> groups = db.getGroups(txn, CLIENT_ID, MAJOR_VERSION);
|
||||
try {
|
||||
List<Forum> forums = new ArrayList<>();
|
||||
for (Group g : groups) forums.add(parseForum(g));
|
||||
@@ -235,6 +239,12 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
return messageTracker.getGroupCount(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupCount getGroupCount(Transaction txn, GroupId g)
|
||||
throws DbException {
|
||||
return messageTracker.getGroupCount(txn, g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadFlag(GroupId g, MessageId m, boolean read)
|
||||
throws DbException {
|
||||
|
||||
Reference in New Issue
Block a user