Correctly compute Github users' avatars

Currently, avatars are broken – probably because Github is transitioning away from gravatar. This should fix it.
I think either way has it's downsides, parsing and regenerating an url can
blow up too / make subtle changes. I'd pick the simpler approach, but does
not really matter ...

On Thu, Sep 25, 2014 at 1:43 AM, Daniel Schierbeck <notifications@github.com
> wrote:

> In app/models/changeset/github_user.rb:
>
> >  class Changeset::GithubUser
> >    def initialize(data)
> >      @data = data
> >    end
> >
> >    def avatar_url
> > -    "https://www.gravatar.com/avatar/#{@data.gravatar_id}?s=20"
> > +    uri = URI(@data.avatar_url)
> > +    params = URI.decode_www_form(uri.query || [])
> > +
> > +    # The `s` parameter controls the size of the avatar.
> > +    params << ["s", "20"]
> > +
> > +    uri.query = URI.encode_www_form(params)
> > +    uri.to_s
>
> I'd rather not make assumptions about the URL – my approach seems more
> resilient.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/zendesk/samson/pull/111/files#r18020756>.
>