Skip to content

Add project directory system tests#5112

Open
Bubballoo3 wants to merge 15 commits intomasterfrom
pm-system-tests-4973
Open

Add project directory system tests#5112
Bubballoo3 wants to merge 15 commits intomasterfrom
pm-system-tests-4973

Conversation

@Bubballoo3
Copy link
Contributor

Fixes #4973 by adding system testing for project directory behavior. Includes testing of

  • private projects
  • public projects
  • resize behavior
  • file permissions behavior
  • downloads disabled behavior

The changes that had to be made to make these tests pass were

  • wrap filenames in links
  • read file permissions in view, instead of relying on file[:downloadable]
    • this mixed several checks on file permissions and downloads disabled, which lacked the granularity required for desired behavior
  • hide edit links when downloads are disabled (leaving no links displayed besides directory navigation)
  • hide all links on unreadable files and directories, serving spans instead
    • this mirrors the behavior in the Files app, but had not been implemented in the project directory

@Bubballoo3 Bubballoo3 force-pushed the pm-system-tests-4973 branch from 347c087 to cfe8698 Compare March 2, 2026 20:23
@Bubballoo3
Copy link
Contributor Author

Bubballoo3 commented Mar 2, 2026

Interestingly it seems like the files are displayed in a different order in the CI than on my local system. Coming back soon to fix this, but still open to review on the different test conditions (which will not change)

@Bubballoo3
Copy link
Contributor Author

Bubballoo3 commented Mar 2, 2026

That issue was fixed by adding a second sort parameter to the ls method in PosixFile and RemoteFile, which sorts alphabetically after separating files and directories. This was already the behavior I have seen on OSC, but not in the CI. Open to reversing this (and identifying table rows by content rather than position) if there are issues with this approach.

It should be noted that we rely on DataTables for sorting in the Files app, so the project directory is the only place where the system ordering impacts the final render

Reversed file mode changes to allow for easy deletion of the temporary directory
<% end %>
<% if writable %>
<li>
<%= link_to OodAppkit.editor.edit(path: full_path).to_s,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should allow edits if you can't download. That seems like an end-run around disabling downloads. That is, these files are still downloadable, all you have to do is open the editor then copy and paste.

Copy link
Contributor

@johrstrom johrstrom left a comment

Choose a reason for hiding this comment

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

I don't think we should allow edits if you can't download. That seems like an end-run around disabling downloads. That is, these files are still downloadable, all you have to do is open the editor then copy and paste which defeats the entire purpose of disabling downloads.

@github-project-automation github-project-automation bot moved this from Awaiting Review to Changes Requested in PR Review Pipeline Mar 19, 2026
@Bubballoo3
Copy link
Contributor Author

I don't think we should allow edits if you can't download

This is already the case for project directories, as the block you quote lies within this conditional

<%- elsif readable && file[:downloadable] -%>

And is tested by this line

assert_equal 0, file_row.all('a').length

After testing it looks like the normal files app still allows editing, so I have opened #5177 to handle this separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Changes Requested

Development

Successfully merging this pull request may close these issues.

Test project directory browser

3 participants