Skip to content

Commit

Permalink
work_items: handle identity fields
Browse files Browse the repository at this point in the history
Identities are treated differently from other types,
they must be deserialized from json
to be correctly shown in UI, and they must
be written in `displayName <mailAddress>` form
in order to be correctly set.
  • Loading branch information
sstasi95 committed Dec 14, 2023
1 parent ef9e2f0 commit 42624e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/src/models/work_item_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class WorkItemField {
required this.referenceName,
required this.name,
this.required = false,
this.alwaysRequired = false,
this.readOnly = false,
this.defaultValue,
this.allowedValues = const [],
Expand All @@ -43,7 +44,7 @@ class WorkItemField {
factory WorkItemField.fromJson(Map<String, dynamic> json) => WorkItemField(
referenceName: json['referenceName'] as String,
name: json['name'] as String,
required: json['alwaysRequired'] as bool? ?? false,
alwaysRequired: json['alwaysRequired'] as bool? ?? false,
readOnly: json['readOnly'] as bool? ?? false,
defaultValue: json['defaultValue'] as String?,
allowedValues: (json['allowedValues'] as List<dynamic>?)?.map((v) => v.toString()).toList() ?? [],
Expand All @@ -53,6 +54,7 @@ class WorkItemField {

final String referenceName;
final String name;
bool alwaysRequired;
bool required;
bool readOnly;
final String? defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ class _CreateOrEditWorkItemController with FilterMixin, AppLogger {
final rules = checker.checkRules(field);
field
..readOnly = rules.readOnly || rules.makeEmpty
..required = rules.required;
..required = field.alwaysRequired || rules.required;

final refName = field.referenceName;

Expand Down

0 comments on commit 42624e9

Please sign in to comment.