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

Support for multiple assignees on issue closing/re-opening #1191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,5 @@ Contributors
- Thomas Buchner (@MrBatschner)

- Chris Cotter (@ccotter)

- Jonas Brand (@8R0WNI3)
12 changes: 10 additions & 2 deletions src/github3/issues/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,18 @@ def close(self):
bool
"""
assignee = self.assignee.login if self.assignee else ""
assignees = [a.login for a in self.assignees]
number = self.milestone.number if self.milestone else None
labels = [lbl.name for lbl in self.original_labels]

return self.edit(
self.title, self.body, assignee, "closed", number, labels
self.title,
self.body,
assignee,
"closed",
number,
labels,
assignees,
)

def comment(self, id_num):
Expand Down Expand Up @@ -388,10 +395,11 @@ def reopen(self):
bool
"""
assignee = self.assignee.login if self.assignee else ""
assignees = [a.login for a in self.assignees]
number = self.milestone.number if self.milestone else None
labels = [str(lbl) for lbl in self.original_labels]
return self.edit(
self.title, self.body, assignee, "open", number, labels
self.title, self.body, assignee, "open", number, labels, assignees
)

@requires_auth
Expand Down
2 changes: 1 addition & 1 deletion tests/cassettes/Issue_closed.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDZII8uJ18RkHd3Yw6BQKN3LLqSyrThismQkOZ1r+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQ3NrKJBjTivcLbud12s9UiTWrlMGGFyVdcF2baIi71UG/ajA3pmYGx+EY9ZA35VbpZno8EjiCpkyYf2A8koU7WIslLdk9wOFMJZP2pfArHJDZ4gW5HQyoc1uKrVA8ys6z8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/q7Ss0NRyJQPLjA1mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdm8lgUYuM1OB/GIhFEP0QW1VG9n0n80ZFlljpgp2F5aX3A1Xrp/XHwYAhBUdRRHRk7CoXJ1NIN3VB2O4o75TAmhboG0LX2zN/Zthte+ILV7hhAezQHfFis7ZxBFOJqr4IKbp8p3rzDv10L3GjvluSMZyINm+RHilp4g7VaCqtaPCY+sU5NpXrlCOiZ6G/7AU7qgkt/5wjyGB/4GMH40HXFO7wf+z+ntvUHvHFtcab6gWeNCpFnG+ALCfjR0iwBM21Sui7+57oQkcMumNC9dh86oMOx+NVRR8qP1LUqGZHQaRuET7XR4+nezFX+hpoFd3YQFDcu3TAkFkwKFESNhBss5m9Fa2LWiTkf8fjgYxTF5CR1cvonCSqtCM+OSthTEZfDo40oXo1k4THd1/fJtYd1JMqEMy8FEqOw3PHSxhKlmYOxKBiayFuLh3UB0wb3kAgaokuv19R2RwDEzzYCeTylEAkUhiU9IdEJG1+E4IQNIy3fYr67yvTYkToZREsXOphO3gwGTAUkIcSa0tnOlpyBXZdx3EGz5+fLi4vzT5dX59eUV2KQqb6ZuOsLSpDq7nnMT3HIhgpQF3RZB2gQwf4JJpnJ25u+Bfrfy9t0E+48TXJ2tWJb9cSc7ANpELP0Ou9xs+tz8lA8RSJvX+2j5r7Z3Ar3eR6/30foHDf8n99H9X7wfQpR2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:01 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4994", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"d504ec810dda9aa826cf32f81eb61972\"", "Last-Modified": "Fri, 10 Nov 2017 14:34:03 GMT", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.094360", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17A98:10E8464:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:01"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"title\": \"Integration test for editing an issue\", \"body\": \"This will be closed by the `issue.closed()`\\n\", \"assignee\": \"\", \"state\": \"closed\", \"labels\": [\"Easy\", \"in progress\"]}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "177"}, "method": "PATCH", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDbIIsuJ18RkHd3Yw6BQKNnLLqSyrThismQkOZ1n+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQwtrKJBjTivcLbhd12s9UiTWrlMGGFyVdcl2baIi71UG/ajA3pmYGx+EY9ZA35VbpZnY6EjiCpkyYf2A8kIU7WIslLdkdwOFMJZP2ufBrHJDZ8hm5HQyoC1uKnVA8yM6T8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/i7Ss0NRyJQPLjA3mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdmilgUYuM3OBvGIhFEP0SW1VO9m0n80ZFVljpgp2F5aX3A1Xrl/WL4fAhBUdRRHRk7CsXJ1NIP3VB2P4p75XAmhboG0K327Nw5thje+ILV7hhCezAHfFiu7YBBFOJqr4IKbx8r3oDDv10L3GjvjuSMZyINm+QniVp4g7VaCqtaPCY+sU5NpXrlCOiV6W/7AU7qgkv/xhXkKD/wNYPxoOuGc3g/8n9LbB4PeOba40nxJs8aFSLOM8SWE/WToDgGYtqlcF3913QlJ4JbNaF66Dp1TYdjdeqii5HvrW5QMyegsjMJH2un49O9mK/5MTQO7ugkLGlZvmRIKJgUKI0bCDJZzNqe1sBtFnY743XAwimPyHDq4fBWFlVaFZsYlbSWIy+DBx7UuRrNwmO7r+unbwrqTZEIZloOJUNkveOhiCVPNwNiVDExkLcT9u4HognvJBQxQJTfrmzsigWNmmgE9n1GIBIpCEr8l0VsymobjhAwgLd9gv7rKt2zOnE0UTiOSxKMkjJxNJ24PQ+JkQBJCnAmt7ULpGchVGfcdBFt+urq8vPh4dX0xvboGm1TlzcxNR1iaVOfTBTfBLRciSFnQbRGkTQDzJ5hkKmfn/h7odyuv30yw/zjB1fmaZdlvd7IjoG3Eyu+4y822z80PeR+BtHm5j1b/agcn0Mt99HIfbX7Q8H9yH939BaEm/gh2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:02 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4993", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"a8bbefe768d759477b6df6a628089e23\"", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.209756", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17AC1:10E848A:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:02"}], "recorded_with": "betamax/0.8.0"}
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDZII8uJ18RkHd3Yw6BQKN3LLqSyrThismQkOZ1r+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQ3NrKJBjTivcLbud12s9UiTWrlMGGFyVdcF2baIi71UG/ajA3pmYGx+EY9ZA35VbpZno8EjiCpkyYf2A8koU7WIslLdk9wOFMJZP2pfArHJDZ4gW5HQyoc1uKrVA8ys6z8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/q7Ss0NRyJQPLjA1mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdm8lgUYuM1OB/GIhFEP0QW1VG9n0n80ZFlljpgp2F5aX3A1Xrp/XHwYAhBUdRRHRk7CoXJ1NIN3VB2O4o75TAmhboG0LX2zN/Zthte+ILV7hhAezQHfFis7ZxBFOJqr4IKbp8p3rzDv10L3GjvluSMZyINm+RHilp4g7VaCqtaPCY+sU5NpXrlCOiZ6G/7AU7qgkt/5wjyGB/4GMH40HXFO7wf+z+ntvUHvHFtcab6gWeNCpFnG+ALCfjR0iwBM21Sui7+57oQkcMumNC9dh86oMOx+NVRR8qP1LUqGZHQaRuET7XR4+nezFX+hpoFd3YQFDcu3TAkFkwKFESNhBss5m9Fa2LWiTkf8fjgYxTF5CR1cvonCSqtCM+OSthTEZfDo40oXo1k4THd1/fJtYd1JMqEMy8FEqOw3PHSxhKlmYOxKBiayFuLh3UB0wb3kAgaokuv19R2RwDEzzYCeTylEAkUhiU9IdEJG1+E4IQNIy3fYr67yvTYkToZREsXOphO3gwGTAUkIcSa0tnOlpyBXZdx3EGz5+fLi4vzT5dX59eUV2KQqb6ZuOsLSpDq7nnMT3HIhgpQF3RZB2gQwf4JJpnJ25u+Bfrfy9t0E+48TXJ2tWJb9cSc7ANpELP0Ou9xs+tz8lA8RSJvX+2j5r7Z3Ar3eR6/30foHDf8n99H9X7wfQpR2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:01 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4994", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"d504ec810dda9aa826cf32f81eb61972\"", "Last-Modified": "Fri, 10 Nov 2017 14:34:03 GMT", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.094360", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17A98:10E8464:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:01"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"title\": \"Integration test for editing an issue\", \"body\": \"This will be closed by the `issue.closed()`\\n\", \"assignee\": \"\", \"state\": \"closed\", \"labels\": [\"Easy\", \"in progress\"], \"assignees\": []}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "177"}, "method": "PATCH", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDbIIsuJ18RkHd3Yw6BQKNnLLqSyrThismQkOZ1n+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQwtrKJBjTivcLbhd12s9UiTWrlMGGFyVdcl2baIi71UG/ajA3pmYGx+EY9ZA35VbpZnY6EjiCpkyYf2A8kIU7WIslLdkdwOFMJZP2ufBrHJDZ8hm5HQyoC1uKnVA8yM6T8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/i7Ss0NRyJQPLjA3mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdmilgUYuM3OBvGIhFEP0SW1VO9m0n80ZFVljpgp2F5aX3A1Xrl/WL4fAhBUdRRHRk7CsXJ1NIP3VB2P4p75XAmhboG0K327Nw5thje+ILV7hhCezAHfFiu7YBBFOJqr4IKbx8r3oDDv10L3GjvjuSMZyINm+QniVp4g7VaCqtaPCY+sU5NpXrlCOiV6W/7AU7qgkv/xhXkKD/wNYPxoOuGc3g/8n9LbB4PeOba40nxJs8aFSLOM8SWE/WToDgGYtqlcF3913QlJ4JbNaF66Dp1TYdjdeqii5HvrW5QMyegsjMJH2un49O9mK/5MTQO7ugkLGlZvmRIKJgUKI0bCDJZzNqe1sBtFnY743XAwimPyHDq4fBWFlVaFZsYlbSWIy+DBx7UuRrNwmO7r+unbwrqTZEIZloOJUNkveOhiCVPNwNiVDExkLcT9u4HognvJBQxQJTfrmzsigWNmmgE9n1GIBIpCEr8l0VsymobjhAwgLd9gv7rKt2zOnE0UTiOSxKMkjJxNJ24PQ+JkQBJCnAmt7ULpGchVGfcdBFt+urq8vPh4dX0xvboGm1TlzcxNR1iaVOfTBTfBLRciSFnQbRGkTQDzJ5hkKmfn/h7odyuv30yw/zjB1fmaZdlvd7IjoG3Eyu+4y822z80PeR+BtHm5j1b/agcn0Mt99HIfbX7Q8H9yH939BaEm/gh2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:02 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4993", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"a8bbefe768d759477b6df6a628089e23\"", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.209756", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17AC1:10E848A:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:02"}], "recorded_with": "betamax/0.8.0"}
Loading