added JsonCreator to FlagReason

This commit is contained in:
Jake Potrebic 2021-03-27 23:13:10 -07:00
parent 22934fb7c5
commit 017d23e7fa
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
2 changed files with 9 additions and 1 deletions

View File

@ -11,7 +11,7 @@
<v-card-text>
<v-form ref="modalForm" v-model="validForm">
<v-radio-group v-model="form.selection" :rules="[$util.$vc.require('A reason')]">
<v-radio v-for="(reason, index) in flagReasons" :key="index" :label="reason.title" :value="reason.type" />
<v-radio v-for="(reason, index) in flagReasons" :key="index" :label="$t(reason.title)" :value="reason.type" />
</v-radio-group>
<v-textarea v-model.trim="form.comment" rows="3" filled :rules="[$util.$vc.require('A comment')]" :label="$t('general.comment')" />
</v-form>

View File

@ -1,7 +1,10 @@
package io.papermc.hangar.model.common.projects;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Locale;
public enum FlagReason {
INAPPROPRIATE_CONTENT("project.flag.flags.inappropriateContent"),
@ -21,6 +24,11 @@ public enum FlagReason {
return title;
}
@JsonCreator
public static FlagReason creator(String name) {
return FlagReason.valueOf(name.toUpperCase(Locale.ROOT));
}
private static final FlagReason[] VALUES = values();
public static FlagReason[] getValues() {