mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-21 17:15:17 +00:00
Can update following state of a conversation
This commit is contained in:
@ -72,6 +72,28 @@ export class ConversationsController {
|
||||
handler.send(this.ConversationToAPI(conv));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update conversation settings
|
||||
*
|
||||
* @param handler Request handler
|
||||
*/
|
||||
public static async UpdateSettings(handler: RequestHandler) : Promise<void> {
|
||||
const convID = await this.GetPostConversationId("conversationID", handler);
|
||||
|
||||
// Update following state, if required
|
||||
if(handler.hasPostParameter("following")) {
|
||||
await ConversationsHelper.SetFollowing(
|
||||
handler.getUserId(),
|
||||
convID,
|
||||
handler.postBool("following")
|
||||
);
|
||||
}
|
||||
|
||||
// TODO : update moderation settings
|
||||
|
||||
handler.success("Conversation information successfully updated!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and return safely a conversation ID specified in a $_POST Request
|
||||
*
|
||||
|
@ -55,6 +55,7 @@ export const Routes : Route[] = [
|
||||
{path: "/conversations/getInfoOne", cb: (h) => ConversationsController.GetInfoSingle(h)},
|
||||
{path: "/conversations/getInfosOne", cb: (h) => ConversationsController.GetInfoSingle(h)}, // Legacy
|
||||
|
||||
{path: "/conversations/updateSettings", cb: (h) => ConversationsController.UpdateSettings(h)},
|
||||
|
||||
// Search controller
|
||||
{path: "/search/user", cb: (h) => SearchController.SearchUser(h)},
|
||||
|
Reference in New Issue
Block a user