wip
This commit is contained in:
parent
26b40d8886
commit
34923888c7
6 changed files with 58 additions and 3 deletions
|
@ -473,6 +473,11 @@ desktop:
|
||||||
mk-user:
|
mk-user:
|
||||||
last-used-at: "Last used at"
|
last-used-at: "Last used at"
|
||||||
|
|
||||||
|
follows-you: "Follows you"
|
||||||
|
mute: "Mute"
|
||||||
|
muted: "Muting"
|
||||||
|
unmute: "Unmute"
|
||||||
|
|
||||||
photos:
|
photos:
|
||||||
title: "Photos"
|
title: "Photos"
|
||||||
loading: "Loading"
|
loading: "Loading"
|
||||||
|
|
|
@ -473,6 +473,11 @@ desktop:
|
||||||
mk-user:
|
mk-user:
|
||||||
last-used-at: "最終アクセス"
|
last-used-at: "最終アクセス"
|
||||||
|
|
||||||
|
follows-you: "フォローされています"
|
||||||
|
mute: "ミュートする"
|
||||||
|
muted: "ミュートしています"
|
||||||
|
unmute: "ミュート解除"
|
||||||
|
|
||||||
photos:
|
photos:
|
||||||
title: "フォト"
|
title: "フォト"
|
||||||
loading: "読み込み中"
|
loading: "読み込み中"
|
||||||
|
|
|
@ -6,6 +6,7 @@ import deepcopy = require('deepcopy');
|
||||||
import { default as User, IUser } from '../models/user';
|
import { default as User, IUser } from '../models/user';
|
||||||
import serializePost from './post';
|
import serializePost from './post';
|
||||||
import Following from '../models/following';
|
import Following from '../models/following';
|
||||||
|
import Mute from '../models/mute';
|
||||||
import getFriends from '../common/get-friends';
|
import getFriends from '../common/get-friends';
|
||||||
import config from '../../conf';
|
import config from '../../conf';
|
||||||
import rap from '@prezzemolo/rap';
|
import rap from '@prezzemolo/rap';
|
||||||
|
@ -113,7 +114,7 @@ export default (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meId && !meId.equals(_user.id)) {
|
if (meId && !meId.equals(_user.id)) {
|
||||||
// If the user is following
|
// Whether the user is following
|
||||||
_user.is_following = (async () => {
|
_user.is_following = (async () => {
|
||||||
const follow = await Following.findOne({
|
const follow = await Following.findOne({
|
||||||
follower_id: meId,
|
follower_id: meId,
|
||||||
|
@ -123,7 +124,7 @@ export default (
|
||||||
return follow !== null;
|
return follow !== null;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// If the user is followed
|
// Whether the user is followed
|
||||||
_user.is_followed = (async () => {
|
_user.is_followed = (async () => {
|
||||||
const follow2 = await Following.findOne({
|
const follow2 = await Following.findOne({
|
||||||
follower_id: _user.id,
|
follower_id: _user.id,
|
||||||
|
@ -132,6 +133,16 @@ export default (
|
||||||
});
|
});
|
||||||
return follow2 !== null;
|
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) {
|
if (opts.detail) {
|
||||||
|
|
|
@ -226,7 +226,9 @@
|
||||||
<mk-user-profile>
|
<mk-user-profile>
|
||||||
<div class="friend-form" if={ SIGNIN && I.id != user.id }>
|
<div class="friend-form" if={ SIGNIN && I.id != user.id }>
|
||||||
<mk-big-follow-button user={ user }/>
|
<mk-big-follow-button user={ user }/>
|
||||||
<p class="followed" if={ user.is_followed }>フォローされています</p>
|
<p class="followed" if={ user.is_followed }>%i18n:desktop.tags.mk-user.follows-you%</p>
|
||||||
|
<p if={ user.is_muted }>%i18n:desktop.tags.mk-user.muted% <a onclick={ unmute }>%i18n:desktop.tags.mk-user.unmute%</a></p>
|
||||||
|
<p if={ !user.is_muted }><a onclick={ mute }>%i18n:desktop.tags.mk-user.mute%</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="description" if={ user.description }>{ user.description }</div>
|
<div class="description" if={ user.description }>{ user.description }</div>
|
||||||
<div class="birthday" if={ user.profile.birthday }>
|
<div class="birthday" if={ user.profile.birthday }>
|
||||||
|
@ -311,6 +313,7 @@
|
||||||
this.age = require('s-age');
|
this.age = require('s-age');
|
||||||
|
|
||||||
this.mixin('i');
|
this.mixin('i');
|
||||||
|
this.mixin('api');
|
||||||
|
|
||||||
this.user = this.opts.user;
|
this.user = this.opts.user;
|
||||||
|
|
||||||
|
@ -325,6 +328,28 @@
|
||||||
user: this.user
|
user: this.user
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.mute = () => {
|
||||||
|
this.api('mute/create', {
|
||||||
|
user_id: this.user.id
|
||||||
|
}).then(() => {
|
||||||
|
this.user.is_muted = true;
|
||||||
|
this.update();
|
||||||
|
}, e => {
|
||||||
|
alert('error');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.unmute = () => {
|
||||||
|
this.api('mute/delete', {
|
||||||
|
user_id: this.user.id
|
||||||
|
}).then(() => {
|
||||||
|
this.user.is_muted = false;
|
||||||
|
this.update();
|
||||||
|
}, e => {
|
||||||
|
alert('error');
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-user-profile>
|
</mk-user-profile>
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,12 @@ props:
|
||||||
optional: true
|
optional: true
|
||||||
desc:
|
desc:
|
||||||
ja: "自分がこのユーザーにフォローされているか"
|
ja: "自分がこのユーザーにフォローされているか"
|
||||||
|
- name: "is_muted"
|
||||||
|
type: "boolean"
|
||||||
|
optional: true
|
||||||
|
desc:
|
||||||
|
ja: "自分がこのユーザーをミュートしているか"
|
||||||
|
en: "Whether you muted this user"
|
||||||
- name: "last_used_at"
|
- name: "last_used_at"
|
||||||
type: "date"
|
type: "date"
|
||||||
optional: false
|
optional: false
|
||||||
|
|
3
src/web/docs/mute.ja.pug
Normal file
3
src/web/docs/mute.ja.pug
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
h1 ミュート
|
||||||
|
|
||||||
|
p ユーザーをミュートすると、タイムラインや検索結果に対象のユーザーの投稿(およびそれらの投稿に対する返信やRepost)が表示されなくなります。
|
Loading…
Reference in a new issue