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

Don't use a default for yaml config files unless appropriate #1685

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 1.30.1

### Bug Fixes

- Don't use a default for yaml config files except .large_image_config.yaml ([#1685](../../pull/1685))

## 1.30.0

### Features
Expand Down
7 changes: 5 additions & 2 deletions girder/girder_large_image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,17 @@ def adjustConfigForUser(config, user):
return config


def addSettingsToConfig(config, user):
def addSettingsToConfig(config, user, name=None):
"""
Add the settings for showing thumbnails and images in item lists to a
config file if the itemList or itemListDialog options are not set.

:param config: the config dictionary to modify.
:param user: the current user.
:param name: the name of the config file.
"""
if name and name != '.large_image_config.yaml':
return
columns = []

showThumbnails = Setting().get(constants.PluginSettings.LARGE_IMAGE_SHOW_THUMBNAILS)
Expand Down Expand Up @@ -596,7 +599,7 @@ def yamlConfigFile(folder, name, user):
folder = Folder().load(folder['parentId'], user=user, level=AccessType.READ)

addConfig = {} if addConfig is None else addConfig
addSettingsToConfig(addConfig, user)
addSettingsToConfig(addConfig, user, name)
return addConfig


Expand Down
8 changes: 7 additions & 1 deletion girder/test_girder/test_large_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,17 @@ def testYAMLConfigFile(server, admin, user, fsAssetstore):
colFolderA, 'folder B', creator=admin)
groupA = Group().createGroup('Group A', admin)

resp = server.request(
path='/folder/%s/yaml_config/.large_image_config.yaml' % str(colFolderB['_id']),
method='GET')
assert utilities.respStatus(resp) == 200
assert resp.json.get('itemList') is not None

resp = server.request(
path='/folder/%s/yaml_config/sample.json' % str(colFolderB['_id']),
method='GET')
assert utilities.respStatus(resp) == 200
assert resp.json['itemList'] is not None
assert resp.json.get('itemList') is None

colFolderConfig = Folder().createFolder(
collection, '.config', parentType='collection',
Expand Down