Skip to content

Commit

Permalink
update owner transfer timeline event data (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Nov 20, 2024
1 parent 85e0ff3 commit ff86ef0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changed

- **Projectroles**
- Update default OIDC login button template (#1503)
- Update ownership transfer timeline event data (#1514)

Fixed
-----
Expand Down
15 changes: 10 additions & 5 deletions projectroles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2180,14 +2180,16 @@ def _get_timeline_failed_status(self):
else:
return timeline.TL_STATUS_FAILED

def _create_timeline_event(self, old_owner, new_owner, project):
def _create_timeline_event(
self, old_owner, new_owner, old_owner_role, project
):
timeline = get_backend_api('timeline_backend')
# Init Timeline event
if not timeline:
return None
tl_desc = 'transfer ownership from {{{}}} to {{{}}}'.format(
'prev_owner', 'new_owner'
)
tl_desc = (
'transfer ownership from {{{}}} to {{{}}}, set old owner as "{}"'
).format('prev_owner', 'new_owner', old_owner_role.name)
tl_event = timeline.add_event(
project=project,
app_name=APP_NAME,
Expand All @@ -2197,6 +2199,7 @@ def _create_timeline_event(self, old_owner, new_owner, project):
extra_data={
'prev_owner': old_owner.username,
'new_owner': new_owner.username,
'old_owner_role': old_owner_role.name,
},
)
tl_event.add_object(old_owner, 'prev_owner', old_owner.username)
Expand Down Expand Up @@ -2277,7 +2280,9 @@ def transfer_owner(self, project, new_owner, old_owner_as, old_owner_role):
new_inh_owner = (
True if new_inh_as and new_inh_as.role == self.role_owner else False
)
tl_event = self._create_timeline_event(old_owner, new_owner, project)
tl_event = self._create_timeline_event(
old_owner, new_owner, old_owner_role, project
)

try:
self._handle_transfer(
Expand Down

0 comments on commit ff86ef0

Please sign in to comment.