mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
- Commit messages lose sign-off and co-author trailers, e-mail addresses and the fork owner in merge headlines; without the origin option merge headlines lose branch names too. - Branch names are shown only with the origin option. - Gists keep only images (hidden unless images are displayed); other binaries are never stored or served. Images share an 8 MB budget so the gist document stays under MongoDB's limit, and an unreadable image no longer fails the whole gist. - Review threads match the diff side, and outdated comments go to the end of their file instead of an unrelated line. - The diff parser no longer reads a removed '-- ' line as a file header. - Each diff file renders as its own component from escaped HTML, so large diffs don't re-render on scroll or collapse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
2.4 KiB
TypeScript
104 lines
2.4 KiB
TypeScript
import { ownerAlertLifecycle } from "../owner-alert-lifecycle.schema";
|
|
import { repositoryAccessSchema } from "../repository-access.schema";
|
|
import { Schema } from "mongoose";
|
|
|
|
const AnonymizedPullRequestSchema = new Schema({
|
|
accessAlertGeneration: { type: String, select: false },
|
|
accessAlertClaimedAt: { type: Date, select: false },
|
|
accessAlertAttemptId: { type: String, select: false },
|
|
accessAlertClaimRevision: { type: Number, select: false },
|
|
pullRequestId: {
|
|
type: String,
|
|
index: { unique: true },
|
|
},
|
|
status: {
|
|
type: String,
|
|
default: "preparing",
|
|
},
|
|
statusDate: Date,
|
|
statusMessage: String,
|
|
anonymizeDate: Date,
|
|
lastView: Date,
|
|
pageView: Number,
|
|
owner: { type: Schema.Types.ObjectId, index: true },
|
|
githubAccess: { type: repositoryAccessSchema, default: undefined },
|
|
conference: String,
|
|
source: {
|
|
pullRequestId: Number,
|
|
repositoryFullName: String,
|
|
accessToken: { type: String, select: false },
|
|
},
|
|
options: {
|
|
terms: [String],
|
|
expirationMode: { type: String },
|
|
expirationDate: Date,
|
|
update: Boolean,
|
|
image: Boolean,
|
|
link: Boolean,
|
|
title: Boolean,
|
|
body: Boolean,
|
|
comments: Boolean,
|
|
diff: Boolean,
|
|
origin: Boolean,
|
|
username: Boolean,
|
|
date: Boolean,
|
|
},
|
|
dateOfEntry: {
|
|
type: Date,
|
|
default: Date.now,
|
|
},
|
|
pullRequest: {
|
|
diff: String,
|
|
title: String,
|
|
body: String,
|
|
creationDate: Date,
|
|
updatedDate: Date,
|
|
draft: Boolean,
|
|
merged: Boolean,
|
|
mergedDate: Date,
|
|
state: String,
|
|
baseRepositoryFullName: String,
|
|
headRepositoryFullName: String,
|
|
author: String,
|
|
baseRef: String,
|
|
headRef: String,
|
|
commits: [
|
|
{
|
|
_id: false,
|
|
message: String,
|
|
author: String,
|
|
date: Date,
|
|
},
|
|
],
|
|
reviewComments: [
|
|
{
|
|
_id: false,
|
|
commentId: Number,
|
|
inReplyTo: Number,
|
|
path: String,
|
|
line: Number,
|
|
/** LEFT: a removed line (old numbering); RIGHT: an added or context line. */
|
|
side: String,
|
|
body: String,
|
|
author: String,
|
|
creationDate: Date,
|
|
updatedDate: Date,
|
|
},
|
|
],
|
|
comments: [
|
|
{
|
|
body: String,
|
|
creationDate: Date,
|
|
updatedDate: Date,
|
|
author: String,
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
AnonymizedPullRequestSchema.index({ status: 1, "options.expirationDate": 1 });
|
|
|
|
AnonymizedPullRequestSchema.plugin(ownerAlertLifecycle);
|
|
|
|
export default AnonymizedPullRequestSchema;
|