RENAME: reply_to -> reply
This commit is contained in:
@@ -49,13 +49,13 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p.reply_to_id) {
|
||||
await get(p.reply_to_id);
|
||||
if (p.reply_id) {
|
||||
await get(p.reply_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (post.reply_to_id) {
|
||||
await get(post.reply_to_id);
|
||||
if (post.reply_id) {
|
||||
await get(post.reply_id);
|
||||
}
|
||||
|
||||
// Serialize
|
||||
|
@@ -103,9 +103,9 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Get 'in_reply_to_post_id' parameter
|
||||
const [inReplyToPostId, inReplyToPostIdErr] = $(params.reply_to_id).optional.id().$;
|
||||
if (inReplyToPostIdErr) return rej('invalid in_reply_to_post_id');
|
||||
// Get 'in_reply_post_id' parameter
|
||||
const [inReplyToPostId, inReplyToPostIdErr] = $(params.reply_id).optional.id().$;
|
||||
if (inReplyToPostIdErr) return rej('invalid in_reply_post_id');
|
||||
|
||||
let inReplyToPost: IPost = null;
|
||||
if (inReplyToPostId !== undefined) {
|
||||
@@ -192,7 +192,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||
if (user.latest_post) {
|
||||
if (deepEqual({
|
||||
text: user.latest_post.text,
|
||||
reply: user.latest_post.reply_to_id ? user.latest_post.reply_to_id.toString() : null,
|
||||
reply: user.latest_post.reply_id ? user.latest_post.reply_id.toString() : null,
|
||||
repost: user.latest_post.repost_id ? user.latest_post.repost_id.toString() : null,
|
||||
media_ids: (user.latest_post.media_ids || []).map(id => id.toString())
|
||||
}, {
|
||||
@@ -211,7 +211,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||
channel_id: channel ? channel._id : undefined,
|
||||
index: channel ? channel.index + 1 : undefined,
|
||||
media_ids: files ? files.map(file => file._id) : undefined,
|
||||
reply_to_id: inReplyToPost ? inReplyToPost._id : undefined,
|
||||
reply_id: inReplyToPost ? inReplyToPost._id : undefined,
|
||||
repost_id: repost ? repost._id : undefined,
|
||||
poll: poll,
|
||||
text: text,
|
||||
|
@@ -40,7 +40,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
|
||||
// Issue query
|
||||
const replies = await Post
|
||||
.find({ reply_to_id: post._id }, {
|
||||
.find({ reply_id: post._id }, {
|
||||
limit: limit,
|
||||
skip: offset,
|
||||
sort: {
|
||||
|
@@ -48,7 +48,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
} as any;
|
||||
|
||||
if (reply != undefined) {
|
||||
query.reply_to_id = reply ? { $exists: true, $ne: null } : null;
|
||||
query.reply_id = reply ? { $exists: true, $ne: null } : null;
|
||||
}
|
||||
|
||||
if (repost != undefined) {
|
||||
|
Reference in New Issue
Block a user