Skip to content

Commit 8751994

Browse files
authored
Исправить ошибку с невозможностью отредактировать персонажа, когда выключено редактирование групп (#2846)
1 parent 5ca65a5 commit 8751994

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/JoinRpg.WebPortal.Models/Characters/CharacterViewModelBase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.ComponentModel;
22
using System.ComponentModel.DataAnnotations;
33
using JoinRpg.DataModel;
4-
using JoinRpg.Helpers.Validation;
54
using JoinRpg.PrimitiveTypes;
65
using JoinRpg.PrimitiveTypes.ProjectMetadata;
76

@@ -25,7 +24,7 @@ public abstract class CharacterViewModelBase : IProjectIdAware, IValidatableObje
2524

2625
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
2726
{
28-
if (!ParentCharacterGroupIds.Any())
27+
if (AllowToSetGroups && ParentCharacterGroupIds.Length == 0)
2928
{
3029
yield return new ValidationResult(
3130
"Персонаж должен принадлежать хотя бы к одной группе");
@@ -34,11 +33,11 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
3433

3534
public CustomFieldsViewModel Fields { get; set; }
3635

37-
[CannotBeEmpty, DisplayName("Является частью групп")]
36+
[DisplayName("Является частью групп")]
3837
public int[] ParentCharacterGroupIds { get; set; } = [];
3938

4039
[ReadOnly(true)]
41-
public bool AllowToSetGroups { get; set; } = true;
40+
public bool AllowToSetGroups { get; set; }
4241

4342
protected void FillFields(Character field, int currentUserId, ProjectInfo projectInfo)
4443
{

0 commit comments

Comments
 (0)