enhance: チャットの閲覧を無効化できるように (#15765)
* enhance: チャットの閲覧を無効化できるように * fix * fix * fix * readonlyの説明を追加 * enhance: チャットが無効な場合はチャット関連の設定も隠すように * fix * refactor: ChatServiceからApiに関するドメイン知識を排除
This commit is contained in:
parent
6c27ab12eb
commit
9d3f3264fd
42 changed files with 255 additions and 136 deletions
|
|
@ -85,7 +85,7 @@ const isMe = computed(() => props.message.fromUserId === $i.id);
|
|||
const urls = computed(() => props.message.text ? extractUrlFromMfm(mfm.parse(props.message.text)) : []);
|
||||
|
||||
provide(DI.mfmEmojiReactCallback, (reaction) => {
|
||||
if (!$i.policies.canChat) return;
|
||||
if ($i.policies.chatAvailability !== 'available') return;
|
||||
|
||||
sound.playMisskeySfx('reaction');
|
||||
misskeyApi('chat/messages/react', {
|
||||
|
|
@ -95,7 +95,7 @@ provide(DI.mfmEmojiReactCallback, (reaction) => {
|
|||
});
|
||||
|
||||
function react(ev: MouseEvent) {
|
||||
if (!$i.policies.canChat) return;
|
||||
if ($i.policies.chatAvailability !== 'available') return;
|
||||
|
||||
const targetEl = getHTMLElementOrNull(ev.currentTarget ?? ev.target);
|
||||
if (!targetEl) return;
|
||||
|
|
@ -110,7 +110,7 @@ function react(ev: MouseEvent) {
|
|||
}
|
||||
|
||||
function onReactionClick(record: Misskey.entities.ChatMessage['reactions'][0]) {
|
||||
if (!$i.policies.canChat) return;
|
||||
if ($i.policies.chatAvailability !== 'available') return;
|
||||
|
||||
if (record.user.id === $i.id) {
|
||||
misskeyApi('chat/messages/unreact', {
|
||||
|
|
@ -138,7 +138,7 @@ function onContextmenu(ev: MouseEvent) {
|
|||
function showMenu(ev: MouseEvent, contextmenu = false) {
|
||||
const menu: MenuItem[] = [];
|
||||
|
||||
if (!isMe.value && $i.policies.canChat) {
|
||||
if (!isMe.value && $i.policies.chatAvailability === 'available') {
|
||||
menu.push({
|
||||
text: i18n.ts.reaction,
|
||||
icon: 'ti ti-mood-plus',
|
||||
|
|
@ -164,7 +164,7 @@ function showMenu(ev: MouseEvent, contextmenu = false) {
|
|||
type: 'divider',
|
||||
});
|
||||
|
||||
if (isMe.value && $i.policies.canChat) {
|
||||
if (isMe.value && $i.policies.chatAvailability === 'available') {
|
||||
menu.push({
|
||||
text: i18n.ts.delete,
|
||||
icon: 'ti ti-trash',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue