[Rails 5] Fix link_to_member_avatar
What does this MR do?
This is a quick fix for
ActionView::Template::Error:
nil is not a valid asset source
# ./app/helpers/lazy_image_tag_helper.rb:12:in `image_tag'
# ./app/helpers/projects_helper.rb:27:in `link_to_member_avatar'
# ./app/helpers/projects_helper.rb:39:in `link_to_member'
# ./app/views/shared/issuable/_participants.html.haml:14:in `block in _app_views_shared_issuable__participants_html_haml___1967790359849897399_307108740'
# ./app/views/shared/issuable/_participants.html.haml:12:in `each'
# ./app/views/shared/issuable/_participants.html.haml:12:in `_app_views_shared_issuable__participants_html_haml___1967790359849897399_307108740'
# ./app/views/shared/issuable/_sidebar.html.haml:122:in `block in _app_views_shared_issuable__sidebar_html_haml__4258134513421332557_279739320'
# ./app/views/shared/issuable/_sidebar.html.haml:18:in `_app_views_shared_issuable__sidebar_html_haml__4258134513421332557_279739320'
# ./app/views/projects/issues/show.html.haml:91:in `_app_views_projects_issues_show_html_haml__4363779578181523868_325530840'
# ./lib/gitlab/i18n.rb:47:in `with_locale'
# ./lib/gitlab/i18n.rb:53:in `with_user_locale'
# ./app/controllers/application_controller.rb:330:in `set_locale'
# ./lib/gitlab/middleware/multipart.rb:93:in `call'
# ./lib/gitlab/request_profiler/middleware.rb:14:in `call'
# ./lib/gitlab/middleware/go.rb:17:in `call'
# ./lib/gitlab/etag_caching/middleware.rb:11:in `call'
# ./lib/gitlab/request_context.rb:18:in `call'
# ./config/initializers/fix_local_cache_middleware.rb:9:in `call'
# ./lib/gitlab/middleware/static.rb:9:in `call'
# ./lib/gitlab/testing/request_blocker_middleware.rb:36:in `call'
# ./lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
# ------------------
# --- Caused by: ---
# ArgumentError:
# nil is not a valid asset source
# ./app/helpers/lazy_image_tag_helper.rb:12:in `image_tag'
I think the method itself should be refactored in upstream (gitlab-ce):
- Use one parameter (
lazy
) instead of two (lazy
andlazy_load
). - Don't call
avatar_icon
which goes to the database (in some cases) if we havelazy:true
. - Pass
lazy
parameter to theimage_tag
from thelink_to_member_avatar
.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend -
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12841
Edited by blackst0ne