RENAME: reply_to -> reply

This commit is contained in:
こぴなたみぽ
2017-11-01 10:22:40 +09:00
parent d6a8e6b7c2
commit 60a7640eb1
25 changed files with 60 additions and 60 deletions

View File

@ -19,7 +19,7 @@ module.exports = params => new Promise(async (res, rej) => {
.aggregate([
{ $project: {
repost_id: '$repost_id',
reply_to_id: '$reply_to_id',
reply_id: '$reply_id',
created_at: { $add: ['$created_at', 9 * 60 * 60 * 1000] } // Convert into JST
}},
{ $project: {
@ -34,7 +34,7 @@ module.exports = params => new Promise(async (res, rej) => {
then: 'repost',
else: {
$cond: {
if: { $ne: ['$reply_to_id', null] },
if: { $ne: ['$reply_id', null] },
then: 'reply',
else: 'post'
}

View File

@ -26,7 +26,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
const datas = await Post
.aggregate([
{ $match: { reply_to: post._id } },
{ $match: { reply: post._id } },
{ $project: {
created_at: { $add: ['$created_at', 9 * 60 * 60 * 1000] } // Convert into JST
}},

View File

@ -40,7 +40,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
{ $match: { user_id: user._id } },
{ $project: {
repost_id: '$repost_id',
reply_to_id: '$reply_to_id',
reply_id: '$reply_id',
created_at: { $add: ['$created_at', 9 * 60 * 60 * 1000] } // Convert into JST
}},
{ $project: {
@ -55,7 +55,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
then: 'repost',
else: {
$cond: {
if: { $ne: ['$reply_to_id', null] },
if: { $ne: ['$reply_id', null] },
then: 'reply',
else: 'post'
}

View File

@ -34,7 +34,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
{ $match: { user_id: user._id } },
{ $project: {
repost_id: '$repost_id',
reply_to_id: '$reply_to_id',
reply_id: '$reply_id',
created_at: { $add: ['$created_at', 9 * 60 * 60 * 1000] } // Convert into JST
}},
{ $project: {
@ -49,7 +49,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
then: 'repost',
else: {
$cond: {
if: { $ne: ['$reply_to_id', null] },
if: { $ne: ['$reply_id', null] },
then: 'reply',
else: 'post'
}

View File

@ -62,7 +62,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
}
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) {

View File

@ -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

View File

@ -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,

View File

@ -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: {

View File

@ -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) {

View File

@ -27,7 +27,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
// Fetch recent posts
const recentPosts = await Post.find({
user_id: user._id,
reply_to_id: {
reply_id: {
$exists: true,
$ne: null
}
@ -38,7 +38,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
limit: 1000,
fields: {
_id: false,
reply_to_id: true
reply_id: true
}
});
@ -49,7 +49,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
const replyTargetPosts = await Post.find({
_id: {
$in: recentPosts.map(p => p.reply_to_id)
$in: recentPosts.map(p => p.reply_id)
},
user_id: {
$ne: user._id

View File

@ -85,7 +85,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
}
if (!includeReplies) {
query.reply_to_id = null;
query.reply_id = null;
}
if (withMedia) {