Skip to content

Commit e2e4406

Browse files
authored
Merge pull request #85 from fenix-hub/dev
Dev
2 parents df97d99 + 4711e8a commit e2e4406

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This plugin is now supported in [Godot Extended Library Discord](https://discord
1212
A complete GitHub integration for your Godot Editor! Manage your project without even opening your browser.
1313

1414
Author: *"Nicolo (fenix) Santilio"*
15-
Version: *1.3.9c*
15+
Version: *1.4.0*
1616
Wiki: *[supported](https://github.com/fenix-hub/godot-engine.github-integration/wiki)*
1717
Godot Version: *3.2.3stable*
1818

addons/github-integration/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="GitHub integration"
44
description="Plugin to integrate GitHub requests directly via Godot Engine Editor"
55
author="Nicolo (fenix) Santilio"
6-
version="1.3.9c"
6+
version="1.4.0"
77
script="scripts/github-integration.gd"

addons/github-integration/scripts/ContributorClass.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func set_contributor_avatar(a : String) -> void:
3737
is_downloading = true
3838

3939
func _process(delta):
40-
if is_downloading: print(client.get_downloaded_bytes()/client.get_body_size()*100, " %")
40+
if is_downloading: pass#print(client.get_downloaded_bytes()/client.get_body_size()*100, " %")
4141

4242
func _on_request_completed(result: int, response_code: int, headers: PoolStringArray, avatar: PoolByteArray) -> void:
4343
if result == 0:

addons/github-integration/scripts/RepositoryItem.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func _ready():
2525
func set_repository(repository : Dictionary):
2626
_repository = repository
2727
_name = str(repository.name)
28+
name = _name
2829
_stars = repository.stargazerCount
2930
_forks = repository.forkCount
3031

addons/github-integration/scripts/RestHandler.gd

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ var loading : Control
4040
var session : HTTPClient = HTTPClient.new()
4141
var graphql_endpoint : String = "https://api.github.com/graphql"
4242
var graphql_queries : Dictionary = {
43-
'repositories':'{user(login: "%s"){repositories(ownerAffiliations:%s, first:%d, orderBy: {field: NAME, direction: ASC}){ nodes { diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl } } } } } } } }',
43+
'repositories':'{user(login: "%s"){repositories(ownerAffiliations:%s, first:%d, orderBy: {field: NAME, direction: ASC}){ nodes { diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl } } } } } } %s } }',
4444
'repository':'{user(login: "%s"){repository(name:"%s"){diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl }}}}}}}',
4545
'gists':'{ user(login: "%s") { gists(first: %s, orderBy: {field: PUSHED_AT, direction: DESC}, privacy: ALL) { nodes { owner { login } id description resourcePath name stargazerCount isPublic isFork files { encodedName encoding extension name size text } } } } }',
46+
'organizations_repositories':'organizations(first:10){nodes{repositories(first:100){nodes{diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl } } } } }}}}'
4647
}
4748
var header : PoolStringArray = ["Authorization: token "]
4849
var api_endpoints : Dictionary = {
@@ -217,7 +218,12 @@ func request_contributor_avatar(avatar_url : String, contributor_class : Contrib
217218

218219
func request_user_repositories() -> void:
219220
requesting = REQUESTS.USER_REPOSITORIES
220-
var query : String = graphql_queries.repositories % [UserData.USER.login,PluginSettings.owner_affiliations, repositories_limit]
221+
var owner_affiliations : Array = PluginSettings.owner_affiliations.duplicate(true)
222+
var is_org_member : bool = false
223+
if owner_affiliations.has("ORGANIZATION_MEMBER"):
224+
owner_affiliations.erase("ORGANIZATION_MEMBER")
225+
is_org_member = true
226+
var query : String = graphql_queries.repositories % [UserData.USER.login, owner_affiliations, repositories_limit, graphql_queries.organizations_repositories if is_org_member else ""]
221227
client.request(graphql_endpoint, UserData.header, true, HTTPClient.METHOD_POST, print_query(query))
222228

223229
func request_user_repository(repository_owner : String, repository_name : String) -> void:

addons/github-integration/scripts/UserPanel.gd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ func _on_request_failed(request_code : int, error_body : Dictionary) -> void:
8181
get_parent().print_debug_message("ERROR "+str(request_code)+" : "+error_body.message)
8282

8383
func _on_user_repositories_requested(body : Dictionary) -> void:
84-
var repositories : Array = body.user.repositories.nodes
84+
var repositories : Array = body.user.repositories.nodes
85+
if PluginSettings.owner_affiliations.has("ORGANIZATION_MEMBER"):
86+
for organization in body.user.organizations.nodes:
87+
repositories += organization.repositories.nodes
8588
load_repositories(repositories)
8689

8790
func _on_user_gists_requested(body : Dictionary) -> void:
@@ -113,6 +116,13 @@ func load_repositories(repositories : Array) -> void:
113116
clear_repo_list()
114117

115118
for repository in repositories:
119+
var is_listed : bool = false
120+
for repository_item in repository_list:
121+
if repository_item.name == repository.name:
122+
is_listed = true
123+
continue
124+
if is_listed:
125+
continue
116126
var repo_item = _repository_item.instance()
117127
RepoList.add_child(repo_item)
118128
repo_item.set_repository(repository)

0 commit comments

Comments
 (0)