add transactional versions to functions related to forums

This commit is contained in:
ialokim
2022-11-23 18:31:49 +01:00
parent c855967d56
commit b9bac8b6a5
4 changed files with 82 additions and 14 deletions

View File

@@ -48,6 +48,11 @@ public interface ForumManager {
*/
void removeForum(Forum f) throws DbException;
/**
* Unsubscribes from a forum.
*/
void removeForum(Transaction txn, Forum f) throws DbException;
/**
* Creates a local forum post.
*/
@@ -127,6 +132,11 @@ public interface ForumManager {
*/
void setReadFlag(GroupId g, MessageId m, boolean read) throws DbException;
/**
* Marks a message as read or unread and updates the group count.
*/
void setReadFlag(Transaction txn, GroupId g, MessageId m, boolean read) throws DbException;
interface RemoveForumHook {
/**
* Called when a forum is being removed.

View File

@@ -24,23 +24,48 @@ public interface SharingManager<S extends Shareable>
void sendInvitation(GroupId shareableId, ContactId contactId,
@Nullable String text) throws DbException;
/**
* Sends an invitation to share the given group with the given contact,
* including optional text.
*/
void sendInvitation(Transaction txn, GroupId shareableId,
ContactId contactId, @Nullable String text) throws DbException;
/**
* Responds to a pending group invitation
*/
void respondToInvitation(S s, Contact c, boolean accept)
throws DbException;
/**
* Responds to a pending group invitation
*/
void respondToInvitation(Transaction txn, S s, Contact c, boolean accept)
throws DbException;
/**
* Responds to a pending group invitation
*/
void respondToInvitation(ContactId c, SessionId id, boolean accept)
throws DbException;
/**
* Responds to a pending group invitation
*/
void respondToInvitation(Transaction txn, ContactId c, SessionId id,
boolean accept) throws DbException;
/**
* Returns all invitations to groups.
*/
Collection<SharingInvitationItem> getInvitations() throws DbException;
/**
* Returns all invitations to groups.
*/
Collection<SharingInvitationItem> getInvitations(Transaction txn)
throws DbException;
/**
* Returns all contacts with whom the given group is shared.
*/
@@ -57,4 +82,10 @@ public interface SharingManager<S extends Shareable>
*/
boolean canBeShared(GroupId g, Contact c) throws DbException;
/**
* Returns true if the group not already shared and no invitation is open
*/
boolean canBeShared(Transaction txn, GroupId g, Contact c)
throws DbException;
}