mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
Merge pull request #76 from jaywink/assignee-on-created-issue
Add issue assignee to issue created message, if issue assigned on creation
This commit is contained in:
commit
d2cb53eda9
4
.gitignore
vendored
4
.gitignore
vendored
@ -5,6 +5,8 @@ node_modules/
|
||||
public/
|
||||
registration.yml
|
||||
tsconfig.tsbuildinfo
|
||||
public/
|
||||
|
||||
.idea
|
||||
# Added by cargo
|
||||
/target
|
||||
/target
|
||||
|
@ -141,7 +141,7 @@ export class GitHubRepoConnection implements IConnection {
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
static helpMessage: (cmdPrefix: string) => MatrixMessageContent;
|
||||
static botCommands: BotCommands;
|
||||
|
||||
@ -286,8 +286,11 @@ export class GitHubRepoConnection implements IConnection {
|
||||
throw Error('No repository content!');
|
||||
}
|
||||
const orgRepoName = event.repository.full_name;
|
||||
|
||||
const content = emoji.emojify(`${event.issue.user?.login} created new issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${event.issue.title}"`);
|
||||
|
||||
let message = `${event.issue.user?.login} created new issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${event.issue.title}"`;
|
||||
message = message + (event.issue.assignee ? ` assigned to ${event.issue.assignee.login}` : '');
|
||||
const content = emoji.emojify(message);
|
||||
const { labelsHtml, labelsStr } = FormatUtil.formatLabels(event.issue.labels);
|
||||
const labels = FormatUtil.formatLabels(event.issue.labels?.map(l => ({ name: l.name, description: l.description || undefined, color: l.color || undefined })));
|
||||
await this.as.botIntent.sendEvent(this.roomId, {
|
||||
msgtype: "m.notice",
|
||||
@ -388,7 +391,7 @@ export class GitHubRepoConnection implements IConnection {
|
||||
format: "org.matrix.custom.html",
|
||||
// TODO: Fix types.
|
||||
...FormatUtil.getPartialBodyForIssue(event.repository, event.pull_request as any),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public async onPRReviewed(event: PullRequestReviewSubmittedEvent) {
|
||||
@ -539,4 +542,4 @@ ${event.release.body}`;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const res = compileBotCommands(GitHubRepoConnection.prototype as any);
|
||||
GitHubRepoConnection.helpMessage = res.helpMessage;
|
||||
GitHubRepoConnection.botCommands = res.botCommands;
|
||||
GitHubRepoConnection.botCommands = res.botCommands;
|
||||
|
Loading…
x
Reference in New Issue
Block a user