Skip to content
Snippets Groups Projects

Consolidate user avatar Vue logic

Merged username-removed-408230 requested to merge user-avatar-vue-ce into master
All threads resolved!

Creates 3 vue components:

  1. user-avatar-link
  2. user-avatar-image
  3. user-avatar-svg

and implements them in several places.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/31017

  • Port to EE
  • Test each implementation manually

EE Compatible Branch: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1699

Edited by username-removed-408230

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    • 6bf2f716 - Remove unneccessary tooltip config.

    Compare with previous version

  • added 1 commit

    • 85fad850 - Remove unneccessary tooltip config.

    Compare with previous version

  • added 1 commit

    • 95aae840 - Remove unneeded title prop.

    Compare with previous version

  • added 1 commit

    • 95aae840 - Remove unneeded title prop.

    Compare with previous version

  • added 3 commits

    • f56c4fba - Backport link_to_member_avatar_spec.
    • e5425709 - Upgrade spec for user avatar link.
    • 25ec7f56 - Finish user avatar image spec.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 336 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • e8cd6892 - Revert changes to diff_notes_avatar temporarily.

    Compare with previous version

  • added 1 commit

    • 3591c5b1 - Resolve conflicts with diff_notes_avatar.

    Compare with previous version

  • added 1 commit

    • b51c3318 - Rever small spacing changes.

    Compare with previous version

  • added 141 commits

    Compare with previous version

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 1 commit

    Compare with previous version

  • username-removed-408230 unmarked as a Work In Progress

    unmarked as a Work In Progress

  • @alfredo1 accidentally asked you to review this -- it's not ready, so just disregard :see_no_evil:

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 1d653448 - User double quotes in user_avatar_link.js template.

    Compare with previous version

  • added 1 commit

    • b09d5956 - Use double quotes in user_avatar_image_spec.js template.

    Compare with previous version

  • added 1 commit

    • 9baef22a - Standardize double quotes and component closing brackets.

    Compare with previous version

  • added 1 commit

    • 3f835cf2 - Fix text decoration on user-avatar-link.

    Compare with previous version

  • added 1 commit

    • fcb8e046 - Fix diff_note_avatars import of UserAvatarImage.

    Compare with previous version

  • @ClemMakesApps can you review?

  • added 1 commit

    • 2efc81df - Fix user avatar per review.

    Compare with previous version

  • added 1 commit

    • 213a7227 - Fix/combine avatar css selectors.

    Compare with previous version

  • mentioned in issue #31408 (moved)

  • added 2 commits

    • ea358479 - Add comments where alt attrs need adding.
    • e028766f - Use lowercase for userAvatarImage specs.

    Compare with previous version

  • added 1 commit

    • 6f101892 - Set default_avatar when src and svg are falsey.

    Compare with previous version

  • added 2 commits

    • 18587eeb - Use HTML comments, not JS.
    • b5adc11e - Move tooltip text setting into method.

    Compare with previous version

  • added 1 commit

    • 03d92554 - Add imgSourceWithFallback computed.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • @brycepj left some comments :)

  • Vue code should be reviewed by one of the vue experts

    @filipa is there a list somewhere of who this is? I assumed all frontenders are vue experts?

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 071e1c14 - Remove duplicated user avatar link in environment item.

    Compare with previous version

  • @brycepj do we have an ETA for this? :blush:

    It will be needed in order to conclude this https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10987 :)

  • @filipa yeah, sorry, I've been mostly offline the last two days. I believe there are only a few small changes left, so hopefully it'll be ready this coming Monday.

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 2 commits

    • 1bd026e4 - Fix up link spec like image spec.
    • 38519f4a - Destroy tooltip on update to tooltipText.

    Compare with previous version

  • added 1 commit

    • b0298070 - Switch span for template tag wrapping svg.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • c9b8e004 - Remove unneeded image styles.

    Compare with previous version

  • username-removed-408230 marked the checklist item Test SVG rendering in image component as completed

    marked the checklist item Test SVG rendering in image component as completed

  • added 2 commits

    • ce010a40 - Test rendering of computed values on user avatar image.
    • 7b0cc817 - Stub out svg and other rendering specs.

    Compare with previous version

  • @filipa I made most of the changes you asked for but didn't finish, so don't review yet.

  • added 2 commits

    • 35e13c2f - Begin simpler component spec mounting.
    • b8c120e1 - Get tests passing.

    Compare with previous version

  • username-removed-408230 marked the checklist item Mount plain components in specs as completed

    marked the checklist item Mount plain components in specs as completed

  • username-removed-408230 marked the checklist item Get tests passing as completed

    marked the checklist item Get tests passing as completed

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 336 commits

    Compare with previous version

  • @ClemMakesApps @filipa Okay, all discussions resolved. I think this is ready for a final review.

    One other thing: user-avatar-link replaces link-to-member-avatar, which was only in EE. If this gets merged before the MR widget does (it will), there will be several new conflicts to resolve as part of the MR widget.

    Would you object to me opening an issue to implement user-avatar-link in EE once the MR widget has been merged?

    Edited by username-removed-408230
  • added 1 commit

    • 3ef682f8 - Pass correct props in diff note avatar.

    Compare with previous version

  • added 2 commits

    • b6d18ec6 - Properly compute styles for image element.
    • 7b7aa099 - Listen for native click event in diff notes avatar.

    Compare with previous version

  • I'll defer to @filipa on a decision about that

  • @brycepj no sorry needed! The MR I was talking about won't get in for %9.2 so no worries :smile:

    Regarding your question, I would rather make it equal from the beginning. I am afraid we'll forget it and have 2 different ways of doing it, but I understand this will be painful for @fatihacet.

    Let's wait for @fatihacet and leave the decision up to him :blush:

  • @brycepj when it's ready to review, please assign back to me :smiley_cat:

  • @filipa If this isn't needed until 9.3, I think it makes sense to just wait for the MR widget and keep the parity between EE and CE. :thumbsup:

  • added 939 commits

    • 7b7aa099...3a983b10 - 935 commits from branch master
    • c8add1b7 - Consolidate user avatar Vue logic
    • 1c809ead - Pass correct props in diff note avatar.
    • 3a2800af - Properly compute styles for image element.
    • b071291d - Listen for native click event in diff notes avatar.

    Compare with previous version

  • added 1 commit

    • 763be10a - Add tooltipPlacement to specs.

    Compare with previous version

  • added 3 commits

    Compare with previous version

  • added 1 commit

    • a3b6dc3e - Check image for title attribute instead of link.

    Compare with previous version

  • added 1 commit

    • fa1d0930 - Pass bottom string, not dynamic attr.

    Compare with previous version

  • added 2 commits

    • a3eb3566 - Split up svg and img into separate components in user-avatar-image.
    • e8214d9d - Split up svg and img into separate components in user-avatar-image.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • debf9a76 - Add specs for svg and mixin, get all passing.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • username-removed-408230 marked the checklist item Move SVG and Image into separate components as completed

    marked the checklist item Move SVG and Image into separate components as completed

  • username-removed-408230 marked the checklist item Update tests according to split as completed

    marked the checklist item Update tests according to split as completed

  • username-removed-408230 marked the checklist item Break out mixin and add tests as completed

    marked the checklist item Break out mixin and add tests as completed

  • added 1 commit

    • dadeef78 - Break link attrs onto newline.

    Compare with previous version

  • added 45 commits

    Compare with previous version

  • @brycepj

    Couple of notes:

    • Why is the user avatar an SVG? The output rendered is always an <img />
    • Please follow the documentation and use .vue files
    • Please follow the documentation on importing methods
    • Please follow the documentation on props that are not required, they need a default value
    Edited by Filipa Lacerda
  • Filipa Lacerda
  • added 1 commit

    Compare with previous version

  • Filipa Lacerda
  • Filipa Lacerda
  • @brycepj link_to_member_avatar in app/helpers/projects_helper.rb renders a default avatar if none is available. I think we need to keep that logic in the vue component

  • Filipa Lacerda mentioned in merge request !11302 (closed)

    mentioned in merge request !11302 (closed)

  • One more TODO: use .vue files

    edit: Done 4cebbf60

    Edited by username-removed-408230
  • added 1 commit

    • ae47c446 - Use object shorthand and camelcase in componentn naming.

    Compare with previous version

  • added 1 commit

    • ac60ef53 - Remove v-if from user avatar svg.

    Compare with previous version

  • added 1 commit

    • 56f290ef - Import default avatar locally.

    Compare with previous version

  • added 1 commit

    • 4cebbf60 - Move components into .vue files.

    Compare with previous version

  • added 1 commit

    • 129175ee - Update import refs to .vue files.

    Compare with previous version

  • added 1 commit

    • 6ab02da8 - For user avatar image, src -> img-src.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 2 commits

    • 8d8579c8 - Add default alt tag for user avatar image.
    • 44e0bd9c - Make tooltip placement evaluation static.

    Compare with previous version

  • added 1 commit

    • 63f0b804 - Fix refs to user_avatar_svg.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 52b00717 - Update user_avatar_image.vue

    Compare with previous version

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 1 commit

    • 84a770af - Update user_avatar_link.vue

    Compare with previous version

  • added 2 commits

    • 47a1e9f2 - Set defaults for non-required user-avatar-link props.
    • e77bbffd - Merge branch 'user-avatar-vue-ce' of gitlab.com:gitlab-org/gitlab-ce into user-avatar-vue-ce

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 1 commit

    • 5ee02502 - Add spec for avatarSizeStylesMapString computed value.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • a5ec53b2 - Return style map not stringified.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

    • Resolved by username-removed-408230

      @filipa An interesting side effect of TooltipMixin is that we can't test against the title attribute in our specs when it's used. That's because when we initialize the tooltip on mount, bootstrap reads from the title attribute, sets data-original-title, and then sets the title attribute to an empty string. Before, we didn't initialize the tooltip until hovering over it, so we could expect that the title attribute was still set to the tooltip's text.

      I found this when adding the mixin broke several specs that test for the title attribute of a user avatar.

      So, somewhat ironically, although the TooltipMixin allows us to not use data-original-title, I think it may require us to use it in our specs.

      As of now, I've changed the specs to test for data-original-title, and they pass. But we could also just remove the use of TooltipMixin and return to using the watcher I had earlier. Or maybe you know a better way? WDYT?

      Edited by username-removed-408230
  • added 1 commit

    Compare with previous version

  • added 99 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • @brycepj left some comments!

  • assigned to @brycepj

  • added 4 commits

    • 088af438 - Don't evaluate prop expressions where you don't need to.
    • 2c420fae - Remove tooltip class computed.
    • fe468e1b - Rename href prop to link-href.
    • 2887bdb6 - Assume this.size is always truthy in mixin.

    Compare with previous version

  • added 66 commits

    • 2887bdb6...75807f2a - 60 commits from branch master
    • 2c1a6c30 - Consolidate user avatar Vue logic
    • 30856c5c - Fixup karma specs.
    • 82b70a57 - Don't evaluate prop expressions where you don't need to.
    • 7ed09650 - Remove tooltip class computed.
    • 2eab5bcb - Rename href prop to link-href.
    • 9c8c64b8 - Assume this.size is always truthy in mixin.

    Compare with previous version

  • Filipa Lacerda mentioned in merge request !11340 (merged)

    mentioned in merge request !11340 (merged)

  • added 1 commit

    • 886182c9 - Set default tooltipPlacement to top.

    Compare with previous version

  • added 1 commit

    • 58e4060d - Test that props are included in rendered output.

    Compare with previous version

  • added 1 commit

    • 0af5a4f7 - Fixup user_avatar_image_spec, ensure rendered output is tested.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 15a5005c - Fix svg spec element selection.

    Compare with previous version

  • added 1 commit

    • 75a1e450 - Fix img size prop declarations.

    Compare with previous version

  • added 2 commits

    • 5f4ee208 - Add comments for re-usable vue components.
    • 3cdddbff - Workaround phantom element issue with path check.

    Compare with previous version

  • added 1 commit

    • 8015d65b - Fix spacing on webpack.config.js

    Compare with previous version

  • added 1 commit

    • baf20e04 - Workaround issues using querySelector with svg element.

    Compare with previous version

  • added 1 commit

    • 30fd40bb - Fix issue-card-inner specs.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 969ca5b9 - Set byte limit for loaded images to 2048.

    Compare with previous version

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 140 commits

    Compare with previous version

  • username-removed-408230 marked the checklist item Port to EE as completed

    marked the checklist item Port to EE as completed

  • username-removed-408230 marked the checklist item Test each implementation manually as completed

    marked the checklist item Test each implementation manually as completed

  • @filipa build's passing here. EE branch's build is running, but I've tested the changes manually, so I don't anticipate any failures. I think we're ready to go :rocket:

  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • Filipa Lacerda
  • Thank you @brycepj! Left some comments!

  • @iamphill can you please take over? Thanks!

  • Phil Hughes
  • assigned to @brycepj

  • assigned to @brycepj

  • added 1 commit

    • ba59fc68 - Fixes per feedback from iamphill.

    Compare with previous version

  • added 1 commit

    • 5858535f - Fixes per feedback from iamphill.

    Compare with previous version

  • added 1 commit

    • fa89aa02 - Use DOM methods for testing user_avatar_link.

    Compare with previous version

  • The other changes look good :thumbsup:

  • assigned to @brycepj

  • added 1 commit

    • dcfc9ff3 - Fix classList check for phantom.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 158 commits

    Compare with previous version

  • username-removed-408230 changed the description

    changed the description

  • added 1 commit

    • 21f85d38 - Check for tagname of root element.

    Compare with previous version

  • mentioned in issue #28003 (moved)

  • username-removed-408230 resolved all discussions

    resolved all discussions

  • added 1 commit

    Compare with previous version

  • added 94 commits

    Compare with previous version

  • added 1 commit

    • 55737682 - Add s selectors for supported avatars.

    Compare with previous version

  • @iamphill Discussions resolved and we're :green_apple: here and on the EE compatible branch. Let me know if there's anything else.

  • Phil Hughes approved this merge request

    approved this merge request

  • merged

  • Phil Hughes mentioned in commit b0642299

    mentioned in commit b0642299

  • Please register or sign in to reply
    Loading