Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ export const reactionTypes: ReactionID[] = ['+1', '-1', 'laugh', 'hooray', 'conf

let owner: string;
let repo: string;
const branch = 'master';
let branch = 'master';

export function setRepoContext(context: { owner: string; repo: string; }) {
export function setRepoContext(context: { owner: string; repo: string; branch?: string; }) {
owner = context.owner;
repo = context.repo;
if (context.branch) {
branch = context.branch;
}
}

function githubRequest(relativeUrl: string, init?: RequestInit) {
Expand Down
3 changes: 2 additions & 1 deletion src/page-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function readPageAttributes() {
description: params.description,
label: params.label,
theme: params.theme || 'github-light',
session: params.session
session: params.session,
branch: params.branch || 'master'
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/utterances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async function renderComments(issue: Issue, timeline: TimelineComponent) {

export async function assertOrigin() {
const { origins } = await getRepoConfig();
const { origin, owner, repo } = page;
const { origin, owner, repo, branch } = page;
if (origins.indexOf(origin) !== -1) {
return;
}
Expand All @@ -147,7 +147,7 @@ export async function assertOrigin() {
<div class="flash flash-error flash-not-installed">
Error: <code>${origin}</code> is not permitted to post to <code>${owner}/${repo}</code>.
Confirm this is the correct repo for this site's comments. If you own this repo,
<a href="https://github.com/${owner}/${repo}/edit/master/utterances.json" target="_top">
<a href="https://github.com/${owner}/${repo}/edit/${branch}/utterances.json" target="_top">
<strong>update the utterances.json</strong>
</a>
to include <code>${origin}</code> in the list of origins.<br/><br/>
Expand Down