Migrate to tslint 5.1.0
This commit is contained in:
@ -49,7 +49,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
|
||||
day = new Date(day.setSeconds(59));
|
||||
day = new Date(day.setMinutes(59));
|
||||
day = new Date(day.setHours(23));
|
||||
//day = day.getTime();
|
||||
// day = day.getTime();
|
||||
|
||||
const count = likes.filter(l =>
|
||||
l.created_at < day && (l.deleted_at == null || l.deleted_at > day)
|
||||
|
@ -32,14 +32,14 @@ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) =
|
||||
} else {
|
||||
const select = {};
|
||||
if (key !== null) {
|
||||
select['data.' + key] = true;
|
||||
select[`data.${key}`] = true;
|
||||
}
|
||||
const appdata = await Appdata.findOne({
|
||||
app_id: app._id,
|
||||
user_id: user._id
|
||||
}, {
|
||||
fields: select
|
||||
});
|
||||
fields: select
|
||||
});
|
||||
|
||||
if (appdata) {
|
||||
res(appdata.data);
|
||||
|
@ -37,10 +37,10 @@ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) =
|
||||
let set = {};
|
||||
if (data) {
|
||||
Object.entries(data).forEach(([k, v]) => {
|
||||
set['data.' + k] = v;
|
||||
set[`data.${k}`] = v;
|
||||
});
|
||||
} else {
|
||||
set['data.' + key] = value;
|
||||
set[`data.${key}`] = value;
|
||||
}
|
||||
|
||||
if (isSecure) {
|
||||
@ -63,10 +63,10 @@ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) =
|
||||
app_id: app._id,
|
||||
user_id: user._id
|
||||
}, {
|
||||
$set: set
|
||||
}), {
|
||||
upsert: true
|
||||
});
|
||||
$set: set
|
||||
}), {
|
||||
upsert: true
|
||||
});
|
||||
|
||||
res(204);
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
_id: mediaId,
|
||||
user_id: user._id
|
||||
}, {
|
||||
_id: true
|
||||
});
|
||||
_id: true
|
||||
});
|
||||
|
||||
if (entity === null) {
|
||||
return rej('file not found');
|
||||
@ -79,23 +79,23 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
const latestPost = await Post.findOne({
|
||||
user_id: user._id
|
||||
}, {
|
||||
sort: {
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
sort: {
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
|
||||
// 直近と同じRepost対象かつ引用じゃなかったらエラー
|
||||
if (latestPost &&
|
||||
latestPost.repost_id &&
|
||||
latestPost.repost_id.equals(repost._id) &&
|
||||
text === undefined && files === null) {
|
||||
latestPost.repost_id &&
|
||||
latestPost.repost_id.equals(repost._id) &&
|
||||
text === undefined && files === null) {
|
||||
return rej('二重Repostです(NEED TRANSLATE)');
|
||||
}
|
||||
|
||||
// 直近がRepost対象かつ引用じゃなかったらエラー
|
||||
if (latestPost &&
|
||||
latestPost._id.equals(repost._id) &&
|
||||
text === undefined && files === null) {
|
||||
latestPost._id.equals(repost._id) &&
|
||||
text === undefined && files === null) {
|
||||
return rej('二重Repostです(NEED TRANSLATE)');
|
||||
}
|
||||
}
|
||||
@ -152,11 +152,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
repost: user.latest_post.repost_id ? user.latest_post.repost_id.toString() : null,
|
||||
media_ids: (user.latest_post.media_ids || []).map(id => id.toString())
|
||||
}, {
|
||||
text: text,
|
||||
reply: inReplyToPost ? inReplyToPost._id.toString() : null,
|
||||
repost: repost ? repost._id.toString() : null,
|
||||
media_ids: (files || []).map(file => file._id.toString())
|
||||
})) {
|
||||
text: text,
|
||||
reply: inReplyToPost ? inReplyToPost._id.toString() : null,
|
||||
repost: repost ? repost._id.toString() : null,
|
||||
media_ids: (files || []).map(file => file._id.toString())
|
||||
})) {
|
||||
return rej('duplicate');
|
||||
}
|
||||
}
|
||||
@ -179,7 +179,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
// Reponse
|
||||
res(postObj);
|
||||
|
||||
//--------------------------------
|
||||
// --------------------------------
|
||||
// Post processes
|
||||
|
||||
User.update({ _id: user._id }, {
|
||||
@ -288,17 +288,17 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
if (text) {
|
||||
// Analyze
|
||||
const tokens = parse(text);
|
||||
/*
|
||||
// Extract a hashtags
|
||||
const hashtags = tokens
|
||||
.filter(t => t.type == 'hashtag')
|
||||
.map(t => t.hashtag)
|
||||
// Drop dupulicates
|
||||
.filter((v, i, s) => s.indexOf(v) == i);
|
||||
/*
|
||||
// Extract a hashtags
|
||||
const hashtags = tokens
|
||||
.filter(t => t.type == 'hashtag')
|
||||
.map(t => t.hashtag)
|
||||
// Drop dupulicates
|
||||
.filter((v, i, s) => s.indexOf(v) == i);
|
||||
|
||||
// ハッシュタグをデータベースに登録
|
||||
registerHashtags(user, hashtags);
|
||||
*/
|
||||
// ハッシュタグをデータベースに登録
|
||||
registerHashtags(user, hashtags);
|
||||
*/
|
||||
// Extract an '@' mentions
|
||||
const atMentions = tokens
|
||||
.filter(t => t.type == 'mention')
|
||||
|
@ -67,7 +67,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
res();
|
||||
|
||||
const inc = {};
|
||||
inc['reaction_counts.' + reaction] = 1;
|
||||
inc[`reaction_counts.${reaction}`] = 1;
|
||||
|
||||
// Increment reactions count
|
||||
await Post.update({ _id: post._id }, {
|
||||
|
@ -42,16 +42,16 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
await Reaction.update({
|
||||
_id: exist._id
|
||||
}, {
|
||||
$set: {
|
||||
deleted_at: new Date()
|
||||
}
|
||||
});
|
||||
$set: {
|
||||
deleted_at: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
// Send response
|
||||
res();
|
||||
|
||||
const dec = {};
|
||||
dec['reaction_counts.' + exist.reaction] = -1;
|
||||
dec[`reaction_counts.${exist.reaction}`] = -1;
|
||||
|
||||
// Decrement reactions count
|
||||
Post.update({ _id: post._id }, {
|
||||
|
Reference in New Issue
Block a user