diff --git a/CHANGELOG.md b/CHANGELOG.md index 3246aabe82945495152af7e38037f8d88f37b692..7ab5b1f68d9c36a0ea14d4e885b0dd5b870b87b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ unreleased * ãƒã‚°ã‚¤ãƒ³æ™‚ã«äºŒæ®µéšŽèªè¨¼ãŒåˆ†ã‹ã‚Šã«ãã„ã®ã‚’改善 * 投稿ã®ãƒ„ールãƒãƒƒãƒ—を出ã™ã®ã¯æ™‚é–“ã®ä¸Šã ã‘ã«å¤‰æ›´ * ãƒãƒƒã‚·ãƒ¥ã‚¿ã‚°åˆ¤å®šã®å¼·åŒ– +* ストーク機能ã®å»ƒæ¢ * クライアントã®APIリクエストをストリーム経由ã§è¡Œã†ã‚ªãƒ—ã‚·ãƒ§ãƒ³ã‚’å»ƒæ¢ * 一部箇所ã§ã‚«ã‚¹ã‚¿ãƒ 絵文å—ãŒé©ç”¨ã•ã‚Œã¦ã„ãªã„ã®ã‚’ä¿®æ£ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 2cb1c317dbc763405a976396d559705d300be807..6b70ed08d4f55692ba0908aa410c0f6b64b374e7 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1402,9 +1402,6 @@ desktop/views/pages/user/user.photos.vue: desktop/views/pages/user/user.profile.vue: follows-you: "フォãƒãƒ¼ã•ã‚Œã¦ã„ã¾ã™" - stalk: "ストークã™ã‚‹" - stalking: "ストーã‚ングã—ã¦ã„ã¾ã™" - unstalk: "ストーク解除" menu: "メニュー" desktop/views/pages/user/user.header.vue: diff --git a/src/client/app/desktop/views/pages/user/user.profile.vue b/src/client/app/desktop/views/pages/user/user.profile.vue index 22cbf6546fa72cfd9740ca8ec8d882851afda7e8..5f424432a951d38f831eb004f12382b7bbb88ae3 100644 --- a/src/client/app/desktop/views/pages/user/user.profile.vue +++ b/src/client/app/desktop/views/pages/user/user.profile.vue @@ -3,10 +3,6 @@ <div class="friend-form" v-if="$store.state.i.id != user.id"> <mk-follow-button :user="user" block/> <p class="followed" v-if="user.isFollowed">{{ $t('follows-you') }}</p> - <p class="stalk" v-if="user.isFollowing"> - <span v-if="user.isStalking">{{ $t('stalking') }} <a @click="unstalk"><fa icon="meh"/> {{ $t('unstalk') }}</a></span> - <span v-if="!user.isStalking"><a @click="stalk"><fa icon="user-secret"/> {{ $t('stalk') }}</a></span> - </p> </div> <div class="action-form"> <ui-button @click="menu" ref="menu">{{ $t('menu') }}</ui-button> @@ -24,26 +20,6 @@ export default Vue.extend({ props: ['user'], methods: { - stalk() { - this.$root.api('following/stalk', { - userId: this.user.id - }).then(() => { - this.user.isStalking = true; - }, () => { - alert('error'); - }); - }, - - unstalk() { - this.$root.api('following/unstalk', { - userId: this.user.id - }).then(() => { - this.user.isStalking = false; - }, () => { - alert('error'); - }); - }, - menu() { this.$root.new(XUserMenu, { source: this.$refs.menu.$el, @@ -78,9 +54,6 @@ export default Vue.extend({ background #eefaff border-radius 4px - > .stalk - margin 12px 0 0 0 - > .action-form padding 16px text-align center diff --git a/src/docs/follow.ja-JP.md b/src/docs/follow.ja-JP.md index a883435ab471bf8258869df924052751e8845ce1..28a606e2831e12b361d7d14a67b9647a733a5928 100644 --- a/src/docs/follow.ja-JP.md +++ b/src/docs/follow.ja-JP.md @@ -1,8 +1,3 @@ # フォãƒãƒ¼ ユーザーをフォãƒãƒ¼ã™ã‚‹ã¨ã€ã‚¿ã‚¤ãƒ ラインã«ãã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã®æŠ•ç¨¿ãŒè¡¨ç¤ºã•ã‚Œã‚‹ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚ãŸã ã—ã€ä»–ã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«å¯¾ã™ã‚‹è¿”ä¿¡ã¯å«ã¾ã‚Œã¾ã›ã‚“。 ユーザーをフォãƒãƒ¼ã™ã‚‹ã«ã¯ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ãƒšãƒ¼ã‚¸ã®ã€Œãƒ•ã‚©ãƒãƒ¼ã€ãƒœã‚¿ãƒ³ã‚’クリックã—ã¾ã™ã€‚フォãƒãƒ¼ã‚’解除ã™ã‚‹ã«ã¯ã€ã‚‚ã†ä¸€åº¦ã‚¯ãƒªãƒƒã‚¯ã—ã¾ã™ã€‚ - -## ストーã‚ング -ユーザーをフォãƒãƒ¼ã—ã¦ã„る状態ã§ã¯ã€ã•ã‚‰ã«ã€Œã‚¹ãƒˆãƒ¼ã‚ングã€ãƒ¢ãƒ¼ãƒ‰ã‚’オンã«ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ストーã‚ングを行ã†ã¨ã€ã‚¿ã‚¤ãƒ ラインã«ãã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã®å…¨ã¦ã®æŠ•ç¨¿ãŒè¡¨ç¤ºã•ã‚Œã‚‹ã‚ˆã†ã«ãªã‚Šã¾ã™ã€‚ã¤ã¾ã‚Šã€ä»–ã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«å¯¾ã™ã‚‹è¿”ä¿¡ã‚‚å«ã¾ã‚Œã‚‹ã“ã¨ã«ãªã‚Šã¾ã™ã€‚ -ストーã‚ングã™ã‚‹ã«ã¯ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ãƒšãƒ¼ã‚¸ã®ã€Œã‚¹ãƒˆãƒ¼ã‚¯ã™ã‚‹ã€ã‚’クリックã—ã¾ã™ã€‚ストーã‚ングをやã‚ã‚‹ã«ã¯ã€ã‚‚ã†ä¸€åº¦ã‚¯ãƒªãƒƒã‚¯ã—ã¾ã™ã€‚ -ストーã‚ングã—ã¦ã„ã‚‹ã“ã¨ã¯ç›¸æ‰‹ã«é€šçŸ¥ã•ã‚Œã¾ã›ã‚“。 diff --git a/src/models/following.ts b/src/models/following.ts index 58d55bbeef9e8bb47a4e0a0ba68f82a9dd94adaa..12cc27211bc87d267021bd55c08574e818c37a0b 100644 --- a/src/models/following.ts +++ b/src/models/following.ts @@ -12,7 +12,6 @@ export type IFollowing = { createdAt: Date; followeeId: mongo.ObjectID; followerId: mongo.ObjectID; - stalk: boolean; // éžæ£è¦åŒ– _followee: { diff --git a/src/models/user.ts b/src/models/user.ts index 85dfdf2909d6642a5430bd0e72000af41393f6f8..6987bd3da837e874beda297888a41895c1bca4cf 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -219,7 +219,6 @@ export async function getRelation(me: mongo.ObjectId, target: mongo.ObjectId) { return { id: target, isFollowing: following1 !== null, - isStalking: following1 ? following1.stalk : false, hasPendingFollowRequestFromYou: followReq1 !== null, hasPendingFollowRequestToYou: followReq2 !== null, isFollowed: following2 !== null, @@ -352,7 +351,6 @@ export const pack = ( _user.isFollowing = relation.isFollowing; _user.isFollowed = relation.isFollowed; - _user.isStalking = relation.isStalking; _user.hasPendingFollowRequestFromYou = relation.hasPendingFollowRequestFromYou; _user.hasPendingFollowRequestToYou = relation.hasPendingFollowRequestToYou; _user.isBlocking = relation.isBlocking; diff --git a/src/server/api/common/get-friends.ts b/src/server/api/common/get-friends.ts index e0b05f73df6d7e99ac1e85350bc28ec8731239cb..876aa399f746bdffd64aa0aa68c1ae1d04fd302d 100644 --- a/src/server/api/common/get-friends.ts +++ b/src/server/api/common/get-friends.ts @@ -36,14 +36,12 @@ export const getFriends = async (me: mongodb.ObjectID, includeMe = true, remoteO // ID list of other users who the I follows const myfollowings = followings.map(following => ({ - id: following.followeeId, - stalk: following.stalk + id: following.followeeId })); if (includeMe) { myfollowings.push({ - id: me, - stalk: true + id: me }); } diff --git a/src/server/api/endpoints/following/stalk.ts b/src/server/api/endpoints/following/stalk.ts deleted file mode 100644 index 3a58e2192fa2041f6434d68c0686a02751278efb..0000000000000000000000000000000000000000 --- a/src/server/api/endpoints/following/stalk.ts +++ /dev/null @@ -1,50 +0,0 @@ -import $ from 'cafy'; import ID, { transform } from '../../../../misc/cafy-id'; -import Following from '../../../../models/following'; -import define from '../../define'; - -export const meta = { - desc: { - 'ja-JP': '指定ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚’ストーã‚ングã—ã¾ã™ã€‚', - 'en-US': 'Stalk a user.' - }, - - requireCredential: true, - - kind: 'following-write', - - params: { - userId: { - validator: $.type(ID), - transform: transform, - desc: { - 'ja-JP': '対象ã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã®ID', - 'en-US': 'Target user ID' - } - } - } -}; - -export default define(meta, (ps, user) => new Promise(async (res, rej) => { - const follower = user; - - // Fetch following - const following = await Following.findOne({ - followerId: follower._id, - followeeId: ps.userId - }); - - if (following === null) { - return rej('following not found'); - } - - // Stalk - await Following.update({ _id: following._id }, { - $set: { - stalk: true - } - }); - - res(); - - // TODO: イベント -})); diff --git a/src/server/api/endpoints/following/unstalk.ts b/src/server/api/endpoints/following/unstalk.ts deleted file mode 100644 index ad07ec38ba4a15cf1d5c72d0328c15a46b9e6fb9..0000000000000000000000000000000000000000 --- a/src/server/api/endpoints/following/unstalk.ts +++ /dev/null @@ -1,50 +0,0 @@ -import $ from 'cafy'; import ID, { transform } from '../../../../misc/cafy-id'; -import Following from '../../../../models/following'; -import define from '../../define'; - -export const meta = { - desc: { - 'ja-JP': '指定ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã®ã‚¹ãƒˆãƒ¼ã‚ングをやã‚ã¾ã™ã€‚', - 'en-US': 'Unstalk a user.' - }, - - requireCredential: true, - - kind: 'following-write', - - params: { - userId: { - validator: $.type(ID), - transform: transform, - desc: { - 'ja-JP': '対象ã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã®ID', - 'en-US': 'Target user ID' - } - } - } -}; - -export default define(meta, (ps, user) => new Promise(async (res, rej) => { - const follower = user; - - // Fetch following - const following = await Following.findOne({ - followerId: follower._id, - followeeId: ps.userId - }); - - if (following === null) { - return rej('following not found'); - } - - // Stalk - await Following.update({ _id: following._id }, { - $set: { - stalk: false - } - }); - - res(); - - // TODO: イベント -})); diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts index 919b0662aa7e9472ace21dde22aa48077f6462fa..c05b88a01b9c81678639324755e35dcb403bb17e 100644 --- a/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -119,12 +119,10 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { _id: -1 }; - const followQuery = followings.map(f => f.stalk ? { - userId: f.id - } : { + const followQuery = followings.map(f => ({ userId: f.id, - // ストーã‚ングã—ã¦ãªã„ãªã‚‰ãƒªãƒ—ライã¯å«ã‚ãªã„(ãŸã ã—投稿者自身ã®æŠ•ç¨¿ã¸ã®ãƒªãƒ—ライã€è‡ªåˆ†ã®æŠ•ç¨¿ã¸ã®ãƒªãƒ—ライã€è‡ªåˆ†ã®ãƒªãƒ—ライã¯å«ã‚ã‚‹) + // リプライã¯å«ã‚ãªã„(ãŸã ã—投稿者自身ã®æŠ•ç¨¿ã¸ã®ãƒªãƒ—ライã€è‡ªåˆ†ã®æŠ•ç¨¿ã¸ã®ãƒªãƒ—ライã€è‡ªåˆ†ã®ãƒªãƒ—ライã¯å«ã‚ã‚‹) $or: [{ // リプライã§ãªã„ replyId: null @@ -140,7 +138,7 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { // 自分(フォãƒãƒ¯ãƒ¼)ãŒé€ä¿¡ã—ãŸãƒªãƒ—ライ userId: user._id }] - }); + })); const visibleQuery = user == null ? [{ visibility: { $in: [ 'public', 'home' ] } diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index 24ed222e9a316416aa9a50bbbcd1db2d429b1dd8..9b0cc6ac20f6137dde9087901611179f979ba8bd 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -117,9 +117,7 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { _id: -1 }; - const followQuery = followings.map(f => f.stalk ? { - userId: f.id - } : { + const followQuery = followings.map(f => ({ userId: f.id, // ストーã‚ングã—ã¦ãªã„ãªã‚‰ãƒªãƒ—ライã¯å«ã‚ãªã„(ãŸã ã—投稿者自身ã®æŠ•ç¨¿ã¸ã®ãƒªãƒ—ライã€è‡ªåˆ†ã®æŠ•ç¨¿ã¸ã®ãƒªãƒ—ライã€è‡ªåˆ†ã®ãƒªãƒ—ライã¯å«ã‚ã‚‹) @@ -138,7 +136,7 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { // 自分(フォãƒãƒ¯ãƒ¼)ãŒé€ä¿¡ã—ãŸãƒªãƒ—ライ userId: user._id }] - }); + })); const visibleQuery = user == null ? [{ visibility: { $in: [ 'public', 'home' ] } diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 8031746c89662ab43c40eebaa790116b07fc21b9..f8d1c2408769fdb3c626ebda781ccf0b9562d19c 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -540,12 +540,9 @@ async function publishToFollowers(note: INote, user: IUser, noteActivity: any) { const follower = following._follower; if (isLocalUser(follower)) { - // ストーã‚ングã—ã¦ã„ãªã„å ´åˆ - if (!following.stalk) { - // ã“ã®æŠ•ç¨¿ãŒè¿”ä¿¡ãªã‚‰ã‚¹ã‚ップ - if (note.replyId && !note._reply.userId.equals(following.followerId) && !note._reply.userId.equals(note.userId)) - continue; - } + // ã“ã®æŠ•ç¨¿ãŒè¿”ä¿¡ãªã‚‰ã‚¹ã‚ップ + if (note.replyId && !note._reply.userId.equals(following.followerId) && !note._reply.userId.equals(note.userId)) + continue; // Publish event to followers stream publishHomeTimelineStream(following.followerId, detailPackedNote);