Skip to content

Commit

Permalink
Fix can't update environment issue without a URL
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed Sep 23, 2024
1 parent 15a01a2 commit c6333bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion frontend/lib/models/environment_issue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EnvironmentIssue with _$EnvironmentIssue {
required int id,
@JsonKey(name: 'environment_name') required String environmentName,
required String description,
required String? url,
required Uri? url,
@JsonKey(name: 'is_confirmed') required bool isConfirmed,
}) = _EnvironmentIssue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@ class _EnvironmentIssueUpdateForm extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return _EnvironmentIssueForm(
initialUrl: issue.url ?? '',
initialUrl: issue.url?.toString() ?? '',
initialDescription: issue.description,
initialIsConfirmed: issue.isConfirmed,
formSubtitle: 'On all environments with name: ${issue.environmentName}',
onSubmit: (url, description, isConfirmed) =>
ref.read(environmentsIssuesProvider.notifier).updateIssue(
issue.copyWith(
url: url,
description: description,
isConfirmed: isConfirmed,
),
onSubmit: (url, description, isConfirmed) {
final parsedUrl = Uri.tryParse(url);
ref.read(environmentsIssuesProvider.notifier).updateIssue(
issue.copyWith(
url: (parsedUrl?.isAbsolute == true) ? parsedUrl : null,
description: description,
isConfirmed: isConfirmed,
),
);
},
onDelete: () => showDialog<bool>(
context: context,
builder: (_) => _DeleteEnvironmentIssueConfirmationDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EnvironmentIssueListItem extends StatelessWidget {
const SizedBox(width: Spacing.level4),
if (issueUrl != null)
InlineUrlText(
url: issueUrl,
url: issueUrl.toString(),
urlText: 'URL',
fontStyle: Theme.of(context).textTheme.bodyMedium,
),
Expand Down

0 comments on commit c6333bb

Please sign in to comment.