Skip to content

Commit

Permalink
read article id from parent as well (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek authored Apr 16, 2024
1 parent b4d5178 commit 7cc97f0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions client/app.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {registerExtensions} from 'newsroom-core/assets/index';
import {registerExtensions} from 'newsroom-core';
import {CopyEmbedCodeBanner} from './copy-embed-code-banner';

registerExtensions({
prepareWirePreview: (previewHtmlElement, article) => {

for (const embedBlockHtmlElement of previewHtmlElement.querySelectorAll('.embed-block')) {
const embeddedArticleId = embedBlockHtmlElement.getAttribute('data-association-key');
const embeddedArticleId = embedBlockHtmlElement.getAttribute('data-association-key') || embedBlockHtmlElement.parentElement?.getAttribute('data-association-key');

if (embeddedArticleId == null) {
continue;
Expand All @@ -18,7 +19,7 @@ registerExtensions({
continue;
}

const licenseName = (embeddedArticle.subject ?? []).find(({scheme}) => scheme === 'licence_type')?.name;
const licenseName = (embeddedArticle.subject ?? []).find(({scheme}) => scheme === 'licence_type')?.name ?? 'Creative Commons';

if (licenseName == null) {
continue;
Expand Down Expand Up @@ -47,6 +48,5 @@ registerExtensions({
}

return previewHtmlElement;

}
});
1 change: 1 addition & 0 deletions server/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ httmock
wooper
mypy
typing_extensions>=3.7.4
types-docutils
2 changes: 2 additions & 0 deletions server/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def before_all(context):
'NEWS_API_ENABLED': True,
'NEWS_API_TIME_LIMIT_DAYS': 100,
'NEWS_API_BEHAVE_TESTS': True,
'CACHE_TYPE': 'null',
}
setup_before_all(context, config, app_factory=get_app)

Expand All @@ -31,6 +32,7 @@ def before_scenario(context, scenario):
'NEWS_API_ENABLED': True,
'NEWS_API_TIME_LIMIT_DAYS': 100,
'NEWS_API_BEHAVE_TESTS': True,
'CACHE_TYPE': 'null',
}

if 'rate_limit' in scenario.tags:
Expand Down
2 changes: 1 addition & 1 deletion server/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ confcutdir = tests
addopts = --tb=short

[mypy]
python_version = 3.6
python_version = 3.8
allow_untyped_globals = True
ignore_missing_imports = True

0 comments on commit 7cc97f0

Please sign in to comment.