From 3d5cdb8d2d60932caf1d29b0581c7d6243e06e37 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 28 Mar 2018 16:39:14 +0900 Subject: wip --- src/api/endpoints/posts/trend.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/api/endpoints/posts/trend.ts') diff --git a/src/api/endpoints/posts/trend.ts b/src/api/endpoints/posts/trend.ts index caded92bf5..3f92f06167 100644 --- a/src/api/endpoints/posts/trend.ts +++ b/src/api/endpoints/posts/trend.ts @@ -38,7 +38,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { if (pollErr) return rej('invalid poll param'); const query = { - created_at: { + createdAt: { $gte: new Date(Date.now() - ms('1days')) }, repost_count: { @@ -47,15 +47,15 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } as any; if (reply != undefined) { - query.reply_id = reply ? { $exists: true, $ne: null } : null; + query.replyId = reply ? { $exists: true, $ne: null } : null; } if (repost != undefined) { - query.repost_id = repost ? { $exists: true, $ne: null } : null; + query.repostId = repost ? { $exists: true, $ne: null } : null; } if (media != undefined) { - query.media_ids = media ? { $exists: true, $ne: null } : null; + query.mediaIds = media ? { $exists: true, $ne: null } : null; } if (poll != undefined) { -- cgit v1.2.3-freya From 71065077f66662381a6d5f08ad8b345ceaf742db Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 28 Mar 2018 16:59:11 +0900 Subject: wip --- src/api/endpoints/meta.ts | 1 - src/api/endpoints/othello/games/show.ts | 6 +++--- src/api/endpoints/posts/create.ts | 16 ++++++++-------- src/api/endpoints/posts/reactions/create.ts | 2 +- src/api/endpoints/posts/reactions/delete.ts | 2 +- src/api/endpoints/posts/search.ts | 18 +++++++++--------- src/api/endpoints/posts/trend.ts | 4 ++-- src/api/endpoints/stats.ts | 4 ++-- src/api/endpoints/users/posts.ts | 12 ++++++------ src/api/models/app.ts | 2 +- src/api/models/channel.ts | 2 +- src/api/models/drive-folder.ts | 4 ++-- src/api/models/post.ts | 6 +++++- src/api/models/user.ts | 14 +++++++------- src/web/app/auth/views/index.vue | 4 ++-- src/web/app/ch/tags/channel.tag | 8 ++++---- src/web/app/common/scripts/parse-search-query.ts | 4 ++-- .../common/views/components/messaging-room.message.vue | 4 ++-- src/web/app/common/views/components/othello.vue | 2 +- src/web/app/common/views/components/poll.vue | 8 ++++---- .../app/common/views/components/reactions-viewer.vue | 2 +- src/web/app/desktop/views/components/follow-button.vue | 18 +++++++++--------- src/web/app/desktop/views/components/followers.vue | 2 +- src/web/app/desktop/views/components/following.vue | 2 +- src/web/app/desktop/views/components/post-detail.vue | 10 +++++----- src/web/app/desktop/views/components/posts.post.vue | 10 +++++----- .../app/desktop/views/components/users-list.item.vue | 2 +- src/web/app/desktop/views/pages/othello.vue | 2 +- src/web/app/desktop/views/pages/user/user.photos.vue | 2 +- src/web/app/desktop/views/pages/user/user.profile.vue | 10 +++++----- src/web/app/mobile/views/components/drive.vue | 8 ++++---- src/web/app/mobile/views/components/follow-button.vue | 18 +++++++++--------- src/web/app/mobile/views/components/post-detail.vue | 10 +++++----- src/web/app/mobile/views/components/post.vue | 10 +++++----- src/web/app/mobile/views/components/user-timeline.vue | 4 ++-- src/web/app/mobile/views/pages/followers.vue | 2 +- src/web/app/mobile/views/pages/following.vue | 2 +- src/web/app/mobile/views/pages/othello.vue | 2 +- src/web/app/mobile/views/pages/user.vue | 2 +- src/web/app/mobile/views/pages/user/home.photos.vue | 2 +- src/web/app/stats/tags/index.tag | 2 +- src/web/docs/api/entities/post.yaml | 4 ++-- src/web/docs/api/entities/user.yaml | 6 +++--- tools/migration/shell.camel-case.js | 3 +++ 44 files changed, 132 insertions(+), 126 deletions(-) (limited to 'src/api/endpoints/posts/trend.ts') diff --git a/src/api/endpoints/meta.ts b/src/api/endpoints/meta.ts index 1370ead3c5..80a3725eb0 100644 --- a/src/api/endpoints/meta.ts +++ b/src/api/endpoints/meta.ts @@ -53,7 +53,6 @@ module.exports = (params) => new Promise(async (res, rej) => { model: os.cpus()[0].model, cores: os.cpus().length }, - top_image: meta.top_image, broadcasts: meta.broadcasts }); }); diff --git a/src/api/endpoints/othello/games/show.ts b/src/api/endpoints/othello/games/show.ts index 19f5d0fef0..f9084682fa 100644 --- a/src/api/endpoints/othello/games/show.ts +++ b/src/api/endpoints/othello/games/show.ts @@ -3,9 +3,9 @@ import OthelloGame, { pack } from '../../../models/othello-game'; import Othello from '../../../../common/othello/core'; module.exports = (params, user) => new Promise(async (res, rej) => { - // Get 'game_id' parameter - const [gameId, gameIdErr] = $(params.game_id).id().$; - if (gameIdErr) return rej('invalid game_id param'); + // Get 'gameId' parameter + const [gameId, gameIdErr] = $(params.gameId).id().$; + if (gameIdErr) return rej('invalid gameId param'); const game = await OthelloGame.findOne({ _id: gameId }); diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index b99d1fbbc1..2817374545 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -211,12 +211,12 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // 直近の投稿と重複してたらエラー // TODO: 直近の投稿が一日前くらいなら重複とは見なさない - if (user.latest_post) { + if (user.latestPost) { if (deepEqual({ - text: user.latest_post.text, - reply: user.latest_post.replyId ? user.latest_post.replyId.toString() : null, - repost: user.latest_post.repostId ? user.latest_post.repostId.toString() : null, - mediaIds: (user.latest_post.mediaIds || []).map(id => id.toString()) + text: user.latestPost.text, + reply: user.latestPost.replyId ? user.latestPost.replyId.toString() : null, + repost: user.latestPost.repostId ? user.latestPost.repostId.toString() : null, + mediaIds: (user.latestPost.mediaIds || []).map(id => id.toString()) }, { text: text, reply: reply ? reply._id.toString() : null, @@ -277,7 +277,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { User.update({ _id: user._id }, { $set: { - latest_post: post + latestPost: post } }); @@ -362,7 +362,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // Increment replies count Post.update({ _id: reply._id }, { $inc: { - replies_count: 1 + repliesCount: 1 } }); @@ -457,7 +457,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // Update repostee status Post.update({ _id: repost._id }, { $inc: { - repost_count: 1 + repostCount: 1 } }); } diff --git a/src/api/endpoints/posts/reactions/create.ts b/src/api/endpoints/posts/reactions/create.ts index 6f75a923cd..a1e6779805 100644 --- a/src/api/endpoints/posts/reactions/create.ts +++ b/src/api/endpoints/posts/reactions/create.ts @@ -73,7 +73,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { res(); const inc = {}; - inc[`reaction_counts.${reaction}`] = 1; + inc[`reactionCounts.${reaction}`] = 1; // Increment reactions count await Post.update({ _id: post._id }, { diff --git a/src/api/endpoints/posts/reactions/delete.ts b/src/api/endpoints/posts/reactions/delete.ts index 18fdabcdc2..b09bcbb4b7 100644 --- a/src/api/endpoints/posts/reactions/delete.ts +++ b/src/api/endpoints/posts/reactions/delete.ts @@ -51,7 +51,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { res(); const dec = {}; - dec[`reaction_counts.${exist.reaction}`] = -1; + dec[`reactionCounts.${exist.reaction}`] = -1; // Decrement reactions count Post.update({ _id: post._id }, { diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index f90b9aa0dd..5c324bfe9a 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -21,21 +21,21 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [text, textError] = $(params.text).optional.string().$; if (textError) return rej('invalid text param'); - // Get 'include_userIds' parameter - const [includeUserIds = [], includeUserIdsErr] = $(params.include_userIds).optional.array('id').$; - if (includeUserIdsErr) return rej('invalid include_userIds param'); + // Get 'includeUserIds' parameter + const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array('id').$; + if (includeUserIdsErr) return rej('invalid includeUserIds param'); // Get 'exclude_userIds' parameter const [excludeUserIds = [], excludeUserIdsErr] = $(params.exclude_userIds).optional.array('id').$; if (excludeUserIdsErr) return rej('invalid exclude_userIds param'); - // Get 'include_user_usernames' parameter - const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.include_user_usernames).optional.array('string').$; - if (includeUserUsernamesErr) return rej('invalid include_user_usernames param'); + // Get 'includeUserUsernames' parameter + const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array('string').$; + if (includeUserUsernamesErr) return rej('invalid includeUserUsernames param'); - // Get 'exclude_user_usernames' parameter - const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.exclude_user_usernames).optional.array('string').$; - if (excludeUserUsernamesErr) return rej('invalid exclude_user_usernames param'); + // Get 'exclude_userUsernames' parameter + const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.exclude_userUsernames).optional.array('string').$; + if (excludeUserUsernamesErr) return rej('invalid exclude_userUsernames param'); // Get 'following' parameter const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$; diff --git a/src/api/endpoints/posts/trend.ts b/src/api/endpoints/posts/trend.ts index 3f92f06167..bc0c47fbc6 100644 --- a/src/api/endpoints/posts/trend.ts +++ b/src/api/endpoints/posts/trend.ts @@ -41,7 +41,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { createdAt: { $gte: new Date(Date.now() - ms('1days')) }, - repost_count: { + repostCount: { $gt: 0 } } as any; @@ -68,7 +68,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { limit: limit, skip: offset, sort: { - repost_count: -1, + repostCount: -1, _id: -1 } }); diff --git a/src/api/endpoints/stats.ts b/src/api/endpoints/stats.ts index eee6f48706..719792d40d 100644 --- a/src/api/endpoints/stats.ts +++ b/src/api/endpoints/stats.ts @@ -18,7 +18,7 @@ import User from '../models/user'; * postsCount: * description: count of all posts of misskey * type: number - * users_count: + * usersCount: * description: count of all users of misskey * type: number * @@ -43,6 +43,6 @@ module.exports = params => new Promise(async (res, rej) => { res({ postsCount: postsCount, - users_count: usersCount + usersCount: usersCount }); }); diff --git a/src/api/endpoints/users/posts.ts b/src/api/endpoints/users/posts.ts index 9ece429b60..9346907492 100644 --- a/src/api/endpoints/users/posts.ts +++ b/src/api/endpoints/users/posts.ts @@ -34,13 +34,13 @@ module.exports = (params, me) => new Promise(async (res, rej) => { return rej('userId or pair of username and host is required'); } - // Get 'include_replies' parameter - const [includeReplies = true, includeRepliesErr] = $(params.include_replies).optional.boolean().$; - if (includeRepliesErr) return rej('invalid include_replies param'); + // Get 'includeReplies' parameter + const [includeReplies = true, includeRepliesErr] = $(params.includeReplies).optional.boolean().$; + if (includeRepliesErr) return rej('invalid includeReplies param'); - // Get 'with_media' parameter - const [withMedia = false, withMediaErr] = $(params.with_media).optional.boolean().$; - if (withMediaErr) return rej('invalid with_media param'); + // Get 'withMedia' parameter + const [withMedia = false, withMediaErr] = $(params.withMedia).optional.boolean().$; + if (withMediaErr) return rej('invalid withMedia param'); // Get 'limit' parameter const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$; diff --git a/src/api/models/app.ts b/src/api/models/app.ts index 20af049b27..528ab156f1 100644 --- a/src/api/models/app.ts +++ b/src/api/models/app.ts @@ -96,7 +96,7 @@ export const pack = ( limit: 1 }); - _app.is_authorized = exist === 1; + _app.isAuthorized = exist === 1; } resolve(_app); diff --git a/src/api/models/channel.ts b/src/api/models/channel.ts index aab21db070..1c7c52a34e 100644 --- a/src/api/models/channel.ts +++ b/src/api/models/channel.ts @@ -67,7 +67,7 @@ export const pack = ( deletedAt: { $exists: false } }); - _channel.is_watching = watch !== null; + _channel.isWatching = watch !== null; //#endregion } diff --git a/src/api/models/drive-folder.ts b/src/api/models/drive-folder.ts index 52f784e069..958e3fb9ef 100644 --- a/src/api/models/drive-folder.ts +++ b/src/api/models/drive-folder.ts @@ -62,8 +62,8 @@ export const pack = ( 'metadata.folderId': _folder.id }); - _folder.folders_count = childFoldersCount; - _folder.files_count = childFilesCount; + _folder.foldersCount = childFoldersCount; + _folder.filesCount = childFilesCount; } if (opts.detail && _folder.parentId) { diff --git a/src/api/models/post.ts b/src/api/models/post.ts index 4ab840b5ed..4f7729fbe8 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -30,6 +30,10 @@ export type IPost = { userId: mongo.ObjectID; appId: mongo.ObjectID; viaMobile: boolean; + repostCount: number; + repliesCount: number; + reactionCounts: any; + mentions: mongo.ObjectID[]; geo: { latitude: number; longitude: number; @@ -184,7 +188,7 @@ export const pack = async ( const myChoice = poll.choices .filter(c => c.id == vote.choice)[0]; - myChoice.is_voted = true; + myChoice.isVoted = true; } return poll; diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 9ee413e0d8..0cf0fe0bdb 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -88,7 +88,7 @@ export type IUser = { bannerId: mongo.ObjectID; data: any; description: string; - latest_post: IPost; + latestPost: IPost; pinnedPostId: mongo.ObjectID; isSuspended: boolean; keywords: string[]; @@ -167,7 +167,7 @@ export const pack = ( delete _user._id; // Remove needless properties - delete _user.latest_post; + delete _user.latestPost; if (!_user.host) { // Remove private properties @@ -212,7 +212,7 @@ export const pack = ( if (meId && !meId.equals(_user.id)) { // Whether the user is following - _user.is_following = (async () => { + _user.isFollowing = (async () => { const follow = await Following.findOne({ followerId: meId, followeeId: _user.id, @@ -222,7 +222,7 @@ export const pack = ( })(); // Whether the user is followed - _user.is_followed = (async () => { + _user.isFollowed = (async () => { const follow2 = await Following.findOne({ followerId: _user.id, followeeId: meId, @@ -232,7 +232,7 @@ export const pack = ( })(); // Whether the user is muted - _user.is_muted = (async () => { + _user.isMuted = (async () => { const mute = await Mute.findOne({ muterId: meId, muteeId: _user.id, @@ -254,14 +254,14 @@ export const pack = ( const myFollowingIds = await getFriends(meId); // Get following you know count - _user.following_you_know_count = Following.count({ + _user.followingYouKnowCount = Following.count({ followeeId: { $in: myFollowingIds }, followerId: _user.id, deletedAt: { $exists: false } }); // Get followers you know count - _user.followers_you_know_count = Following.count({ + _user.followersYouKnowCount = Following.count({ followeeId: _user.id, followerId: { $in: myFollowingIds }, deletedAt: { $exists: false } diff --git a/src/web/app/auth/views/index.vue b/src/web/app/auth/views/index.vue index 690cc4f28e..e1e1b265e1 100644 --- a/src/web/app/auth/views/index.vue +++ b/src/web/app/auth/views/index.vue @@ -14,7 +14,7 @@

このアプリがあなたのアカウントにアクセスすることはありません。

-

{{ session.app.is_authorized ? 'このアプリは既に連携済みです' : 'アプリケーションの連携を許可しました'}}

+

{{ session.app.isAuthorized ? 'このアプリは既に連携済みです' : 'アプリケーションの連携を許可しました' }}

アプリケーションに戻っています

アプリケーションに戻って、やっていってください。

@@ -61,7 +61,7 @@ export default Vue.extend({ this.fetching = false; // 既に連携していた場合 - if (this.session.app.is_authorized) { + if (this.session.app.isAuthorized) { this.$root.$data.os.api('auth/accept', { token: this.session.token }).then(() => { diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag index 225129088d..2abfb106a5 100644 --- a/src/web/app/ch/tags/channel.tag +++ b/src/web/app/ch/tags/channel.tag @@ -5,8 +5,8 @@

{ channel.title }

-

このチャンネルをウォッチしています ウォッチ解除

-

このチャンネルをウォッチする

+

このチャンネルをウォッチしています ウォッチ解除

+

このチャンネルをウォッチする