Add context-menu to report claims directly from Preview/Tile

This commit is contained in:
infiinte-persistence 2021-02-17 14:50:43 +08:00 committed by Sean Yesmunt
parent 2f7880a697
commit b0cc1d7f51

View file

@ -1,4 +1,4 @@
import { clipboard, remote } from 'electron'; import { clipboard, remote, shell } from 'electron';
import { convertToShareLink } from 'lbry-redux'; import { convertToShareLink } from 'lbry-redux';
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';
@ -111,12 +111,23 @@ export function openClaimPreviewMenu(claim, event) {
if (claim) { if (claim) {
const shareLink = convertToShareLink(claim.canonical_url || claim.permanent_url); const shareLink = convertToShareLink(claim.canonical_url || claim.permanent_url);
const claimId = claim.claim_id;
templates.push({ templates.push({
label: 'Copy link', label: 'Copy link',
click: () => { click: () => {
clipboard.writeText(shareLink); clipboard.writeText(shareLink);
}, },
}); });
templates.push({ type: 'separator' });
templates.push({
label: 'Report content',
click: () => {
shell.openExternal(`https://lbry.com/dmca/${claimId}`);
},
});
} }
injectDevelopmentTemplate(event, templates); injectDevelopmentTemplate(event, templates);