Fix recipients renderer for email settings grid

This commit is contained in:
Lance Edgar 2017-08-07 19:09:03 -05:00
parent 4cb4d9b14c
commit 430a1416c6

View file

@ -84,9 +84,8 @@ class ProfilesView(MasterView):
g.sorters['to'] = g.make_simple_sorter('to', foldcase=True) g.sorters['to'] = g.make_simple_sorter('to', foldcase=True)
g.sorters['enabled'] = g.make_simple_sorter('enabled') g.sorters['enabled'] = g.make_simple_sorter('enabled')
g.default_sortkey = 'key' g.default_sortkey = 'key'
g.set_type('enabled', 'boolean') g.set_type('enabled', 'boolean')
g.set_renderer('to', self.render_to)
g.set_link('key') g.set_link('key')
g.set_link('subject') g.set_link('subject')
@ -94,6 +93,15 @@ class ProfilesView(MasterView):
if g.more_actions: if g.more_actions:
g.main_actions.append(g.more_actions.pop()) g.main_actions.append(g.more_actions.pop())
def render_to(self, email, column):
value = email['to']
if not value:
return ""
recips = parse_list(value)
if len(recips) < 3:
return value
return "{}, ...".format(', '.join(recips[:2]))
def normalize(self, email): def normalize(self, email):
def get_recips(type_): def get_recips(type_):
recips = email.get_recips(type_) recips = email.get_recips(type_)