Skip to content

Commit

Permalink
add discussion links conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Jun 24, 2024
1 parent 59322c2 commit 8c05121
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion _plugins/jekyll-topic-filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def self.resolve_material(site, material)
'comments' => (wf_json['comments'] || []).length.positive?,
'parameters' => wf_json['steps'].map{|_, x| x['type']}.any?{|x| x == "parameter_input"},
},
'workflowhub_id' => site.data['workflowhub'][wfhkey],
'workflowhub_id' => (site.data['workflowhub'] || {}).fetch(wfhkey, nil),
'history' => git_log(wf_path),
'test_results' => workflow_test_outputs,
'modified' => File.mtime(wf_path),
Expand Down
21 changes: 14 additions & 7 deletions bin/wfh-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,14 @@ def doUpload(crate_path):
print(response.text)
return None

add_discussion_channel = False

wfid = response.json()['data']['id']
permissions_update = {
"data": {
"id": wfid,
"type": "workflows",
"attributes": {
# Adds duplicate links so, commented for now. No bug has been filed.
# "discussion_links": [
# {
# "label": "Matrix",
# "url": "https://matrix.to/#/%23galaxyproject_admin:gitter.im"
# }
# ],
"policy": {
"access": "download",
"permissions": [
Expand All @@ -64,6 +59,18 @@ def doUpload(crate_path):
}
}
}

if response.json()['data']['attributes']['discussion_links'] and not any(
x['label'] == 'GTN Matrix' for x in response.json()['data']['attributes']['discussion_links']
):
permissions_update['data']['attributes']['discussion_links'] = [
{
"label": "GTN Matrix",
"url": "https://matrix.to/#/%23galaxyproject_admin:gitter.im" # Must encode the second #
}
]


headers.update({
'Content-type': 'application/json',
'Accept': 'application/json',
Expand Down

0 comments on commit 8c05121

Please sign in to comment.