Commit c18e2778b2f1a4a2c3fb8e0f79c400456645e036

Authored by Olaf Mandel
1 parent 761fbbfe

Fix avatar URLs in JS-lists for relative_url_root

In user lists created when entering a (partial) user name into
a field, the URL to the user avatar was invalid if running with
relative_url_root.

This patch is the result of:
sed -i 's/\(= *\)\(user\.avatar_url\)/\1gon.relative_url_root + \2/' \
    app/assets/javascripts/*.coffee
app/assets/javascripts/project_users_select.js.coffee
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 37
38 projectUserFormatResult: (user) -> 38 projectUserFormatResult: (user) ->
39 if user.avatar_url 39 if user.avatar_url
40 - avatar = user.avatar_url 40 + avatar = gon.relative_url_root + user.avatar_url
41 else if gon.gravatar_enabled 41 else if gon.gravatar_enabled
42 avatar = gon.gravatar_url 42 avatar = gon.gravatar_url
43 avatar = avatar.replace('%{hash}', md5(user.email)) 43 avatar = avatar.replace('%{hash}', md5(user.email))
app/assets/javascripts/users_select.js.coffee
1 $ -> 1 $ ->
2 userFormatResult = (user) -> 2 userFormatResult = (user) ->
3 if user.avatar_url 3 if user.avatar_url
4 - avatar = user.avatar_url 4 + avatar = gon.relative_url_root + user.avatar_url
5 else if gon.gravatar_enabled 5 else if gon.gravatar_enabled
6 avatar = gon.gravatar_url 6 avatar = gon.gravatar_url
7 avatar = avatar.replace('%{hash}', md5(user.email)) 7 avatar = avatar.replace('%{hash}', md5(user.email))