mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +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;
|
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.
|
* 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.
|
* Returns the group count for the given forum.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
GroupCount getGroupCount(GroupId g) throws DbException;
|
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.
|
* Marks a message as read or unread and updates the group count.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -165,8 +165,12 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Forum> getForums() throws DbException {
|
public Collection<Forum> getForums() throws DbException {
|
||||||
Collection<Group> groups = db.transactionWithResult(true, txn ->
|
return db.transactionWithResult(true, this::getForums);
|
||||||
db.getGroups(txn, CLIENT_ID, MAJOR_VERSION));
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Forum> getForums(Transaction txn) throws DbException {
|
||||||
|
Collection<Group> groups = db.getGroups(txn, CLIENT_ID, MAJOR_VERSION);
|
||||||
try {
|
try {
|
||||||
List<Forum> forums = new ArrayList<>();
|
List<Forum> forums = new ArrayList<>();
|
||||||
for (Group g : groups) forums.add(parseForum(g));
|
for (Group g : groups) forums.add(parseForum(g));
|
||||||
@@ -235,6 +239,12 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
|||||||
return messageTracker.getGroupCount(g);
|
return messageTracker.getGroupCount(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GroupCount getGroupCount(Transaction txn, GroupId g)
|
||||||
|
throws DbException {
|
||||||
|
return messageTracker.getGroupCount(txn, g);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setReadFlag(GroupId g, MessageId m, boolean read)
|
public void setReadFlag(GroupId g, MessageId m, boolean read)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
|
|||||||
Reference in New Issue
Block a user