diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2017-12-22 17:42:03 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-22 17:42:03 +0900 |
| commit | e06dd199a7f3f0b1fd3bd67e06e463c2aa58633c (patch) | |
| tree | 5e9dc021c78288097cc02671f0c9a4ef04a83e2d /src/api/serializers | |
| parent | Fix bug (diff) | |
| parent | Update create.ts (diff) | |
| download | misskey-e06dd199a7f3f0b1fd3bd67e06e463c2aa58633c.tar.gz misskey-e06dd199a7f3f0b1fd3bd67e06e463c2aa58633c.tar.bz2 misskey-e06dd199a7f3f0b1fd3bd67e06e463c2aa58633c.zip | |
Merge pull request #1028 from syuilo/mute
Mute
Diffstat (limited to 'src/api/serializers')
| -rw-r--r-- | src/api/serializers/user.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/api/serializers/user.ts b/src/api/serializers/user.ts index fe924911c1..ac157097a8 100644 --- a/src/api/serializers/user.ts +++ b/src/api/serializers/user.ts @@ -6,6 +6,7 @@ import deepcopy = require('deepcopy'); import { default as User, IUser } from '../models/user'; import serializePost from './post'; import Following from '../models/following'; +import Mute from '../models/mute'; import getFriends from '../common/get-friends'; import config from '../../conf'; import rap from '@prezzemolo/rap'; @@ -113,7 +114,7 @@ export default ( } if (meId && !meId.equals(_user.id)) { - // If the user is following + // Whether the user is following _user.is_following = (async () => { const follow = await Following.findOne({ follower_id: meId, @@ -123,7 +124,7 @@ export default ( return follow !== null; })(); - // If the user is followed + // Whether the user is followed _user.is_followed = (async () => { const follow2 = await Following.findOne({ follower_id: _user.id, @@ -132,6 +133,16 @@ export default ( }); return follow2 !== null; })(); + + // Whether the user is muted + _user.is_muted = (async () => { + const mute = await Mute.findOne({ + muter_id: meId, + mutee_id: _user.id, + deleted_at: { $exists: false } + }); + return mute !== null; + })(); } if (opts.detail) { |