On 09/12/2016 04:53 PM, Stephen Finucane wrote:
> In the absence of a name, the email is currently used. Some emails are
> long and rather unreadable. The likelihood of someone's localpart (i.e.
> the bit before the '@') conflicting with that of someone else on the
> same patchwork instance and project is very low, so form a "handle"
> from just this.
> 
> Signed-off-by: Stephen Finucane <stephenfinuc...@hotmail.com>

Looks like you lost my reviewed-by from your first revision of this patch.

Reviewed-by: Andy Doan <andy.d...@linaro.org>

> ---
>  patchwork/models.py              |  7 +++++++
>  patchwork/templatetags/person.py | 12 ++++--------
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/patchwork/models.py b/patchwork/models.py
> index 52325d2..109f94c 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -51,6 +51,13 @@ class Person(models.Model):
>          self.name = user.profile.name
>          self.user = user
>  
> +    @property
> +    def handle(self):
> +        if self.user:
> +            return self.user.name
> +        else:
> +            return self.email.split('@')[0]
> +
>      def __str__(self):
>          if self.name:
>              return '%s <%s>' % (self.name, self.email)
> diff --git a/patchwork/templatetags/person.py 
> b/patchwork/templatetags/person.py
> index 7af021f..98c0f2b 100644
> --- a/patchwork/templatetags/person.py
> +++ b/patchwork/templatetags/person.py
> @@ -33,14 +33,10 @@ register = template.Library()
>  @register.filter
>  def personify(person, project):
>  
> -    if person.name:
> -        linktext = escape(person.name)
> -    else:
> -        linktext = escape(person.email)
> -
>      url = reverse('patch-list',
>                    kwargs={'project_id': project.linkname})
> -    str = '<a href="%s?%s=%s">%s</a>' % (
> -        url, SubmitterFilter.param, escape(person.id), linktext)
> +    elem = '<a href="%s?%s=%s" title="%s">%s</a>' % (
> +        url, SubmitterFilter.param, escape(person.id), str(person),
> +        person.name or person.handle)
>  
> -    return mark_safe(str)
> +    return mark_safe(elem)
> 

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to