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

Can block the creation of new responses on a survey

This commit is contained in:
2020-05-18 18:19:07 +02:00
parent b4465cc70c
commit acc81acdea
3 changed files with 45 additions and 2 deletions

View File

@ -34,6 +34,12 @@ class SurveyHelper {
.isOK;
}
/// Prevent new choices from being created on a survey
static Future<void> blockNewChoicesCreation(int postID) async =>
await APIRequest.withLogin("surveys/block_new_choices_creation")
.addInt("postID", postID)
.execWithThrow();
/// Turn an API entry into a [Survey] object
static Survey apiToSurvey(Map<String, dynamic> map) {
// Parse survey responses
@ -50,6 +56,7 @@ class SurveyHelper {
question: map["question"],
userChoice: map["user_choice"],
choices: choices,
allowNewChoicesCreation: map["allowNewChoices"],
);
}
}