1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Can update comments content

This commit is contained in:
2019-05-18 18:48:12 +02:00
parent 6d73d38bf8
commit 67b6764f09
6 changed files with 60 additions and 8 deletions

View File

@ -37,13 +37,24 @@ class CommentsHelper {
return apiToComment(response.getObject());
}
/// Update comment content
Future<bool> updateContent(int id, String newContent) async {
return (await APIRequest(uri: "comments/edit", needLogin: true, args: {
"commentID": id.toString(),
"content": newContent,
}).exec())
.isOK;
}
/// Attempt to delete a comment
Future<bool> delete(int id) async {
return (await APIRequest(
uri: "comments/delete",
needLogin: true,
args: {"commentID": id.toString()},
).exec()).code == 200;
uri: "comments/delete",
needLogin: true,
args: {"commentID": id.toString()},
).exec())
.code ==
200;
}
/// Turn an API entry into a [Comment] object