mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-15 07:56:11 +08:00
GitHostRepo: Add name and username
Instead of having to parse this from the fullName. This way the code is easier to read and it's more reliable.
This commit is contained in:
@ -217,8 +217,19 @@ class GitLab implements GitHost {
|
||||
tags = tagList.map((e) => e.toString()).toList();
|
||||
}
|
||||
|
||||
var fullName = parsedJson['path_with_namespace'].toString();
|
||||
var namespace = parsedJson['namespace'];
|
||||
var username = "";
|
||||
if (namespace != null) {
|
||||
username = (namespace as Map)["path"];
|
||||
} else {
|
||||
username = fullName.split('/').first;
|
||||
}
|
||||
|
||||
return GitHostRepo(
|
||||
fullName: parsedJson['path_with_namespace'],
|
||||
name: parsedJson["name"],
|
||||
username: username,
|
||||
fullName: fullName,
|
||||
cloneUrl: parsedJson['ssh_url_to_repo'],
|
||||
updatedAt: updatedAt,
|
||||
description: parsedJson['description'],
|
||||
|
Reference in New Issue
Block a user