Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1044-Show-a-button-View-on-Github-when-creating-a-PR #1047

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ 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 |
pullRequestDatas := pullRequest send.
UIManager default
inform: 'Pull request created. Click to view on Github.'
actionOnClick: [ self class environment at: #WebBrowser ifPresent: [ :webBrowser | webBrowser openOn: (pullRequestDatas at: 'html_url') ] ifAbsent: [ self inform: 'Feature not available in Pharo 6' ] ] ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in #1048, I'd like a more explicit comment. (Also this shows that we are repeating some code here...)

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"
}