diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7649b13..1a25771 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -69,6 +69,11 @@ "description": "No issues found for the current repo", "context": "Repo issue page" }, + "nopr": "No pull requests found", + "@nopr": { + "description": "No Pull requests found for the current repo", + "context": "Repo issue page" + }, "login": "Login", "@login": { "description": "Login page title", diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index a88f516..7920961 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -13,6 +13,7 @@ "noreadme": "Nem található README file!", "nofiles": "Nem található fájl ebben a könyvtárban", "noissues": "Nincsenek hibajegyek", + "nopr": "Nincsenek egyesítési kérések", "login": "Bejelentkezés", "otherInstance": "Egy másik példány", "instanceUrl": "Példány címe", diff --git a/lib/model/pull.dart b/lib/model/pull.dart index 06e2dd9..63257af 100644 --- a/lib/model/pull.dart +++ b/lib/model/pull.dart @@ -13,7 +13,7 @@ class PullRequest { List? labels; Milestone? milestone; User? assignee; - User? assignees; + List? assignees; String state; bool isLocked; int comments; @@ -90,8 +90,13 @@ class PullRequest { milestone = json['milestone'] != null ? Milestone.fromJson(json['milestone']) : null; - assignee = json['assignee']; - assignees = json['assignees']; + assignee = (json['assignee'] != null) ? User.fromJson(json['assignee']) : null; + if (json['assignees'] != null) { + assignees = []; + json['assignees'].forEach((v) { + assignees!.add( User.fromJson(v)); + }); + } mergeable = json['mergeable']; mergedAt = json['merged_at']; mergeCommitSha = json['merge_commit_sha']; diff --git a/lib/service/gitea_service.dart b/lib/service/gitea_service.dart index 46eeb5b..fa051f6 100644 --- a/lib/service/gitea_service.dart +++ b/lib/service/gitea_service.dart @@ -64,6 +64,7 @@ class GiteaService { Uri.https(apiAccess.instance, "api/v1/repos/$owner/$repo/issues", { "token": apiAccess.token, "state": state, + "type": "issues", "page" : page.toString(), "limit" : limit.toString(), }), diff --git a/lib/widget/repo_overview.dart b/lib/widget/repo_overview.dart index f81fe99..b3ed729 100644 --- a/lib/widget/repo_overview.dart +++ b/lib/widget/repo_overview.dart @@ -504,6 +504,7 @@ class _RepoPullRequests extends State { @override Widget build(BuildContext context) { final media = MediaQuery.of(context).size; + final l10n = L10n.of(context)!; return DefaultTabController( length: 2, child: DefaultTabController( @@ -517,8 +518,8 @@ class _RepoPullRequests extends State { child: Column( children: [ Expanded(child: Container()), - const TabBar( - tabs: [Text("Open"), Text("Closed")], + TabBar( + tabs: [Text(l10n.open), Text(l10n.closed)], ), ], ), @@ -546,8 +547,8 @@ class _RepoPullRequests extends State { return Center(child: Text('failed to fetch $error_message')); case PullRequestStatus.success: if (state.pulls.isEmpty) { - return const Center( - child: Text('No issues found')); + return Center( + child: Text(l10n.nopr)); } return ListView.builder( @@ -589,8 +590,8 @@ class _RepoPullRequests extends State { return Center(child: Text('failed to fetch $error_message')); case PullRequestStatus.success: if (state.pulls.isEmpty) { - return const Center( - child: Text('No issues found')); + return Center( + child: Text(l10n.nopr)); } return ListView.builder(