Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Исправить ошибку с невозможностью отредактировать персонажа, когда вы… #2846

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using JoinRpg.DataModel;
using JoinRpg.Helpers.Validation;
using JoinRpg.PrimitiveTypes;
using JoinRpg.PrimitiveTypes.ProjectMetadata;

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

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

public CustomFieldsViewModel Fields { get; set; }

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

[ReadOnly(true)]
public bool AllowToSetGroups { get; set; } = true;
public bool AllowToSetGroups { get; set; }

protected void FillFields(Character field, int currentUserId, ProjectInfo projectInfo)
{
Expand Down
Loading