-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1280 from AletheiaFact/refactored-kanban-page
Refactored Kanban Page to support different `reviewTask` types
- Loading branch information
Showing
61 changed files
with
877 additions
and
535 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
migrations/20240701184655-add-namespace-in-review-task-schemae.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Db } from "mongodb"; | ||
const ObjectId = require("mongodb").ObjectID; | ||
|
||
export async function up(db: Db) { | ||
const reviewTasksCursor = await db.collection("reviewtasks").find(); | ||
|
||
while (await reviewTasksCursor.hasNext()) { | ||
const reviewTask = await reviewTasksCursor.next(); | ||
if (reviewTask.machine.context.claimReview.claim) { | ||
const claim = await db.collection("claims").findOne({ | ||
_id: ObjectId(reviewTask.machine.context.claimReview.claim), | ||
}); | ||
|
||
await db | ||
.collection("reviewtasks") | ||
.updateOne( | ||
{ _id: reviewTask._id }, | ||
{ | ||
$set: { | ||
nameSpace: claim?.nameSpace, | ||
reviewTaskType: "Claim", | ||
}, | ||
} | ||
); | ||
} | ||
|
||
if (reviewTask.machine.context.claimReview.source) { | ||
const source = await db.collection("sources").findOne({ | ||
_id: ObjectId(reviewTask.machine.context.claimReview.source), | ||
}); | ||
|
||
await db | ||
.collection("reviewtasks") | ||
.updateOne( | ||
{ _id: reviewTask._id }, | ||
{ | ||
$set: { | ||
nameSpace: source?.nameSpace, | ||
reviewTaskType: "Source", | ||
}, | ||
} | ||
); | ||
} | ||
} | ||
} | ||
|
||
export async function down(db: Db) { | ||
await db | ||
.collection("reviewtasks") | ||
.updateMany({}, { $unset: { nameSpace: "", reviewTaskType: "" } }); | ||
} |
36 changes: 36 additions & 0 deletions
36
migrations/20240701191347-add-target-field-in-machine-context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Db } from "mongodb"; | ||
|
||
export async function up(db: Db) { | ||
const reviewTasksCursor = await db.collection("reviewtasks").find(); | ||
|
||
while (await reviewTasksCursor.hasNext()) { | ||
const reviewTask = await reviewTasksCursor.next(); | ||
if (reviewTask.machine.context.claimReview.claim) { | ||
await db.collection("reviewtasks").updateOne( | ||
{ _id: reviewTask._id }, | ||
{ | ||
$set: { | ||
target: reviewTask.machine.context.claimReview.claim, | ||
}, | ||
$unset: { | ||
"machine.context.claimReview.claim": undefined, | ||
}, | ||
} | ||
); | ||
} | ||
|
||
if (reviewTask.machine.context.claimReview.source) { | ||
await db.collection("reviewtasks").updateOne( | ||
{ _id: reviewTask._id }, | ||
{ | ||
$set: { | ||
target: reviewTask.machine.context.claimReview.source, | ||
}, | ||
$unset: { | ||
"machine.context.claimReview.source": undefined, | ||
}, | ||
} | ||
); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
migrations/20240701221810-rename-claim-review-field-in-review-task-schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Db } from "mongodb"; | ||
|
||
export async function up(db: Db) { | ||
const reviewTasksCursor = await db.collection("reviewtasks").find(); | ||
|
||
while (await reviewTasksCursor.hasNext()) { | ||
const reviewTask = await reviewTasksCursor.next(); | ||
|
||
await db | ||
.collection("reviewtasks") | ||
.updateOne( | ||
{ _id: reviewTask._id }, | ||
{ | ||
$rename: { | ||
"machine.context.claimReview": "machine.context.review", | ||
}, | ||
} | ||
); | ||
} | ||
} | ||
|
||
export async function down(db: Db) { | ||
const reviewTasksCursor = await db.collection("reviewtasks").find(); | ||
|
||
while (await reviewTasksCursor.hasNext()) { | ||
const reviewTask = await reviewTasksCursor.next(); | ||
|
||
await db | ||
.collection("reviewtasks") | ||
.updateOne( | ||
{ _id: reviewTask._id }, | ||
{ | ||
$rename: { | ||
"machine.context.review": "machine.context.claimReview", | ||
}, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
{ | ||
"claimBy": "Claim by", | ||
"assignedTo": "Fact-checkers", | ||
"myTasks": "My tasks only", | ||
"myCrossChecks": "My cross-checks only", | ||
"myReviews": "My reviews only" | ||
"myAssigned": "My tasks only", | ||
"myCrossChecked": "My cross-checks only", | ||
"myReviewed": "My reviews only", | ||
"tabClaimTitle": "Claims", | ||
"tabSourceTitle": "Sources", | ||
"tabVerificationRequestTitle": "Verification Requests" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
{ | ||
"claimBy": "Afirmação de", | ||
"assignedTo": "Checadores", | ||
"myTasks": "Apenas minhas tarefas", | ||
"myCrossChecks": "Apenas meus cross-checkings", | ||
"myReviews": "Minhas revisões" | ||
"myAssigned": "Apenas minhas tarefas", | ||
"myCrossChecked": "Apenas meus cross-checkings", | ||
"myReviewed": "Minhas revisões", | ||
"tabClaimTitle": "Afirmações", | ||
"tabSourceTitle": "Fontes", | ||
"tabVerificationRequestTitle": "Denúncias" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.