Skip to content

Commit 52318fe

Browse files
authored
fix: Broken social icons and handmade detection (#237)
* fix: Broken social icons and handmade detection * chore: Changelog
1 parent a0ef7f0 commit 52318fe

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "c2pa-wc",
5+
"comment": "Fix broken social display and handmade detection",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "c2pa-wc"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "c2pa",
5+
"comment": "Fix handmade detection",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "c2pa"
10+
}

packages/c2pa-wc/src/components/ManifestSummaryV2/ManifestSummaryV2.stories.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default {
4242

4343
const Base: Story<ArgTypes> = ({ manifestStore, inspectUrl }: ArgTypes) => {
4444
return html`<cai-manifest-summary-v2
45+
style="width: 300px;"
4546
.manifestStore=${manifestStore}
4647
.inspectUrl=${inspectUrl}
4748
></cai-manifest-summary-v2>`;

packages/c2pa-wc/src/getManifestSummaryData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function getManifestSummaryData(
6969
function getSocialAccounts(manifest: Manifest): SocialAccount[] {
7070
const cwSocialAccounts: SocialAccount[] =
7171
selectSocialAccounts(manifest)?.map((socialAccount) => ({
72-
provider: socialAccount['@type'],
72+
provider: socialAccount['@id'] ?? '',
7373
url: socialAccount['@id'] ?? null,
7474
username: socialAccount.name,
7575
verified: false,

packages/c2pa/src/selectors/isHandmade.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import { Manifest } from '../manifest';
1111
import { ManifestStore } from '../manifestStore';
1212

1313
export function isHandmade(manifestStore: ManifestStore): boolean {
14-
const manifests = manifestStore.manifests;
15-
16-
return Object.values(manifests).every(isHandmadeManifest);
14+
const manifests = Object.values(manifestStore.manifests);
15+
return manifests.length > 0 && manifests.every(isHandmadeManifest);
1716
}
1817

1918
function isHandmadeManifest(manifest: Manifest): boolean {
@@ -28,16 +27,18 @@ function isHandmadeManifest(manifest: Manifest): boolean {
2827
return false;
2928
}
3029

31-
const actionsHandmade = actionsV2.every(({ data }) => {
32-
const handmadeTemplate = !!data.templates.find(
33-
(template) =>
34-
template.action === '*' &&
35-
template.digitalSourceType ===
36-
'http://cv.iptc.org/newscodes/digitalsourcetype/humanEdits',
37-
);
38-
39-
return data.allActionsIncluded && handmadeTemplate;
40-
});
30+
const actionsHandmade =
31+
actionsV2.length > 0 &&
32+
actionsV2.every(({ data }) => {
33+
const handmadeTemplate = !!data.templates.find(
34+
(template) =>
35+
template.action === '*' &&
36+
template.digitalSourceType ===
37+
'http://cv.iptc.org/newscodes/digitalsourcetype/humanEdits',
38+
);
39+
40+
return data.allActionsIncluded && handmadeTemplate;
41+
});
4142

4243
return actionsHandmade;
4344
}

0 commit comments

Comments
 (0)