1
0
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:
2019-11-30 12:24:19 +01:00
parent bd19411a48
commit 4406b8c882
5 changed files with 119 additions and 1 deletions

View File

@ -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
*

View File

@ -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)},