Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions packages/decap-cms-core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ declare module 'decap-cms-core' {
allowed_hosts?: string[];
}

export interface CmsIssueReports {
url?: string;
}

export interface CmsConfig {
backend: CmsBackend;
collections: CmsCollection[];
Expand All @@ -403,6 +407,7 @@ declare module 'decap-cms-core' {
media_folder_relative?: boolean;
media_library?: CmsMediaLibrary;
publish_mode?: CmsPublishMode;
issue_reports?: CmsIssueReports;
load_config_file?: boolean;
integrations?: {
hooks: string[];
Expand Down
7 changes: 4 additions & 3 deletions packages/decap-cms-core/src/components/UI/ErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import copyToClipboard from 'copy-text-to-clipboard';
import { localForage } from 'decap-cms-lib-util';
import { buttons, colors } from 'decap-cms-ui-default';

const ISSUE_URL = 'https://github.com/decaporg/decap-cms/issues/new?';
const ISSUE_URL = 'https://github.com/decaporg/decap-cms/issues/new';

function getIssueTemplate({ version, provider, browser, config }) {
return `
Expand Down Expand Up @@ -52,6 +52,7 @@ function buildIssueTemplate({ config }) {
}

function buildIssueUrl({ title, config }) {
const issueUrl = config?.issue_reports?.url ?? ISSUE_URL;
try {
const body = buildIssueTemplate({ config });

Expand All @@ -60,10 +61,10 @@ function buildIssueUrl({ title, config }) {
params.append('body', truncate(body, { length: 4000, omission: '\n...' }));
params.append('labels', 'type: bug');

return `${ISSUE_URL}${params.toString()}`;
return `${issueUrl}?${params.toString()}`;
} catch (e) {
console.log(e);
return `${ISSUE_URL}template=bug_report.md`;
return `${issueUrl}?template=bug_report.md`;
}
}

Expand Down
6 changes: 6 additions & 0 deletions packages/decap-cms-core/src/constants/configSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ function getConfigSchema() {
clean_accents: { type: 'boolean' },
},
},
issue_reports: {
type: 'object',
properties: {
url: { type: 'string', examples: ['https://example.com/report-issue'] },
}
},
collections: {
type: 'array',
minItems: 1,
Expand Down
5 changes: 5 additions & 0 deletions packages/decap-cms-core/src/types/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ export interface CmsLocalBackend {
allowed_hosts?: string[];
}

export interface CmsIssueReports {
url?: string;
}

export interface CmsConfig {
backend: CmsBackend;
collections: CmsCollection[];
Expand Down Expand Up @@ -427,6 +431,7 @@ export interface CmsConfig {
}[];
slug?: CmsSlug;
i18n?: CmsI18nConfig;
issue_reports?: CmsIssueReports;
local_backend?: boolean | CmsLocalBackend;
editor?: {
preview?: boolean;
Expand Down
Loading