diff --git a/airlock/file_browser_api.py b/airlock/file_browser_api.py
index 4d9c91fb..8f8ec96c 100644
--- a/airlock/file_browser_api.py
+++ b/airlock/file_browser_api.py
@@ -190,9 +190,6 @@ def is_withdrawn(self):
def is_valid(self):
return is_valid_file_type(Path(self.relpath))
- def is_updated(self):
- return self.workspace_status == WorkspaceFileStatus.CONTENT_UPDATED
-
def html_classes(self):
"""Semantic html classes for this PathItem.
diff --git a/airlock/templates/file_browser/_includes/directory_table/workspace.html b/airlock/templates/file_browser/_includes/directory_table/workspace.html
index 28105c34..60961c76 100644
--- a/airlock/templates/file_browser/_includes/directory_table/workspace.html
+++ b/airlock/templates/file_browser/_includes/directory_table/workspace.html
@@ -31,7 +31,7 @@
{{ path.modified_at|date:"Y-m-d H:i" }} |
{% if workspace.is_active and multiselect_add %}
- {% if not path.is_directory and not path.is_updated %}
+ {% if not path.is_directory %}
{% form_checkbox name="selected" value=path.relpath custom_field=True %}
{% endif %}
|
diff --git a/airlock/templates/file_browser/directory.html b/airlock/templates/file_browser/directory.html
index d6257fa3..d3388378 100644
--- a/airlock/templates/file_browser/directory.html
+++ b/airlock/templates/file_browser/directory.html
@@ -26,7 +26,12 @@
{% if multiselect_add %}
- {% #button type="submit" name="action" value="add_files" variant="success" form="multiselect_form"%}Add Files to Request{% /button %}
+ {% #button type="submit" name="action" value="add_files" variant="success" form="multiselect_form"%}
+ Add Files to Request
+ {% /button %}
+ {% #button type="submit" name="action" value="update_files" variant="success" form="multiselect_form"%}
+ Update Files in Request
+ {% /button %}
diff --git a/airlock/views/workspace.py b/airlock/views/workspace.py
index b74ae803..6c7c246f 100644
--- a/airlock/views/workspace.py
+++ b/airlock/views/workspace.py
@@ -217,8 +217,6 @@ def multiselect_add_files(request, multiform, workspace):
state = workspace.get_workspace_file_status(relpath)
if policies.can_add_file_to_request(workspace, relpath):
files_to_add.append(f)
- elif state == WorkspaceFileStatus.CONTENT_UPDATED:
- files_ignored[f] = "cannot update using the add dialogue"
elif state == WorkspaceFileStatus.RELEASED:
files_ignored[f] = "already released"
else:
diff --git a/tests/functional/test_e2e.py b/tests/functional/test_e2e.py
index 2a45440e..2a8ef1ee 100644
--- a/tests/functional/test_e2e.py
+++ b/tests/functional/test_e2e.py
@@ -1,5 +1,6 @@
import re
+import pytest
from playwright.sync_api import expect
from airlock.business_logic import bll
@@ -454,7 +455,11 @@ def test_e2e_release_files(
expect(page.locator("body")).not_to_contain_text("test-workspace by researcher")
-def test_e2e_update_file(page, live_server, dev_users):
+@pytest.mark.parametrize(
+ "multiselect",
+ [True, False],
+)
+def test_e2e_update_file(page, live_server, dev_users, multiselect):
"""
Test researcher updates a modified file in a returned request
"""
@@ -471,20 +476,26 @@ def test_e2e_update_file(page, live_server, dev_users):
],
)
- # change the file on disk
+ # Log in as researcher
+ login_as(live_server, page, "researcher")
+
workspace = bll.get_workspace("test-workspace", author)
+
+ # change the file on disk
factories.write_workspace_file(workspace, path, contents="changed")
- # Log in as researcher
- login_as(live_server, page, "researcher")
+ if multiselect:
+ page.goto(live_server.url + workspace.get_url("subdir/"))
- page.goto(live_server.url + workspace.get_url("subdir/file.txt"))
+ # click on the multi-select checkbox
+ find_and_click(page.locator('input[name="selected"]'))
+ else:
+ page.goto(live_server.url + workspace.get_url("subdir/file.txt"))
- # Update file in request
# Find the add file button and click on it to open the modal
find_and_click(page.locator("button[value=update_files]"))
- # Click the button to add the file to a release request
+ # Click the button to update the file in the release request
find_and_click(page.get_by_role("form").locator("#update-file-button"))
expect(page.locator("body")).to_contain_text("file has been updated in request")
diff --git a/tests/integration/views/test_workspace.py b/tests/integration/views/test_workspace.py
index 22aca44c..ef86bde3 100644
--- a/tests/integration/views/test_workspace.py
+++ b/tests/integration/views/test_workspace.py
@@ -637,8 +637,7 @@ def test_workspace_multiselect_add_files_updated_file(airlock_client, bll):
assert response.status_code == 200
assert "test/path1.txt" in response.rendered_content
assert "test/path2.txt" in response.rendered_content
- assert response.rendered_content.count("cannot update using the add dialogue") == 1
- assert response.rendered_content.count("already in group") == 1
+ assert response.rendered_content.count("already in group") == 2
assert 'name="filegroup"' not in response.rendered_content