|
5 | 5 | from ...cloud.repositories.commits import Commit
|
6 | 6 | from ..common.builds import Build
|
7 | 7 | from ..common.comments import Comment
|
8 |
| -from ..common.users import User, Participant |
| 8 | +from ..common.users import User, Participant, AppUser |
9 | 9 |
|
10 | 10 |
|
11 | 11 | class PullRequests(BitbucketCloudBase):
|
@@ -209,6 +209,9 @@ def declined_reason(self):
|
209 | 209 | @property
|
210 | 210 | def author(self):
|
211 | 211 | """User object of the author"""
|
| 212 | + if self.get_data("author")["type"] == "app_user": |
| 213 | + # If the author is an app user, return an AppUser instance |
| 214 | + return AppUser(None, self.get_data("author"), **self._new_session_args) |
212 | 215 | return User(None, self.get_data("author"))
|
213 | 216 |
|
214 | 217 | @property
|
@@ -451,11 +454,17 @@ def is_resolved(self):
|
451 | 454 | @property
|
452 | 455 | def creator(self):
|
453 | 456 | """User object with user information of the task creator"""
|
| 457 | + if self.get_data("creator")["type"] == "app_user": |
| 458 | + # If the creator is an app user, return an AppUser instance |
| 459 | + return AppUser(None, self.get_data("creator"), **self._new_session_args) |
454 | 460 | return User(None, self.get_data("creator"), **self._new_session_args)
|
455 | 461 |
|
456 | 462 | @property
|
457 | 463 | def resolved_by(self):
|
458 | 464 | """User object with user information of the task resolver"""
|
| 465 | + if self.get_data("resolved_by")["type"] == "app_user": |
| 466 | + # If the resolver is an app user, return an AppUser instance |
| 467 | + return AppUser(None, self.get_data("resolved_by"), **self._new_session_args) |
459 | 468 | return User(None, self.get_data("resolved_by"), **self._new_session_args)
|
460 | 469 |
|
461 | 470 | def update(self, raw_message):
|
|
0 commit comments