mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
Wip changes to FormatUti
This commit is contained in:
parent
102ec47fb8
commit
e59b51084c
@ -1,16 +1,15 @@
|
|||||||
import { Octokit } from '@octokit/rest';
|
import { UserNotification } from "./UserNotificationWatcher";
|
||||||
import { UserNotification } from './UserNotificationWatcher';
|
|
||||||
import markdown from "markdown-it";
|
import markdown from "markdown-it";
|
||||||
|
|
||||||
const md = new markdown();
|
const md = new markdown();
|
||||||
|
|
||||||
export class FormatUtil {
|
export class FormatUtil {
|
||||||
public static formatName(issue: Octokit.IssuesGetResponse) {
|
public static formatRoomName(issue: {number: number, title: string, repository_url: string}) {
|
||||||
const orgRepoName = issue.repository_url.substr("https://api.github.com/repos/".length);
|
const orgRepoName = issue.repository_url.substr("https://api.github.com/repos/".length);
|
||||||
return `${orgRepoName}#${issue.number}: ${issue.title}`;
|
return `${orgRepoName}#${issue.number}: ${issue.title}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static formatTopic(issue: Octokit.IssuesGetResponse) {
|
public static formatRoomTopic(issue: {state: string, title: string, html_url: string}) {
|
||||||
return `${issue.title} | Status: ${issue.state} | ${issue.html_url}`;
|
return `${issue.title} | Status: ${issue.state} | ${issue.html_url}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,11 +25,28 @@ export class FormatUtil {
|
|||||||
return {
|
return {
|
||||||
plain,
|
plain,
|
||||||
html: md.render(plain),
|
html: md.render(plain),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private static getPhraselineForNotification(notif: UserNotification) {
|
||||||
|
// // opened a new issue
|
||||||
|
// const actionLine = "";
|
||||||
|
// return actionLine;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private static getReasonLine(notif: UserNotification) {
|
||||||
|
// switch (notif.reason) {
|
||||||
|
// case "assign":
|
||||||
|
// return `You were assigned to`;
|
||||||
|
// case "mention":
|
||||||
|
// return "You were mentioned";
|
||||||
|
// default:
|
||||||
|
// return "";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private static getEmojiForNotifType(notif: UserNotification): string {
|
private static getEmojiForNotifType(notif: UserNotification): string {
|
||||||
switch(notif.subject.type) {
|
switch (notif.subject.type) {
|
||||||
case "Issue":
|
case "Issue":
|
||||||
return "📝";
|
return "📝";
|
||||||
case "PullRequest":
|
case "PullRequest":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user