mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-25 23:09:22 +00:00
Can change post visibility level
This commit is contained in:
parent
005e09a43f
commit
9f22f2df56
@ -305,7 +305,10 @@ export class PostsController {
|
|||||||
*/
|
*/
|
||||||
public static async SetVisibilityLevel(h: RequestHandler) {
|
public static async SetVisibilityLevel(h: RequestHandler) {
|
||||||
|
|
||||||
// TODO : implement
|
const postID = await h.postPostIDWithAccess("postID", PostAccessLevel.FULL_ACCESS);
|
||||||
|
const newVisibility = this.PostVisibilityLevel(h, "new_level");
|
||||||
|
|
||||||
|
await PostsHelper.SetLevel(postID, newVisibility);
|
||||||
|
|
||||||
h.success("");
|
h.success("");
|
||||||
}
|
}
|
||||||
|
@ -442,6 +442,24 @@ export class PostsHelper {
|
|||||||
}) > 0;
|
}) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set new visibility level to the post
|
||||||
|
*
|
||||||
|
* @param postID Target post ID
|
||||||
|
* @param level Target access level
|
||||||
|
*/
|
||||||
|
public static async SetLevel(postID: number, level: PostVisibilityLevel) {
|
||||||
|
await DatabaseHelper.UpdateRows({
|
||||||
|
table: TABLE_NAME,
|
||||||
|
where: {
|
||||||
|
ID: postID
|
||||||
|
},
|
||||||
|
set: {
|
||||||
|
niveau_visibilite: level
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn a database entry into a row object
|
* Turn a database entry into a row object
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user