Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify do_action so default ctrl-click opens tab #20185

Merged
merged 2 commits into from
Apr 11, 2020

Conversation

azul
Copy link
Contributor

@azul azul commented Mar 26, 2020

Rebase and whitespace fix of #16530

New pull request to see if build succeeds.

@kesselb kesselb added 3. to review Waiting for reviews enhancement labels Mar 26, 2020
@kesselb kesselb added this to the Nextcloud 19 milestone Mar 26, 2020
@azul

This comment has been minimized.

apps/files/js/filelist.js Outdated Show resolved Hide resolved
@azul

This comment has been minimized.

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azul I commented in the issue to clarify: Yes, ctrl-click should be the "Open in new tab" action. :)

@rullzer rullzer mentioned this pull request Apr 4, 2020
80 tasks
@azul azul force-pushed the open-new_tab branch 2 times, most recently from c9dec70 to 0345ad0 Compare April 6, 2020 08:56
Comment on lines -207 to -210
var mime = this.fileActions.getCurrentMimeType();
var type = this.fileActions.getCurrentType();
var permissions = this.fileActions.getCurrentPermissions();
var action = this.fileActions.getDefault(mime, type, permissions);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none of these were used anywhere.

@azul
Copy link
Contributor Author

azul commented Apr 6, 2020

Somehow this seems to break the right click menu for me.

@azul
Copy link
Contributor Author

azul commented Apr 7, 2020

Failing tests seem to be the same as in master.
I am also not seeing the right click menu anymore in master. So i also think that is unrelated. Hope that's an actual change... never liked it anyway 😉
@juliushaertl @gary-kim I think this one is ready to be merged.

@gary-kim
Copy link
Member

gary-kim commented Apr 7, 2020

I am also not seeing the right click menu anymore in master.

The right click menu is added by the files_rightclick app. If you want to test it on current master with right click, you will need to add the app and enable it.

Copy link
Member

@gary-kim gary-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The action that occurs from clicking on files to download seems to be broken now. Could you take a look at that?

@azul
Copy link
Contributor Author

azul commented Apr 8, 2020

The right click menu is added by the files_rightclick app. If you want to test it on current master with right click, you will need to add the app and enable it.

Ahh.. got it. thanks! 😄

fileActions.getCurrentDefaultFileAction() returns the default file action
for the currently selected file.

There were a number of places querying for the mime, type and permissions
of that file first to then query for the default action.

Signed-off-by: Azul <azul@riseup.net>
@azul
Copy link
Contributor Author

azul commented Apr 8, 2020

The action that occurs from clicking on files to download seems to be broken now. Could you take a look at that?

Should be fixed.

This is getting close. I would like to add a test for the new urls to make sure they actually trigger the action. Will probably look into that tomorrow.

Copy link
Member

@gary-kim gary-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a couple more things.

  • Ctrl+click on a directory in a public share doesn't go into that directory and opens a new tab with the same page.
  • Ctrl+click on a file in a public share to be opened by the text app doesn't work as expected. This is more of an edge case though so I'd say it'd be okay to fix this in a follow up.

apps/files_sharing/js/public.js Outdated Show resolved Hide resolved
@azul
Copy link
Contributor Author

azul commented Apr 9, 2020

Found another issue...
If the file that the link points to has been moved from the folder it will trigger a download of the zipped folder content instead.

@jancborchardt what would the desired behavior be when:

  • I create MyFile.md.
  • I copy the link to MyFile.md in the folder (that is used to open it in another tab)
  • I move MyFile.md to another place
  • I click on the link.

I see a number of options:

  1. open the same file in the new folder (we can tell where it is by the file id)
  2. display a message that the file has been moved (maybe including the new place)
  3. only display the folder

I guess 2. would be the right thing to do. But maybe i am missing something.

tracking this here: #20394

@rullzer rullzer mentioned this pull request Apr 9, 2020
59 tasks
@azul

This comment has been minimized.

@azul

This comment has been minimized.

@azul
Copy link
Contributor Author

azul commented Apr 9, 2020

Noticed a couple more things.

* `Ctrl+click` on a directory in a public share doesn't go into that directory and opens a new tab with the same page.

* `Ctrl+click` on a file in a public share to be opened by the `text` app doesn't work as expected. This is more of an edge case though so I'd say it'd be okay to fix this in a follow up.

Okay... i figured it out and updated the pull request accordingly. The linkTo function in public.js had to be fixed.

In a file list files with a default action
have an href that will trigger the action.
This way ctrl-click and middle button click open the default action in a new tab.

In order to achieve this a new param `openfile` was introduced to the files app.
It will make the files app trigger the default action for the file in question.
This also allows linking to file content rather than just the details display.

Introduce fileList.getDefaultActionUrl()
to create a link with that param set.
It's overwritten in the trashbin fileList
so that anchors continue to have `#` as a href.

Fix the link generation for subfolders of public shares:
58a87d0 was the last commit that touched the linkTo function in public.js.
It included the params as arguments to the generateUrl function.
Turns out this completely ignores the dir parameter now.
The inclusion was reverted in other places
so revert it here as well.
Also change `dir` to `path` in the param as that is respected
when following the link.

Add Test for the new link url for files with default action.
Remove test for multiple selects with ctrl-click
as that is not what we are doing anymore.

Signed-off-by: Azul <azul@riseup.net>
@azul
Copy link
Contributor Author

azul commented Apr 9, 2020

I renamed the editfile parameter to openfile because depending on the permissions the file will also be shown read only if needed.

@gary-kim I would say this is ready to be merged. I'd be okay with adding more tests but i'd prefer to just see this included 😄 .

In terms of tests i think it would be nice to test that the generated urls actually do what they are supposed to. I really like that the generated url with openfile and path params on public shares work.

However i have no idea about how to write such a test. If you can point me to an example i'd also be happy to take it from there.

Copy link
Member

@gary-kim gary-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at this point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants