Skip to content

Commit

Permalink
Fixed displaying authors in maplist to allow searching for nicknames …
Browse files Browse the repository at this point in the history
…(in TM2020). (#1202)

* Fixed displaying authors in maplist to allow searching for nicknames (in TM2020).

* Removed unneeded len() check on author nickname.
  • Loading branch information
TheMaximum committed Oct 21, 2022
1 parent 23b17ce commit c7e4358
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pyplanet/apps/contrib/jukebox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ async def get_data(self):
map_dict['local_record_diff_direction'] = None
map_dict['karma'] = None

# Use custom field for author to allow for searching on both login and nickname (depending on what's shown).
map_dict['author'] = (
map_dict['author_nickname']
if 'author_nickname' in map_dict and map_dict['author_nickname']
else map_dict['author_login']
)

# Skip if in performance mode or advanced is not enabled.
if self.app.instance.performance_mode or not self.advanced:
data.append(map_dict)
Expand Down Expand Up @@ -146,14 +153,11 @@ async def get_fields(self):
},
{
'name': 'Author',
'index': 'author_login',
'index': 'author',
'sorting': True,
'searching': True,
'search_strip_styles': True,
'renderer': lambda row, field:
row['author_nickname']
if 'author_nickname' in row and row['author_nickname'] and len(row['author_nickname'])
else row['author_login'],
'type': 'label',
'width': 45,
},
]
Expand Down

0 comments on commit c7e4358

Please sign in to comment.