Skip to content

Commit 3c7befa

Browse files
committedFeb 16, 2018
Fix ckan.go
1 parent 8916d3c commit 3c7befa

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed
 

Diff for: ‎plugins/ckan/ckan.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/KSP-SpaceDock/SpaceDock-Backend/middleware"
1313
"github.com/KSP-SpaceDock/SpaceDock-Backend/objects"
1414
"github.com/KSP-SpaceDock/SpaceDock-Backend/routes"
15+
"github.com/KSP-SpaceDock/SpaceDock-Backend/utils"
1516
"bytes"
1617
"context"
1718
"encoding/json"
@@ -89,7 +90,7 @@ func mods_ckan(ctx *iris.Context) {
8990
}
9091
}
9192

92-
func AddModToCKAN(mod objects.Mod) string {
93+
func AddModToCKAN(mod *objects.Mod) string {
9394
if cfg.NetkanRepoPath == "" {
9495
return ""
9596
}
@@ -155,8 +156,8 @@ Please direct questions about this pull request to [{0}]({4}{3}).`))
155156
data := map[string]string {
156157
"0": mod.User.Username,
157158
"1": mod.Name,
158-
"2": create_mod_url(mod.ID, mod.Name, modURL),
159-
"3": create_profile_url(mod.User.ID, mod.User.Username, profileURL),
159+
"2": create_mod_url(mod.ID, mod.Name, cast.ToString(modURL)),
160+
"3": create_profile_url(mod.User.ID, mod.User.Username, cast.ToString(profileURL)),
160161
"4": app.Settings.Protocol + "://" + app.Settings.Domain,
161162
"5": mod.Description,
162163
"6": mod.ShortDescription,
@@ -173,12 +174,16 @@ Please direct questions about this pull request to [{0}]({4}{3}).`))
173174
Password: cfg.GithubPass,
174175
}
175176
client := github.NewClient(tp.Client())
177+
title := "Add " + mod.Name + " from " + app.Settings.SiteName
178+
base := "KSP-CKAN:master"
179+
head := cfg.GithubUser + ":add-" + json_blob["identifier"]
180+
maintainerCanModify := true
176181
p, _, _ := client.PullRequests.Create(context.Background(), "KSP-CKAN", "NetKAN", &github.NewPullRequest{
177-
Title: "Add " + mod.Name + " from " + app.Settings.SiteName,
178-
Base: &"KSP-CKAN:master",
179-
Head: &(cfg.GithubUser + ":add-" + json_blob["identifier"]),
182+
Title: &title,
183+
Base: &base,
184+
Head: &head,
180185
Body: &s,
181-
MaintainerCanModify: &true,
186+
MaintainerCanModify: &maintainerCanModify,
182187
})
183188
return *p.URL
184189
}

0 commit comments

Comments
 (0)
Please sign in to comment.