Skip to content

Commit

Permalink
Merge pull request #1047 from jecisc/1044-Show-a-button-View-on-Githu…
Browse files Browse the repository at this point in the history
…b-when-creating-a-PR

1044-Show-a-button-View-on-Github-when-creating-a-PR
  • Loading branch information
guillep authored Oct 30, 2018
2 parents a8e4fe0 + 25242c6 commit 1cd643f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ basicExecute

credentials := IceGitHubAPI ensureCredentials.

remote ifNil: [
remote ifNil: [
remote := self repository branch hasUpstream
ifTrue: [ self repository branch upstream remote ]
ifFalse: [ self askRemote: self repository ].
ifFalse: [ self askRemote: self repository ]
].

(self validateMakePullRequestOn: self repository) ifFalse: [ ^ #() ].

(IceGitHubCreatePullRequestModel
repository: self repository
repository: self repository
credentials: self credentials
headRemote: remote)
setModal: true;
setModal: true;
onAccept: [ :pullRequest |
[
pullRequest send.
UIManager default inform: 'Pull request created.' ]
on: IceGitHubError do: [ :e | self reportError: e ] ];
openWithSpec
[ | pullRequestDatas url |
pullRequestDatas := pullRequest send.
url := pullRequestDatas at: 'html_url'.
UIManager default
inform: 'Pull request created. Click to view on Github.'
actionOnClick: [ self class environment at: #WebBrowser ifPresent: [ :webBrowser | webBrowser openOn: url ] ifAbsent: [ self inform: ('Cannot open "{1}" because the project WebBrowser is not present by default in Pharo 6.' format: { url }) ] ] ]
on: IceGitHubError
do: [ :e | self reportError: e ] ];
openWithSpec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ send
'body' -> self body.
} asDictionary.

IceGitHubAPI new
^ IceGitHubAPI new
credentials: self credentials;
addPullRequest: self baseRemote owner
project: self baseRemote projectBasename
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*Iceberg-Plugin-GitHub
inform: aStringOrText actionOnClick: aBlock
"Display a message for the user to read and then dismiss. When clicked, execute an action."

(ProvideAnswerNotification signal: aStringOrText) ifNotNil: [ :answer | ^ true ].
(GrowlMorph openWithLabel: 'Information' translated contents: aStringOrText)
vanishDelay: 2 second;
actionBlock: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "MorphicUIManager"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*Iceberg-Plugin-GitHub
inform: aString actionOnClick: aBlock
"Only the MorphicUIManager should make the growl clickable."

^ self inform: aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "UIManager"
}

0 comments on commit 1cd643f

Please sign in to comment.