feat: 创建话题时记录github 的相关 meta信息

pull/56/head
moonrailgun 3 years ago
parent ac5903ad44
commit 214666113c

@ -1,6 +1,7 @@
# The ID of your GitHub App
APP_ID=
WEBHOOK_SECRET=development
PRIVATE_KEY=
# Use `trace` to get verbose logging or `info` to show less
LOG_LEVEL=debug
@ -9,4 +10,6 @@ LOG_LEVEL=debug
WEBHOOK_PROXY_URL=
# Tailchat
TAILCHAT_API_URL=
TAILCHAT_API_URL=https://paw-server-nightly.moonrailgun.com
TAILCHAT_APP_ID=
TAILCHAT_APP_SECRET=

@ -19,6 +19,7 @@
},
"dependencies": {
"axios": "^0.21.1",
"dotenv": "^16.0.3",
"probot": "^12.2.4",
"probot-metadata": "^2.1.0"
},

@ -2,6 +2,8 @@ import { Probot } from 'probot';
import metadata from 'probot-metadata';
import { TailchatClient } from './client';
import { configPath, generateErrorBlock } from './utils';
import * as dotenv from 'dotenv'; // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config();
const LABEL = 'tailchat-topic';
const TOPIC_KEY = 'tailchatTopicId';
@ -53,6 +55,11 @@ export function app(app: Probot) {
}\ncontent: ${ctx.payload.issue.body ?? ''}\n\nwebsite: ${
ctx.payload.issue.html_url
}`,
meta: {
githubRepoOwner: ctx.payload.repository.owner,
githubRepoName: ctx.payload.repository.name,
githubIssueNumber: ctx.payload.issue.number,
},
}
);

@ -1,4 +1,8 @@
import { run } from 'probot';
import { app } from './app';
run(app);
run(app).then((server) => {
server.router('/').get('/', (req, res) => {
res.send('Hello World! Github app server is working!');
});
});

@ -132,6 +132,7 @@ importers:
'@types/jest': ^28.1.0
'@types/node': ^18.0.0
axios: ^0.21.1
dotenv: ^16.0.3
jest: 27.5.1
nock: ^13.0.5
nodemon: ^2.0.18
@ -143,6 +144,7 @@ importers:
typescript: ^4.1.3
dependencies:
axios: 0.21.4
dotenv: 16.0.3
probot: 12.2.8
probot-metadata: 2.1.0_probot@12.2.8
devDependencies:
@ -14843,6 +14845,11 @@ packages:
engines: {node: '>=12'}
dev: false
/dotenv/16.0.3:
resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==}
engines: {node: '>=12'}
dev: false
/dotenv/8.6.0:
resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==}
engines: {node: '>=10'}
@ -19529,7 +19536,7 @@ packages:
pretty-format: 27.5.1
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.1_bqee57coj3oib6dw4m24wknwqe
ts-node: 10.9.1_k2dsl7zculo2nmh5s33pladmoa
transitivePeerDependencies:
- bufferutil
- canvas

@ -51,6 +51,12 @@ export class GroupTopic extends TimeStamps implements db.Base {
default: [],
})
comments: GroupTopicComment[];
/**
*
*/
@prop()
meta?: object;
}
export type GroupTopicDocument = db.DocumentType<GroupTopic>;

@ -29,6 +29,7 @@ class GroupTopicService extends TcService {
groupId: 'string',
panelId: 'string',
content: 'string',
meta: { type: 'object', optional: true },
},
});
this.registerAction('createComment', this.createComment, {
@ -89,9 +90,10 @@ class GroupTopicService extends TcService {
groupId: string;
panelId: string;
content: string;
meta?: object;
}>
) {
const { groupId, panelId, content } = ctx.params;
const { groupId, panelId, content, meta } = ctx.params;
const userId = ctx.meta.userId;
const t = ctx.meta.t;
@ -112,6 +114,7 @@ class GroupTopicService extends TcService {
groupId,
panelId,
content,
meta,
author: userId,
comment: [],
});

Loading…
Cancel
Save