This commit is contained in:
syuilo 2018-03-28 16:59:11 +09:00
parent 1acc30822d
commit 71065077f6
44 changed files with 132 additions and 126 deletions

View file

@ -53,7 +53,6 @@ module.exports = (params) => new Promise(async (res, rej) => {
model: os.cpus()[0].model, model: os.cpus()[0].model,
cores: os.cpus().length cores: os.cpus().length
}, },
top_image: meta.top_image,
broadcasts: meta.broadcasts broadcasts: meta.broadcasts
}); });
}); });

View file

@ -3,9 +3,9 @@ import OthelloGame, { pack } from '../../../models/othello-game';
import Othello from '../../../../common/othello/core'; import Othello from '../../../../common/othello/core';
module.exports = (params, user) => new Promise(async (res, rej) => { module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'game_id' parameter // Get 'gameId' parameter
const [gameId, gameIdErr] = $(params.game_id).id().$; const [gameId, gameIdErr] = $(params.gameId).id().$;
if (gameIdErr) return rej('invalid game_id param'); if (gameIdErr) return rej('invalid gameId param');
const game = await OthelloGame.findOne({ _id: gameId }); const game = await OthelloGame.findOne({ _id: gameId });

View file

@ -211,12 +211,12 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
// 直近の投稿と重複してたらエラー // 直近の投稿と重複してたらエラー
// TODO: 直近の投稿が一日前くらいなら重複とは見なさない // TODO: 直近の投稿が一日前くらいなら重複とは見なさない
if (user.latest_post) { if (user.latestPost) {
if (deepEqual({ if (deepEqual({
text: user.latest_post.text, text: user.latestPost.text,
reply: user.latest_post.replyId ? user.latest_post.replyId.toString() : null, reply: user.latestPost.replyId ? user.latestPost.replyId.toString() : null,
repost: user.latest_post.repostId ? user.latest_post.repostId.toString() : null, repost: user.latestPost.repostId ? user.latestPost.repostId.toString() : null,
mediaIds: (user.latest_post.mediaIds || []).map(id => id.toString()) mediaIds: (user.latestPost.mediaIds || []).map(id => id.toString())
}, { }, {
text: text, text: text,
reply: reply ? reply._id.toString() : null, 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 }, { User.update({ _id: user._id }, {
$set: { $set: {
latest_post: post latestPost: post
} }
}); });
@ -362,7 +362,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
// Increment replies count // Increment replies count
Post.update({ _id: reply._id }, { Post.update({ _id: reply._id }, {
$inc: { $inc: {
replies_count: 1 repliesCount: 1
} }
}); });
@ -457,7 +457,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
// Update repostee status // Update repostee status
Post.update({ _id: repost._id }, { Post.update({ _id: repost._id }, {
$inc: { $inc: {
repost_count: 1 repostCount: 1
} }
}); });
} }

View file

@ -73,7 +73,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
res(); res();
const inc = {}; const inc = {};
inc[`reaction_counts.${reaction}`] = 1; inc[`reactionCounts.${reaction}`] = 1;
// Increment reactions count // Increment reactions count
await Post.update({ _id: post._id }, { await Post.update({ _id: post._id }, {

View file

@ -51,7 +51,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
res(); res();
const dec = {}; const dec = {};
dec[`reaction_counts.${exist.reaction}`] = -1; dec[`reactionCounts.${exist.reaction}`] = -1;
// Decrement reactions count // Decrement reactions count
Post.update({ _id: post._id }, { Post.update({ _id: post._id }, {

View file

@ -21,21 +21,21 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
const [text, textError] = $(params.text).optional.string().$; const [text, textError] = $(params.text).optional.string().$;
if (textError) return rej('invalid text param'); if (textError) return rej('invalid text param');
// Get 'include_userIds' parameter // Get 'includeUserIds' parameter
const [includeUserIds = [], includeUserIdsErr] = $(params.include_userIds).optional.array('id').$; const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array('id').$;
if (includeUserIdsErr) return rej('invalid include_userIds param'); if (includeUserIdsErr) return rej('invalid includeUserIds param');
// Get 'exclude_userIds' parameter // Get 'exclude_userIds' parameter
const [excludeUserIds = [], excludeUserIdsErr] = $(params.exclude_userIds).optional.array('id').$; const [excludeUserIds = [], excludeUserIdsErr] = $(params.exclude_userIds).optional.array('id').$;
if (excludeUserIdsErr) return rej('invalid exclude_userIds param'); if (excludeUserIdsErr) return rej('invalid exclude_userIds param');
// Get 'include_user_usernames' parameter // Get 'includeUserUsernames' parameter
const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.include_user_usernames).optional.array('string').$; const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array('string').$;
if (includeUserUsernamesErr) return rej('invalid include_user_usernames param'); if (includeUserUsernamesErr) return rej('invalid includeUserUsernames param');
// Get 'exclude_user_usernames' parameter // Get 'exclude_userUsernames' parameter
const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.exclude_user_usernames).optional.array('string').$; const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.exclude_userUsernames).optional.array('string').$;
if (excludeUserUsernamesErr) return rej('invalid exclude_user_usernames param'); if (excludeUserUsernamesErr) return rej('invalid exclude_userUsernames param');
// Get 'following' parameter // Get 'following' parameter
const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$; const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$;

View file

@ -41,7 +41,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
createdAt: { createdAt: {
$gte: new Date(Date.now() - ms('1days')) $gte: new Date(Date.now() - ms('1days'))
}, },
repost_count: { repostCount: {
$gt: 0 $gt: 0
} }
} as any; } as any;
@ -68,7 +68,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
limit: limit, limit: limit,
skip: offset, skip: offset,
sort: { sort: {
repost_count: -1, repostCount: -1,
_id: -1 _id: -1
} }
}); });

View file

@ -18,7 +18,7 @@ import User from '../models/user';
* postsCount: * postsCount:
* description: count of all posts of misskey * description: count of all posts of misskey
* type: number * type: number
* users_count: * usersCount:
* description: count of all users of misskey * description: count of all users of misskey
* type: number * type: number
* *
@ -43,6 +43,6 @@ module.exports = params => new Promise(async (res, rej) => {
res({ res({
postsCount: postsCount, postsCount: postsCount,
users_count: usersCount usersCount: usersCount
}); });
}); });

View file

@ -34,13 +34,13 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
return rej('userId or pair of username and host is required'); return rej('userId or pair of username and host is required');
} }
// Get 'include_replies' parameter // Get 'includeReplies' parameter
const [includeReplies = true, includeRepliesErr] = $(params.include_replies).optional.boolean().$; const [includeReplies = true, includeRepliesErr] = $(params.includeReplies).optional.boolean().$;
if (includeRepliesErr) return rej('invalid include_replies param'); if (includeRepliesErr) return rej('invalid includeReplies param');
// Get 'with_media' parameter // Get 'withMedia' parameter
const [withMedia = false, withMediaErr] = $(params.with_media).optional.boolean().$; const [withMedia = false, withMediaErr] = $(params.withMedia).optional.boolean().$;
if (withMediaErr) return rej('invalid with_media param'); if (withMediaErr) return rej('invalid withMedia param');
// Get 'limit' parameter // Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$; const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;

View file

@ -96,7 +96,7 @@ export const pack = (
limit: 1 limit: 1
}); });
_app.is_authorized = exist === 1; _app.isAuthorized = exist === 1;
} }
resolve(_app); resolve(_app);

