Skip to content

Node.js based forum software built for the modern web

test: intify uid/cid if they are numbers (when getting crossposts)

Julian Lam47e37ed57162
diff --git a/src/topics/crossposts.js b/src/topics/crossposts.js
index 26aec2bf8a..c02f24e934 100644
--- a/src/topics/crossposts.js
+++ b/src/topics/crossposts.js
@@ -27,6 +27,9 @@ Crossposts.get = async function (tid) {
crossposts = crossposts.map((crosspost, idx) => {
crosspost.id = crosspostIds[idx];
crosspost.category = categoriesData.get(parseInt(crosspost.cid, 10));
+ crosspost.uid = utils.isNumber(crosspost.uid) ? parseInt(crosspost.uid) : crosspost.uid;
+ crosspost.cid = utils.isNumber(crosspost.cid) ? parseInt(crosspost.cid) : crosspost.cid;
+
return crosspost;
});
diff --git a/test/topics/crossposts.js b/test/topics/crossposts.js
index ce3be1fbc5..5b5a4b0d67 100644
--- a/test/topics/crossposts.js
+++ b/test/topics/crossposts.js
@@ -396,9 +396,9 @@ describe('Crossposting (& related logic)', () => {
tid: actual.tid,
cid: actual.cid,
}, {
- uid: '0',
+ uid: 0,
tid,
- cid: String(cid),
+ cid: cid,
});
});
});
@@ -443,9 +443,9 @@ describe('Crossposting (& related logic)', () => {
tid: actual.tid,
cid: actual.cid,
}, {
- uid: '0',
+ uid: 0,
tid,
- cid: String(cid),
+ cid: cid,
});
});
});