-
Notifications
You must be signed in to change notification settings - Fork 272
/
Copy pathlinks.ts
58 lines (48 loc) · 1.76 KB
/
links.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { Account, Hostname, Link } from '../types';
import type { Notification, SubjectUser } from '../typesGitHub';
import { getDeveloperSettingsURL } from './auth/utils';
import { openExternalLink } from './comms';
import { Constants } from './constants';
import { generateGitHubWebUrl } from './helpers';
export function openGitifyReleaseNotes(version: string) {
openExternalLink(
`https://github.com/${Constants.REPO_SLUG}/releases/tag/${version}` as Link,
);
}
export function openGitHubNotifications(hostname: Hostname) {
const url = new URL(`https://${hostname}`);
url.pathname = 'notifications';
openExternalLink(url.toString() as Link);
}
export function openGitHubIssues(hostname: Hostname) {
const url = new URL(`https://${hostname}`);
url.pathname = 'issues';
openExternalLink(url.toString() as Link);
}
export function openGitHubPulls(hostname: Hostname) {
const url = new URL(`https://${hostname}`);
url.pathname = 'pulls';
openExternalLink(url.toString() as Link);
}
export function openAccountProfile(account: Account) {
const url = new URL(`https://${account.hostname}`);
url.pathname = account.user.login;
openExternalLink(url.toString() as Link);
}
export function openUserProfile(user: SubjectUser) {
openExternalLink(user.html_url);
}
export function openHost(hostname: Hostname) {
openExternalLink(`https://${hostname}` as Link);
}
export function openDeveloperSettings(account: Account) {
const url = getDeveloperSettingsURL(account);
openExternalLink(url);
}
export async function openNotification(notification: Notification) {
const url = await generateGitHubWebUrl(notification);
openExternalLink(url);
}
export function openGitHubParticipatingDocs() {
openExternalLink(Constants.GITHUB_DOCS.PARTICIPATING_URL);
}