diff --git a/src/core/github.js b/src/core/github.js index 62afa9b4ab..d7b7256bf0 100644 --- a/src/core/github.js +++ b/src/core/github.js @@ -153,6 +153,9 @@ export async function run(conf) { repoURL: ghURL.href, apiBase: githubAPI, fullName: `${org}/${repo}`, + issuesURL: issueBase, + pullsURL: newProps.pullBase, + newIssuesURL: new URL("./new/choose", issueBase).href, commitHistoryURL: commitHistoryURL.href, }; resolveGithubPromise(normalizedGHObj); diff --git a/src/w3c/templates/headers.js b/src/w3c/templates/headers.js index b0d742458a..d667a9ee39 100644 --- a/src/w3c/templates/headers.js +++ b/src/w3c/templates/headers.js @@ -241,6 +241,7 @@ export default (conf, options) => { ${showPeople(conf, "authors")} ` : ""} + ${renderFeedback(conf)} ${conf.otherLinks ? conf.otherLinks.map(showLink) : ""} @@ -274,6 +275,58 @@ export default (conf, options) => { `; }; +function renderFeedback(conf) { + if (!conf.github && !conf.wgPublicList) return; + const definitions = []; + + // Github feedback... + if (conf.github) { + const { repoURL, issuesURL, newIssuesURL, pullsURL, fullName } = + conf.github; + definitions.push( + html`
+ GitHub ${fullName} + (pull requests, + new issue, + open issues) +
` + ); + } + + // The link for the public list + if (conf.wgPublicList) { + const mailToURL = new URL(`mailto:${conf.wgPublicList}@w3.org`); + const subject = + conf.subjectPrefix ?? `[${conf.shortName}] ${l10n.your_topic_here}`; + const mailingListLink = html`${mailToURL.pathname}`; + + // The subject line... + const subjectLine = + conf.subjectPrefix || + html`[${conf.shortName}] ${l10n.message_topic}`; + const emailSubject = html`${l10n.with_subject_line}${" "} + ${subjectLine}`; + + // Archives link + const archiveURL = new URL( + conf.wgPublicList, + "https://lists.w3.org/Archives/Public/" + ); + const archiveLink = html`(${l10n.archives})`; + + definitions.push( + html`
${mailingListLink} ${emailSubject} ${archiveLink}
` + ); + } + return html`
${l10n.feedback}
+ ${definitions}`; +} + function renderHistory(conf) { if (!conf.historyURI && !conf.github) return; const ddElements = []; diff --git a/tests/spec/w3c/headers-spec.js b/tests/spec/w3c/headers-spec.js index d363ebc9c7..b1c1ad9fc8 100644 --- a/tests/spec/w3c/headers-spec.js +++ b/tests/spec/w3c/headers-spec.js @@ -2252,6 +2252,54 @@ describe("W3C — Headers", () => { }); }); + describe("Feedback", () => { + it("includes a Feedback: with a
to github issues", async () => { + const doc = await makeRSDoc( + makeStandardOps({ github: "w3c/respec", specStatus: "WD" }) + ); + const [dt] = contains(doc, ".head dt", "Feedback:"); + const dd = dt.nextElementSibling; + expect(dd.querySelector("a[href^='https://github.com/']")).toBeTruthy(); + }); + + it("includes links for to new issue, pull requests, open issues", async () => { + const doc = await makeRSDoc(makeStandardOps({ github: "w3c/respec" })); + const [prLink] = contains( + doc, + ".head a[href='https://github.com/w3c/respec/pulls/']", + "pull requests" + ); + expect(prLink).toBeTruthy(); + const [openIssue] = contains( + doc, + ".head a[href='https://github.com/w3c/respec/issues/']", + "open issues" + ); + expect(openIssue).toBeTruthy(); + const [newIssue] = contains( + doc, + ".head a[href='https://github.com/w3c/respec/issues/new/choose']", + "new issue" + ); + expect(newIssue).toBeTruthy(); + }); + + it("includes a Feedback: with a
for mailing list, when mailing list is supplied", async () => { + const opts = makeStandardOps({ + wgPublicList: "public-webapps", + }); + const doc = await makeRSDoc(opts); + const [dd] = contains(doc, ".head dd", "public-webapps@w3.org"); + + // Check the archive link + const archive = dd.querySelector( + "a[rel='discussion'][href^='https://lists.w3.org/']" + ); + expect(archive).toBeTruthy(); + expect(archive.textContent.trim()).toBe("archives"); + }); + }); + describe("History", () => { it("shows the publication history of the spec", async () => { const ops = makeStandardOps({ shortName: "test", specStatus: "WD" });