Use owner's username or email if display name is not set

If a change owner does not have a display name configured, the change
list doesn't display any name.

Rather than displaying nothing, attempt to use the username or email
instead if one of them is configured.

If no display name, username or email is set for the owner, default
to 'Anonymous Coward'.

Change-Id: Ifa2c56d89ed3d9b24e67643e460cacc133db90dd
This commit is contained in:
David Pursehouse 2014-09-11 07:05:24 +02:00
parent 03bf976f49
commit 32eb13939d
1 changed files with 9 additions and 4 deletions

View File

@ -57,10 +57,15 @@ class ChangeRow(urwid.Button):
self.subject.set_text(change.subject)
self.number.set_text(str(change.number))
self.project.set_text(change.project.name.split('/')[-1])
if change.owner and change.owner.name:
self.owner.set_text(change.owner.name)
else:
self.owner.set_text(u'')
owner_name = 'Anonymous Coward'
if change.owner:
if change.owner.name:
owner_name = change.owner.name
elif change.owner.username:
owner_name = change.owner.username
elif change.owner.email:
owner_name = change.owner.email
self.owner.set_text(owner_name)
del self.columns.contents[self.num_columns:]
for category in change.getCategories():
v = change.getMaxForCategory(category)