galley-0.83.0: Conversations
Safe HaskellSafe-Inferred
LanguageGHC2021

Galley.API.Query

Synopsis

Documentation

conversationIdsPageFromV2 :: forall p r. (p ~ CassandraPaging, (Member ConversationStore r, Member (Error InternalError) r, Member (Input Env) r, Member (ListItems p ConvId) r, Member (ListItems p (Remote ConvId)) r, Member TinyLog r)) => ListGlobalSelfConvs -> Local UserId -> GetPaginatedConversationIds -> Sem r ConvIdsPage Source #

Lists conversation ids for the logged in user in a paginated way.

Pagination requires an order, in this case the order is defined as:

  • First all the local conversations are listed ordered by their id
  • After local conversations, remote conversations are listed ordered
  • lexicographically by their domain and then by their id.

FUTUREWORK: Move the body of this function to conversationIdsPageFrom once support for V2 is dropped.

conversationIdsPageFrom :: forall p r. (p ~ CassandraPaging, (Member ConversationStore r, Member (Error InternalError) r, Member (Input Env) r, Member (ListItems p ConvId) r, Member (ListItems p (Remote ConvId)) r, Member TinyLog r)) => Local UserId -> GetPaginatedConversationIds -> Sem r ConvIdsPage Source #

Lists conversation ids for the logged in user in a paginated way.

Pagination requires an order, in this case the order is defined as:

  • First all the local conversations are listed ordered by their id
  • After local conversations, remote conversations are listed ordered
  • lexicographically by their domain and then by their id.

getMLSSelfConversation :: forall r. (Member ConversationStore r, Member (Error InternalError) r, Member TinyLog r) => Local UserId -> Sem r Conversation Source #

Get an MLS self conversation. In case it does not exist, it is partially created in the database. The part that is not written is the epoch number; the number is inserted only upon the first commit. With this we avoid race conditions where two clients concurrently try to create or update the self conversation, where the only thing that can be updated is bumping the epoch number.

getMLSSelfConversationWithError :: forall r. (Member ConversationStore r, Member (Error InternalError) r, Member (ErrorS 'MLSNotEnabled) r, Member (Input Env) r, Member TinyLog r) => Local UserId -> Sem r Conversation Source #

The same as getMLSSelfConversation, but it throws an error in case the backend is not configured for MLS (the proxy for it being the existance of the backend removal key).

getMLSOne2OneConversationV5 :: (Member BrigAccess r, Member ConversationStore r, Member (Input Env) r, Member (Error FederationError) r, Member (Error InternalError) r, Member (ErrorS 'MLSNotEnabled) r, Member (ErrorS 'NotConnected) r, Member (ErrorS 'MLSFederatedOne2OneNotSupported) r, Member FederatorAccess r, Member TeamStore r, Member TinyLog r) => Local UserId -> Qualified UserId -> Sem r Conversation Source #

Get an MLS 1-1 conversation. If not already existing, the conversation object is created on the fly, but not persisted. The conversation will only be stored in the database when its first commit arrives.

For the federated case, we do not make the assumption that the other backend uses the same function to calculate the conversation ID and corresponding group ID, however we do assume that the two backends agree on which of the two is responsible for hosting the conversation.

isMLSOne2OneEstablished :: (Member ConversationStore r, Member (Input Env) r, Member (Error FederationError) r, Member (Error InternalError) r, Member (ErrorS 'MLSNotEnabled) r, Member (ErrorS 'NotConnected) r, Member FederatorAccess r, Member TinyLog r) => Local UserId -> Qualified UserId -> Sem r Bool Source #

Check if an MLS 1-1 conversation has been established, namely if its epoch is non-zero. The conversation will only be stored in the database when its first commit arrives.

For the federated case, we do not make the assumption that the other backend uses the same function to calculate the conversation ID and corresponding group ID, however we do assume that the two backends agree on which of the two is responsible for hosting the conversation.