View file

@ -67,7 +67,7 @@ export const pack = (
deletedAt: { $exists: false } deletedAt: { $exists: false }
}); });
_channel.is_watching = watch !== null; _channel.isWatching = watch !== null;
//#endregion //#endregion
} }

View file

@ -62,8 +62,8 @@ export const pack = (
'metadata.folderId': _folder.id 'metadata.folderId': _folder.id
}); });
_folder.folders_count = childFoldersCount; _folder.foldersCount = childFoldersCount;
_folder.files_count = childFilesCount; _folder.filesCount = childFilesCount;
} }
if (opts.detail && _folder.parentId) { if (opts.detail && _folder.parentId) {

View file

@ -30,6 +30,10 @@ export type IPost = {
userId: mongo.ObjectID; userId: mongo.ObjectID;
appId: mongo.ObjectID; appId: mongo.ObjectID;
viaMobile: boolean; viaMobile: boolean;
repostCount: number;
repliesCount: number;
reactionCounts: any;
mentions: mongo.ObjectID[];
geo: { geo: {
latitude: number; latitude: number;
longitude: number; longitude: number;
@ -184,7 +188,7 @@ export const pack = async (
const myChoice = poll.choices const myChoice = poll.choices
.filter(c => c.id == vote.choice)[0]; .filter(c => c.id == vote.choice)[0];
myChoice.is_voted = true; myChoice.isVoted = true;
} }
return poll; return poll;

View file

@ -88,7 +88,7 @@ export type IUser = {
bannerId: mongo.ObjectID; bannerId: mongo.ObjectID;
data: any; data: any;
description: string; description: string;
latest_post: IPost; latestPost: IPost;
pinnedPostId: mongo.ObjectID; pinnedPostId: mongo.ObjectID;
isSuspended: boolean; isSuspended: boolean;
keywords: string[]; keywords: string[];
@ -167,7 +167,7 @@ export const pack = (
delete _user._id; delete _user._id;
// Remove needless properties // Remove needless properties
delete _user.latest_post; delete _user.latestPost;
if (!_user.host) { if (!_user.host) {
// Remove private properties // Remove private properties
@ -212,7 +212,7 @@ export const pack = (
if (meId && !meId.equals(_user.id)) { if (meId && !meId.equals(_user.id)) {
// Whether the user is following // Whether the user is following
_user.is_following = (async () => { _user.isFollowing = (async () => {
const follow = await Following.findOne({ const follow = await Following.findOne({
followerId: meId, followerId: meId,
followeeId: _user.id, followeeId: _user.id,
@ -222,7 +222,7 @@ export const pack = (
})(); })();
// Whether the user is followed // Whether the user is followed
_user.is_followed = (async () => { _user.isFollowed = (async () => {
const follow2 = await Following.findOne({ const follow2 = await Following.findOne({
followerId: _user.id, followerId: _user.id,
followeeId: meId, followeeId: meId,
@ -232,7 +232,7 @@ export const pack = (
})(); })();
// Whether the user is muted // Whether the user is muted
_user.is_muted = (async () => { _user.isMuted = (async () => {
const mute = await Mute.findOne({ const mute = await Mute.findOne({
muterId: meId, muterId: meId,
muteeId: _user.id, muteeId: _user.id,
@ -254,14 +254,14 @@ export const pack = (
const myFollowingIds = await getFriends(meId); const myFollowingIds = await getFriends(meId);
// Get following you know count // Get following you know count
_user.following_you_know_count = Following.count({ _user.followingYouKnowCount = Following.count({
followeeId: { $in: myFollowingIds }, followeeId: { $in: myFollowingIds },
followerId: _user.id, followerId: _user.id,
deletedAt: { $exists: false } deletedAt: { $exists: false }
}); });
// Get followers you know count // Get followers you know count
_user.followers_you_know_count = Following.count({ _user.followersYouKnowCount = Following.count({
followeeId: _user.id, followeeId: _user.id,
followerId: { $in: myFollowingIds }, followerId: { $in: myFollowingIds },
deletedAt: { $exists: false } deletedAt: { $exists: false }

View file

@ -14,7 +14,7 @@
<p>このアプリがあなたのアカウントにアクセスすることはありません</p> <p>このアプリがあなたのアカウントにアクセスすることはありません</p>
</div> </div>
<div class="accepted" v-if="state == 'accepted'"> <div class="accepted" v-if="state == 'accepted'">
<h1>{{ session.app.is_authorized ? 'このアプリは既に連携済みです' : 'アプリケーションの連携を許可しました'}}</h1> <h1>{{ session.app.isAuthorized ? 'このアプリは既に連携済みです' : 'アプリケーションの連携を許可しました' }}</h1>
<p v-if="session.app.callbackUrl">アプリケーションに戻っています<mk-ellipsis/></p> <p v-if="session.app.callbackUrl">アプリケーションに戻っています<mk-ellipsis/></p>
<p v-if="!session.app.callbackUrl">アプリケーションに戻ってやっていってください</p> <p v-if="!session.app.callbackUrl">アプリケーションに戻ってやっていってください</p>
</div> </div>
@ -61,7 +61,7 @@ export default Vue.extend({
this.fetching = false; this.fetching = false;
// //
if (this.session.app.is_authorized) { if (this.session.app.isAuthorized) {
this.$root.$data.os.api('auth/accept', { this.$root.$data.os.api('auth/accept', {
token: this.session.token token: this.session.token
}).then(() => { }).then(() => {

View file

@ -5,8 +5,8 @@
<h1>{ channel.title }</h1> <h1>{ channel.title }</h1>
<div v-if="$root.$data.os.isSignedIn"> <div v-if="$root.$data.os.isSignedIn">
<p v-if="channel.is_watching">このチャンネルをウォッチしています <a @click="unwatch">ウォッチ解除</a></p> <p v-if="channel.isWatching">このチャンネルをウォッチしています <a @click="unwatch">ウォッチ解除</a></p>
<p v-if="!channel.is_watching"><a @click="watch">このチャンネルをウォッチする</a></p> <p v-if="!channel.isWatching"><a @click="watch">このチャンネルをウォッチする</a></p>
</div> </div>
<div class="share"> <div class="share">
@ -142,7 +142,7 @@
this.$root.$data.os.api('channels/watch', { this.$root.$data.os.api('channels/watch', {
channelId: this.id channelId: this.id
}).then(() => { }).then(() => {
this.channel.is_watching = true; this.channel.isWatching = true;
this.update(); this.update();
}, e => { }, e => {
alert('error'); alert('error');
@ -153,7 +153,7 @@
this.$root.$data.os.api('channels/unwatch', { this.$root.$data.os.api('channels/unwatch', {
channelId: this.id channelId: this.id
}).then(() => { }).then(() => {
this.channel.is_watching = false; this.channel.isWatching = false;
this.update(); this.update();
}, e => { }, e => {
alert('error'); alert('error');

View file

@ -8,10 +8,10 @@ export default function(qs: string) {
const [key, value] = x.split(':'); const [key, value] = x.split(':');
switch (key) { switch (key) {
case 'user': case 'user':
q['include_user_usernames'] = value.split(','); q['includeUserUsernames'] = value.split(',');
break; break;
case 'exclude_user': case 'exclude_user':
q['exclude_user_usernames'] = value.split(','); q['exclude_userUsernames'] = value.split(',');
break; break;
case 'follow': case 'follow':
q['following'] = value == 'null' ? null : value == 'true'; q['following'] = value == 'null' ? null : value == 'true';

View file

@ -9,7 +9,7 @@
<button class="delete-button" v-if="isMe" title="%i18n:common.delete%"> <button class="delete-button" v-if="isMe" title="%i18n:common.delete%">
<img src="/assets/desktop/messaging/delete.png" alt="Delete"/> <img src="/assets/desktop/messaging/delete.png" alt="Delete"/>
</button> </button>
<div class="content" v-if="!message.is_deleted"> <div class="content" v-if="!message.isDeleted">
<mk-post-html class="text" v-if="message.ast" :ast="message.ast" :i="os.i"/> <mk-post-html class="text" v-if="message.ast" :ast="message.ast" :i="os.i"/>
<div class="file" v-if="message.file"> <div class="file" v-if="message.file">
<a :href="message.file.url" target="_blank" :title="message.file.name"> <a :href="message.file.url" target="_blank" :title="message.file.name">
@ -18,7 +18,7 @@
</a> </a>
</div> </div>
</div> </div>
<div class="content" v-if="message.is_deleted"> <div class="content" v-if="message.isDeleted">
<p class="is-deleted">%i18n:common.tags.mk-messaging-message.deleted%</p> <p class="is-deleted">%i18n:common.tags.mk-messaging-message.deleted%</p>
</div> </div>
</div> </div>

View file

@ -133,7 +133,7 @@ export default Vue.extend({
methods: { methods: {
go(game) { go(game) {
(this as any).api('othello/games/show', { (this as any).api('othello/games/show', {
game_id: game.id gameId: game.id
}).then(game => { }).then(game => {
this.matching = null; this.matching = null;
this.game = game; this.game = game;

View file

@ -4,7 +4,7 @@
<li v-for="choice in poll.choices" :key="choice.id" @click="vote(choice.id)" :class="{ voted: choice.voted }" :title="!isVoted ? '%i18n:common.tags.mk-poll.vote-to%'.replace('{}', choice.text) : ''"> <li v-for="choice in poll.choices" :key="choice.id" @click="vote(choice.id)" :class="{ voted: choice.voted }" :title="!isVoted ? '%i18n:common.tags.mk-poll.vote-to%'.replace('{}', choice.text) : ''">
<div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div> <div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div>
<span> <span>
<template v-if="choice.is_voted">%fa:check%</template> <template v-if="choice.isVoted">%fa:check%</template>
<span>{{ choice.text }}</span> <span>{{ choice.text }}</span>
<span class="votes" v-if="showResult">({{ '%i18n:common.tags.mk-poll.vote-count%'.replace('{}', choice.votes) }})</span> <span class="votes" v-if="showResult">({{ '%i18n:common.tags.mk-poll.vote-count%'.replace('{}', choice.votes) }})</span>
</span> </span>
@ -36,7 +36,7 @@ export default Vue.extend({
return this.poll.choices.reduce((a, b) => a + b.votes, 0); return this.poll.choices.reduce((a, b) => a + b.votes, 0);
}, },
isVoted(): boolean { isVoted(): boolean {
return this.poll.choices.some(c => c.is_voted); return this.poll.choices.some(c => c.isVoted);
} }
}, },
created() { created() {
@ -47,7 +47,7 @@ export default Vue.extend({
this.showResult = !this.showResult; this.showResult = !this.showResult;
}, },
vote(id) { vote(id) {
if (this.poll.choices.some(c => c.is_voted)) return; if (this.poll.choices.some(c => c.isVoted)) return;
(this as any).api('posts/polls/vote', { (this as any).api('posts/polls/vote', {
postId: this.post.id, postId: this.post.id,
choice: id choice: id
@ -55,7 +55,7 @@ export default Vue.extend({
this.poll.choices.forEach(c => { this.poll.choices.forEach(c => {
if (c.id == id) { if (c.id == id) {
c.votes++; c.votes++;
Vue.set(c, 'is_voted', true); Vue.set(c, 'isVoted', true);
} }
}); });
this.showResult = true; this.showResult = true;

View file

@ -20,7 +20,7 @@ export default Vue.extend({
props: ['post'], props: ['post'],
computed: { computed: {
reactions(): number { reactions(): number {
return this.post.reaction_counts; return this.post.reactionCounts;
} }
} }
}); });

View file

@ -1,15 +1,15 @@
<template> <template>
<button class="mk-follow-button" <button class="mk-follow-button"
:class="{ wait, follow: !user.is_following, unfollow: user.is_following, big: size == 'big' }" :class="{ wait, follow: !user.isFollowing, unfollow: user.isFollowing, big: size == 'big' }"
@click="onClick" @click="onClick"
:disabled="wait" :disabled="wait"
:title="user.is_following ? 'フォロー解除' : 'フォローする'" :title="user.isFollowing ? 'フォロー解除' : 'フォローする'"
> >
<template v-if="!wait && user.is_following"> <template v-if="!wait && user.isFollowing">
<template v-if="size == 'compact'">%fa:minus%</template> <template v-if="size == 'compact'">%fa:minus%</template>
<template v-if="size == 'big'">%fa:minus%フォロー解除</template> <template v-if="size == 'big'">%fa:minus%フォロー解除</template>
</template> </template>
<template v-if="!wait && !user.is_following"> <template v-if="!wait && !user.isFollowing">
<template v-if="size == 'compact'">%fa:plus%</template> <template v-if="size == 'compact'">%fa:plus%</template>
<template v-if="size == 'big'">%fa:plus%フォロー</template> <template v-if="size == 'big'">%fa:plus%フォロー</template>
</template> </template>
@ -53,23 +53,23 @@ export default Vue.extend({
onFollow(user) { onFollow(user) {
if (user.id == this.user.id) { if (user.id == this.user.id) {
this.user.is_following = user.is_following; this.user.isFollowing = user.isFollowing;
} }
}, },
onUnfollow(user) { onUnfollow(user) {
if (user.id == this.user.id) { if (user.id == this.user.id) {
this.user.is_following = user.is_following; this.user.isFollowing = user.isFollowing;
} }
}, },
onClick() { onClick() {
this.wait = true; this.wait = true;
if (this.user.is_following) { if (this.user.isFollowing) {
(this as any).api('following/delete', { (this as any).api('following/delete', {
userId: this.user.id userId: this.user.id
}).then(() => { }).then(() => {
this.user.is_following = false; this.user.isFollowing = false;
}).catch(err => { }).catch(err => {
console.error(err); console.error(err);
}).then(() => { }).then(() => {
@ -79,7 +79,7 @@ export default Vue.extend({
(this as any).api('following/create', { (this as any).api('following/create', {
userId: this.user.id userId: this.user.id
}).then(() => { }).then(() => {
this.user.is_following = true; this.user.isFollowing = true;
}).catch(err => { }).catch(err => {
console.error(err); console.error(err);
}).then(() => { }).then(() => {

View file

@ -2,7 +2,7 @@
<mk-users-list <mk-users-list
:fetch="fetch" :fetch="fetch"
:count="user.followersCount" :count="user.followersCount"
:you-know-count="user.followers_you_know_count" :you-know-count="user.followersYouKnowCount"
> >
フォロワーはいないようです フォロワーはいないようです
</mk-users-list> </mk-users-list>

View file

@ -2,7 +2,7 @@
<mk-users-list <mk-users-list
:fetch="fetch" :fetch="fetch"
:count="user.followingCount" :count="user.followingCount"
:you-know-count="user.following_you_know_count" :you-know-count="user.followingYouKnowCount"
> >
フォロー中のユーザーはいないようです フォロー中のユーザーはいないようです
</mk-users-list> </mk-users-list>

View file

@ -56,10 +56,10 @@
<footer> <footer>
<mk-reactions-viewer :post="p"/> <mk-reactions-viewer :post="p"/>
<button @click="reply" title="返信"> <button @click="reply" title="返信">
%fa:reply%<p class="count" v-if="p.replies_count > 0">{{ p.replies_count }}</p> %fa:reply%<p class="count" v-if="p.repliesCount > 0">{{ p.repliesCount }}</p>
</button> </button>
<button @click="repost" title="Repost"> <button @click="repost" title="Repost">
%fa:retweet%<p class="count" v-if="p.repost_count > 0">{{ p.repost_count }}</p> %fa:retweet%<p class="count" v-if="p.repostCount > 0">{{ p.repostCount }}</p>
</button> </button>
<button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="リアクション"> <button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="リアクション">
%fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p> %fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p>
@ -122,9 +122,9 @@ export default Vue.extend({
return this.isRepost ? this.post.repost : this.post; return this.isRepost ? this.post.repost : this.post;
}, },
reactionsCount(): number { reactionsCount(): number {
return this.p.reaction_counts return this.p.reactionCounts
? Object.keys(this.p.reaction_counts) ? Object.keys(this.p.reactionCounts)
.map(key => this.p.reaction_counts[key]) .map(key => this.p.reactionCounts[key])
.reduce((a, b) => a + b) .reduce((a, b) => a + b)
: 0; : 0;
}, },

View file

@ -58,10 +58,10 @@
<footer> <footer>
<mk-reactions-viewer :post="p" ref="reactionsViewer"/> <mk-reactions-viewer :post="p" ref="reactionsViewer"/>
<button @click="reply" title="%i18n:desktop.tags.mk-timeline-post.reply%"> <button @click="reply" title="%i18n:desktop.tags.mk-timeline-post.reply%">
%fa:reply%<p class="count" v-if="p.replies_count > 0">{{ p.replies_count }}</p> %fa:reply%<p class="count" v-if="p.repliesCount > 0">{{ p.repliesCount }}</p>
</button> </button>
<button @click="repost" title="%i18n:desktop.tags.mk-timeline-post.repost%"> <button @click="repost" title="%i18n:desktop.tags.mk-timeline-post.repost%">
%fa:retweet%<p class="count" v-if="p.repost_count > 0">{{ p.repost_count }}</p> %fa:retweet%<p class="count" v-if="p.repostCount > 0">{{ p.repostCount }}</p>
</button> </button>
<button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="%i18n:desktop.tags.mk-timeline-post.add-reaction%"> <button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="%i18n:desktop.tags.mk-timeline-post.add-reaction%">
%fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p> %fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p>
@ -129,9 +129,9 @@ export default Vue.extend({
return this.isRepost ? this.post.repost : this.post; return this.isRepost ? this.post.repost : this.post;
}, },
reactionsCount(): number { reactionsCount(): number {
return this.p.reaction_counts return this.p.reactionCounts
? Object.keys(this.p.reaction_counts) ? Object.keys(this.p.reactionCounts)
.map(key => this.p.reaction_counts[key]) .map(key => this.p.reactionCounts[key])
.reduce((a, b) => a + b) .reduce((a, b) => a + b)
: 0; : 0;
}, },

View file

@ -9,7 +9,7 @@
<span class="username">@{{ acct }}</span> <span class="username">@{{ acct }}</span>
</header> </header>
<div class="body"> <div class="body">
<p class="followed" v-if="user.is_followed">フォローされています</p> <p class="followed" v-if="user.isFollowed">フォローされています</p>
<div class="description">{{ user.description }}</div> <div class="description">{{ user.description }}</div>
</div> </div>
</div> </div>

View file

@ -34,7 +34,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this as any).api('othello/games/show', { (this as any).api('othello/games/show', {
game_id: this.$route.params.game gameId: this.$route.params.game
}).then(game => { }).then(game => {
this.game = game; this.game = game;
this.fetching = false; this.fetching = false;

View file

@ -24,7 +24,7 @@ export default Vue.extend({
mounted() { mounted() {
(this as any).api('users/posts', { (this as any).api('users/posts', {
userId: this.user.id, userId: this.user.id,
with_media: true, withMedia: true,
limit: 9 limit: 9
}).then(posts => { }).then(posts => {
posts.forEach(post => { posts.forEach(post => {

View file

@ -2,9 +2,9 @@
<div class="profile"> <div class="profile">
<div class="friend-form" v-if="os.isSignedIn && os.i.id != user.id"> <div class="friend-form" v-if="os.isSignedIn && os.i.id != user.id">
<mk-follow-button :user="user" size="big"/> <mk-follow-button :user="user" size="big"/>
<p class="followed" v-if="user.is_followed">%i18n:desktop.tags.mk-user.follows-you%</p> <p class="followed" v-if="user.isFollowed">%i18n:desktop.tags.mk-user.follows-you%</p>
<p v-if="user.is_muted">%i18n:desktop.tags.mk-user.muted% <a @click="unmute">%i18n:desktop.tags.mk-user.unmute%</a></p> <p v-if="user.isMuted">%i18n:desktop.tags.mk-user.muted% <a @click="unmute">%i18n:desktop.tags.mk-user.unmute%</a></p>
<p v-if="!user.is_muted"><a @click="mute">%i18n:desktop.tags.mk-user.mute%</a></p> <p v-if="!user.isMuted"><a @click="mute">%i18n:desktop.tags.mk-user.mute%</a></p>
</div> </div>
<div class="description" v-if="user.description">{{ user.description }}</div> <div class="description" v-if="user.description">{{ user.description }}</div>
<div class="birthday" v-if="user.host === null && user.account.profile.birthday"> <div class="birthday" v-if="user.host === null && user.account.profile.birthday">
@ -51,7 +51,7 @@ export default Vue.extend({
(this as any).api('mute/create', { (this as any).api('mute/create', {
userId: this.user.id userId: this.user.id
}).then(() => { }).then(() => {
this.user.is_muted = true; this.user.isMuted = true;
}, () => { }, () => {
alert('error'); alert('error');
}); });
@ -61,7 +61,7 @@ export default Vue.extend({
(this as any).api('mute/delete', { (this as any).api('mute/delete', {
userId: this.user.id userId: this.user.id
}).then(() => { }).then(() => {
this.user.is_muted = false; this.user.isMuted = false;
}, () => { }, () => {
alert('error'); alert('error');
}); });

View file

@ -19,10 +19,10 @@
<div class="browser" :class="{ fetching }" v-if="file == null"> <div class="browser" :class="{ fetching }" v-if="file == null">
<div class="info" v-if="info"> <div class="info" v-if="info">
<p v-if="folder == null">{{ (info.usage / info.capacity * 100).toFixed(1) }}% %i18n:mobile.tags.mk-drive.used%</p> <p v-if="folder == null">{{ (info.usage / info.capacity * 100).toFixed(1) }}% %i18n:mobile.tags.mk-drive.used%</p>
<p v-if="folder != null && (folder.folders_count > 0 || folder.files_count > 0)"> <p v-if="folder != null && (folder.foldersCount > 0 || folder.filesCount > 0)">
<template v-if="folder.folders_count > 0">{{ folder.folders_count }} %i18n:mobile.tags.mk-drive.folder-count%</template> <template v-if="folder.foldersCount > 0">{{ folder.foldersCount }} %i18n:mobile.tags.mk-drive.folder-count%</template>
<template v-if="folder.folders_count > 0 && folder.files_count > 0">%i18n:mobile.tags.mk-drive.count-separator%</template> <template v-if="folder.foldersCount > 0 && folder.filesCount > 0">%i18n:mobile.tags.mk-drive.count-separator%</template>
<template v-if="folder.files_count > 0">{{ folder.files_count }} %i18n:mobile.tags.mk-drive.file-count%</template> <template v-if="folder.filesCount > 0">{{ folder.filesCount }} %i18n:mobile.tags.mk-drive.file-count%</template>
</p> </p>
</div> </div>
<div class="folders" v-if="folders.length > 0"> <div class="folders" v-if="folders.length > 0">

View file

@ -1,13 +1,13 @@
<template> <template>
<button class="mk-follow-button" <button class="mk-follow-button"
:class="{ wait: wait, follow: !user.is_following, unfollow: user.is_following }" :class="{ wait: wait, follow: !user.isFollowing, unfollow: user.isFollowing }"
@click="onClick" @click="onClick"
:disabled="wait" :disabled="wait"
> >
<template v-if="!wait && user.is_following">%fa:minus%</template> <template v-if="!wait && user.isFollowing">%fa:minus%</template>
<template v-if="!wait && !user.is_following">%fa:plus%</template> <template v-if="!wait && !user.isFollowing">%fa:plus%</template>
<template v-if="wait">%fa:spinner .pulse .fw%</template> <template v-if="wait">%fa:spinner .pulse .fw%</template>
{{ user.is_following ? '%i18n:mobile.tags.mk-follow-button.unfollow%' : '%i18n:mobile.tags.mk-follow-button.follow%' }} {{ user.isFollowing ? '%i18n:mobile.tags.mk-follow-button.unfollow%' : '%i18n:mobile.tags.mk-follow-button.follow%' }}
</button> </button>
</template> </template>
@ -43,23 +43,23 @@ export default Vue.extend({
onFollow(user) { onFollow(user) {
if (user.id == this.user.id) { if (user.id == this.user.id) {
this.user.is_following = user.is_following; this.user.isFollowing = user.isFollowing;
} }
}, },
onUnfollow(user) { onUnfollow(user) {
if (user.id == this.user.id) { if (user.id == this.user.id) {
this.user.is_following = user.is_following; this.user.isFollowing = user.isFollowing;
} }
}, },
onClick() { onClick() {
this.wait = true; this.wait = true;
if (this.user.is_following) { if (this.user.isFollowing) {
(this as any).api('following/delete', { (this as any).api('following/delete', {
userId: this.user.id userId: this.user.id
}).then(() => { }).then(() => {
this.user.is_following = false; this.user.isFollowing = false;
}).catch(err => { }).catch(err => {
console.error(err); console.error(err);
}).then(() => { }).then(() => {
@ -69,7 +69,7 @@ export default Vue.extend({
(this as any).api('following/create', { (this as any).api('following/create', {
userId: this.user.id userId: this.user.id
}).then(() => { }).then(() => {
this.user.is_following = true; this.user.isFollowing = true;
}).catch(err => { }).catch(err => {
console.error(err); console.error(err);
}).then(() => { }).then(() => {

View file

@ -59,10 +59,10 @@
<footer> <footer>
<mk-reactions-viewer :post="p"/> <mk-reactions-viewer :post="p"/>
<button @click="reply" title="%i18n:mobile.tags.mk-post-detail.reply%"> <button @click="reply" title="%i18n:mobile.tags.mk-post-detail.reply%">
%fa:reply%<p class="count" v-if="p.replies_count > 0">{{ p.replies_count }}</p> %fa:reply%<p class="count" v-if="p.repliesCount > 0">{{ p.repliesCount }}</p>
</button> </button>
<button @click="repost" title="Repost"> <button @click="repost" title="Repost">
%fa:retweet%<p class="count" v-if="p.repost_count > 0">{{ p.repost_count }}</p> %fa:retweet%<p class="count" v-if="p.repostCount > 0">{{ p.repostCount }}</p>
</button> </button>
<button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="%i18n:mobile.tags.mk-post-detail.reaction%"> <button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="%i18n:mobile.tags.mk-post-detail.reaction%">
%fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p> %fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p>
@ -122,9 +122,9 @@ export default Vue.extend({
return this.isRepost ? this.post.repost : this.post; return this.isRepost ? this.post.repost : this.post;
}, },
reactionsCount(): number { reactionsCount(): number {
return this.p.reaction_counts return this.p.reactionCounts
? Object.keys(this.p.reaction_counts) ? Object.keys(this.p.reactionCounts)
.map(key => this.p.reaction_counts[key]) .map(key => this.p.reactionCounts[key])
.reduce((a, b) => a + b) .reduce((a, b) => a + b)
: 0; : 0;
}, },

View file

@ -58,10 +58,10 @@
<footer> <footer>
<mk-reactions-viewer :post="p" ref="reactionsViewer"/> <mk-reactions-viewer :post="p" ref="reactionsViewer"/>
<button @click="reply"> <button @click="reply">
%fa:reply%<p class="count" v-if="p.replies_count > 0">{{ p.replies_count }}</p> %fa:reply%<p class="count" v-if="p.repliesCount > 0">{{ p.repliesCount }}</p>
</button> </button>
<button @click="repost" title="Repost"> <button @click="repost" title="Repost">
%fa:retweet%<p class="count" v-if="p.repost_count > 0">{{ p.repost_count }}</p> %fa:retweet%<p class="count" v-if="p.repostCount > 0">{{ p.repostCount }}</p>
</button> </button>
<button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton"> <button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton">
%fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p> %fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p>
@ -110,9 +110,9 @@ export default Vue.extend({
return this.isRepost ? this.post.repost : this.post; return this.isRepost ? this.post.repost : this.post;
}, },
reactionsCount(): number { reactionsCount(): number {
return this.p.reaction_counts return this.p.reactionCounts
? Object.keys(this.p.reaction_counts) ? Object.keys(this.p.reactionCounts)
.map(key => this.p.reaction_counts[key]) .map(key => this.p.reactionCounts[key])
.reduce((a, b) => a + b) .reduce((a, b) => a + b)
: 0; : 0;
}, },

View file

@ -34,7 +34,7 @@ export default Vue.extend({
mounted() { mounted() {
(this as any).api('users/posts', { (this as any).api('users/posts', {
userId: this.user.id, userId: this.user.id,
with_media: this.withMedia, withMedia: this.withMedia,
limit: limit + 1 limit: limit + 1
}).then(posts => { }).then(posts => {
if (posts.length == limit + 1) { if (posts.length == limit + 1) {
@ -51,7 +51,7 @@ export default Vue.extend({
this.moreFetching = true; this.moreFetching = true;
(this as any).api('users/posts', { (this as any).api('users/posts', {
userId: this.user.id, userId: this.user.id,
with_media: this.withMedia, withMedia: this.withMedia,
limit: limit + 1, limit: limit + 1,
untilId: this.posts[this.posts.length - 1].id untilId: this.posts[this.posts.length - 1].id
}).then(posts => { }).then(posts => {

View file

@ -8,7 +8,7 @@
v-if="!fetching" v-if="!fetching"
:fetch="fetchUsers" :fetch="fetchUsers"
:count="user.followersCount" :count="user.followersCount"
:you-know-count="user.followers_you_know_count" :you-know-count="user.followersYouKnowCount"
@loaded="onLoaded" @loaded="onLoaded"
> >
%i18n:mobile.tags.mk-user-followers.no-users% %i18n:mobile.tags.mk-user-followers.no-users%

View file

@ -8,7 +8,7 @@
v-if="!fetching" v-if="!fetching"
:fetch="fetchUsers" :fetch="fetchUsers"
:count="user.followingCount" :count="user.followingCount"
:you-know-count="user.following_you_know_count" :you-know-count="user.followingYouKnowCount"
@loaded="onLoaded" @loaded="onLoaded"
> >
%i18n:mobile.tags.mk-user-following.no-users% %i18n:mobile.tags.mk-user-following.no-users%

View file

@ -34,7 +34,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this as any).api('othello/games/show', { (this as any).api('othello/games/show', {
game_id: this.$route.params.game gameId: this.$route.params.game
}).then(game => { }).then(game => {
this.game = game; this.game = game;
this.fetching = false; this.fetching = false;

View file

@ -14,7 +14,7 @@
<div class="title"> <div class="title">
<h1>{{ user.name }}</h1> <h1>{{ user.name }}</h1>
<span class="username">@{{ acct }}</span> <span class="username">@{{ acct }}</span>
<span class="followed" v-if="user.is_followed">%i18n:mobile.tags.mk-user.follows-you%</span> <span class="followed" v-if="user.isFollowed">%i18n:mobile.tags.mk-user.follows-you%</span>
</div> </div>
<div class="description">{{ user.description }}</div> <div class="description">{{ user.description }}</div>
<div class="info"> <div class="info">

View file

@ -30,7 +30,7 @@ export default Vue.extend({
mounted() { mounted() {
(this as any).api('users/posts', { (this as any).api('users/posts', {
userId: this.user.id, userId: this.user.id,
with_media: true, withMedia: true,
limit: 6 limit: 6
}).then(posts => { }).then(posts => {
posts.forEach(post => { posts.forEach(post => {

View file

@ -83,7 +83,7 @@
</mk-posts> </mk-posts>
<mk-users> <mk-users>
<h2>%i18n:stats.users-count% <b>{ stats.users_count }</b></h2> <h2>%i18n:stats.users-count% <b>{ stats.usersCount }</b></h2>
<mk-users-chart v-if="!initializing" data={ data }/> <mk-users-chart v-if="!initializing" data={ data }/>
<style lang="stylus" scoped> <style lang="stylus" scoped>
:scope :scope

View file

@ -59,7 +59,7 @@ props:
desc: desc:
ja: "この投稿に対する自分の<a href='/docs/api/reactions'>リアクション</a>" ja: "この投稿に対する自分の<a href='/docs/api/reactions'>リアクション</a>"
en: "The your <a href='/docs/api/reactions'>reaction</a> of this post" en: "The your <a href='/docs/api/reactions'>reaction</a> of this post"
- name: "reaction_counts" - name: "reactionCounts"
type: "object" type: "object"
optional: false optional: false
desc: desc:
@ -110,7 +110,7 @@ props:
desc: desc:
ja: "選択肢ID" ja: "選択肢ID"
en: "The ID of this choice" en: "The ID of this choice"
- name: "is_voted" - name: "isVoted"
type: "boolean" type: "boolean"
optional: true optional: true
desc: desc:

View file

@ -65,17 +65,17 @@ props:
desc: desc:
ja: "フォローしているユーザーの数" ja: "フォローしているユーザーの数"
en: "The number of the following users for this user" en: "The number of the following users for this user"
- name: "is_following" - name: "isFollowing"
type: "boolean" type: "boolean"
optional: true optional: true
desc: desc:
ja: "自分がこのユーザーをフォローしているか" ja: "自分がこのユーザーをフォローしているか"
- name: "is_followed" - name: "isFollowed"
type: "boolean" type: "boolean"
optional: true optional: true
desc: desc:
ja: "自分がこのユーザーにフォローされているか" ja: "自分がこのユーザーにフォローされているか"
- name: "is_muted" - name: "isMuted"
type: "boolean" type: "boolean"
optional: true optional: true
desc: desc:

View file

@ -176,6 +176,9 @@ db.posts.update({}, {
reply_id: 'replyId', reply_id: 'replyId',
repost_id: 'repostId', repost_id: 'repostId',
via_mobile: 'viaMobile', via_mobile: 'viaMobile',
reaction_counts: 'reactionCounts',
replies_count: 'repliesCount',
repost_count: 'repostCount',
'_reply.user_id': '_reply.userId', '_reply.user_id': '_reply.userId',
'_repost.user_id': '_repost.userId', '_repost.user_id': '_repost.userId',
} }