-
Notifications
You must be signed in to change notification settings - Fork 25
Fix #1205: add phabricator attachment links to jira #1206
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
36e022e
WIP: add phab links to comments
segunfamisa 17951e9
WIP 2: add phab links as remote link
segunfamisa b7331b1
Use is_phabricator_patch to determine if an attachment is is a phab p…
segunfamisa 1736df2
Refactor phabricator link logic; handle attachments directly in steps.py
segunfamisa 9e2fb15
Remove unnecessary indentation
segunfamisa 8692cce
Merge branch 'main' into sf/jbi-phab-attachment
segunfamisa c98dc59
Add test case for patch attachment with unexpected file name
segunfamisa 7face0c
Rework phabricator_url function to reduce indentation
segunfamisa 0e48bad
Rename maybe_add_or_update_phabricator_link to maybe_add_phabricator_…
segunfamisa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| "maybe_assign_jira_user", | ||
| "maybe_update_issue_status", | ||
| "maybe_update_issue_resolution", | ||
| "maybe_add_or_update_phabricator_link", | ||
| ], | ||
| "comment": [ | ||
| "create_comment", | ||
|
|
@@ -245,7 +246,36 @@ def test_added_attachment( | |
|
|
||
| mocked_jira.issue_add_comment.assert_called_once_with( | ||
| issue_key="JBI-234", | ||
| comment="*[email protected]* created an attachment:\n*Description*: Bug 1337 - Stop war r?peace\n*Filename*: phabricator-D1234-url.txt (text/x-phabricator-request)", | ||
| comment="*[email protected]* created an attachment:\n*Description*: Bug 1337 - Stop war r?peace\n*Filename*: phabricator-D1234-url.txt (text/x-phabricator-request)\n*Phabricator URL*: https://phabricator.services.mozilla.com/D1234", | ||
| ) | ||
|
|
||
| def test_added_phabricator_attachment( | ||
| action_context_factory, mocked_jira, action_params_factory | ||
| ): | ||
| phabricator_attachment_context = action_context_factory( | ||
| operation=Operation.ATTACHMENT, | ||
| bug__with_attachment=True, | ||
| bug__id=5555, | ||
| bug__attachment__is_patch=True, | ||
| bug__attachment__is_obsolete=False, | ||
| bug__attachment__id=123456, | ||
| bug__attachment__file_name="phabricator-D1234-url.txt", | ||
| bug__attachment__description="Bug 1234 - Fix all the bugs", | ||
| bug__attachment__content_type="text/x-phabricator-request", | ||
| event__target="attachment", | ||
| jira__issue="JBI-234", | ||
| ) | ||
| callable_object = Executor( | ||
| action_params_factory(jira_project_key=phabricator_attachment_context.jira.project) | ||
| ) | ||
|
|
||
| callable_object(context=phabricator_attachment_context) | ||
|
|
||
| mocked_jira.create_or_update_issue_remote_links.assert_called_once_with( | ||
| issue_key="JBI-234", | ||
| link_url="https://phabricator.services.mozilla.com/D1234", | ||
| title="Bug 1234 - Fix all the bugs", | ||
| global_id="5555-123456", | ||
| ) | ||
|
|
||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.