Skip to content
Snippets Groups Projects

Add keyboard shortcut to move to file permalink `y`

Merged username-removed-892863 requested to merge 8082-permalink-to-file into master
1 unresolved thread

What does this MR do?

When viewing a file, pressing y will change the URL to a permalink that includes the full commit sha

http://localhost:3000/gitlab-org/gitlab-ce/blob/master/.eslintignore ->

http://localhost:3000/gitlab-org/gitlab-ce/blob/8ab94120ee0a87c7b1158ebafea101e3952ec758/.eslintignore


Previously, pressing y would copy the commit sha to the clipboard, 8ab94120ee0a87c7b1158ebafea101e3952ec758. This shortcut was not documented.

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #8082 (closed)

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
  • username-removed-892863 marked the task Branch has no merge conflicts with master (if it does - rebase it please) as completed

    marked the task Branch has no merge conflicts with master (if it does - rebase it please) as completed

  • added 1 commit

    • 00bbbce4 - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • added 1 commit

    • 7168b444 - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • username-removed-892863 marked the task Conform by the style guides as completed

    marked the task Conform by the style guides as completed

  • username-removed-892863 marked the task Added for this feature/bug as completed

    marked the task Added for this feature/bug as completed

  • Lots of test failures. Also if I try to view the file from a different commit I get an error.

  • added 1 commit

    • 6ee82dc4 - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • @iamphill Updated and builds passing. Still curious about this issue but it's ok to move through https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8799#note_22090530

  • username-removed-892863 resolved all discussions

    resolved all discussions

  • added 191 commits

    Compare with previous version

  • username-removed-892863 marked the task How do I get tree_join in scope for use in the rspec tests? (using it over File.join because that is what the haml uses) as completed

    marked the task How do I get tree_join in scope for use in the rspec tests? (using it over File.join because that is what the haml uses) as completed

  • Phil Hughes assigned to @alfredo1

    assigned to @alfredo1

  • @MadLittleMods a couple comments for you :thumbsup:

  • @MadLittleMods also, can you please get the ruby part to be reviewed by a backend endboss?

  • username-removed-892863 resolved all discussions

    resolved all discussions

  • added 498 commits

    Compare with previous version

  • username-removed-892863 marked the task All builds are passing as completed

    marked the task All builds are passing as completed

  • added 1 commit

    • 587059ee - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • @rspeicher Please review the ruby part. Just some tests and perhaps the haml

    Edited by username-removed-892863
  • Robert Speicher
  • Robert Speicher
  • Robert Speicher
  • 10 "http://#{page.server.host}:#{page.server.port}#{path}"
    11 end
    12
    13 def visit_blob(fragment = "")
    14 project.team << [user, :master]
    15 login_as user
    16 @path = project.repository.ls_files(project.repository.root_ref)[0]
    17 @sha = project.repository.commit.sha
    18 visit "#{namespace_project_blob_path(project.namespace, project, tree_join('master', @path))}#{"##{fragment}" unless fragment.empty?}"
    19 end
    20
    21 describe 'pressing "y"' do
    22 it 'redirects to permalink with commit sha' do
    23 visit_blob()
    24 find('body').native.send_key('y')
    25 expect(page).to have_current_path(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(@sha, @path))), url: true)
  • @MadLittleMods Couple notes, thanks!

  • added 1 commit

    • d757d931 - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • added 1 commit

    • ca3b9cae - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • added 1 commit

    • 53f9116a - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • Thanks for all the testing tips @rspeicher :grinning:

    get_absolute_url is still necessary to compare the full URL as page.current_path and page_current_url have issues, see https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8799#note_22872788

    Edited by username-removed-892863
  • username-removed-892863 assigned to @alfredo1

    assigned to @alfredo1

  • @alfredo1 Best to look at the JS again after the changes

  • added 1 commit

    • 0ac4f007 - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • added 1 commit

    • cff1f12a - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • username-removed-892863 assigned to @alfredo1

    assigned to @alfredo1

  • excellent @MadLittleMods LGTM! Is the ruby part ready?

  • @MadLittleMods @alfredo1 I found one more problem with the spec, but otherwise the Ruby LGTM.

  • @MadLittleMods Please remove the puts line and make sure builds passes then assign it to me. I think the previous build passed with warning if so you probably have to create a MR with this changes to EE.

    Edited by username-removed-408881
  • added 1 commit

    • 584b86da - Add keyboard shortcut to move to file permalink

    Compare with previous version

  • username-removed-892863 assigned to @alfredo1

    assigned to @alfredo1

  • @alfredo1 Do you have a chance today to get this in before the freeze?

  • mentioned in commit ff4950b7

  • changed milestone to %8.17

  • Please register or sign in to reply
    Loading