lint fix
This commit is contained in:
parent
4abecb2bc1
commit
57331536f2
|
@ -16,10 +16,8 @@ import type { EmojisRepository, MiRole, MiUser } from '@/models/_.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js';
|
import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { query } from '@/misc/prelude/url.js';
|
|
||||||
import type { Serialized } from '@/types.js';
|
import type { Serialized } from '@/types.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
|
||||||
const parseEmojiStrRegexp = /^(\w+)(?:@([\w.-]+))?$/;
|
const parseEmojiStrRegexp = /^(\w+)(?:@([\w.-]+))?$/;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -31,12 +29,6 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
@Inject(DI.redis)
|
@Inject(DI.redis)
|
||||||
private redisClient: Redis.Redis,
|
private redisClient: Redis.Redis,
|
||||||
|
|
||||||
@Inject(DI.config)
|
|
||||||
private config: Config,
|
|
||||||
|
|
||||||
@Inject(DI.db)
|
|
||||||
private db: DataSource,
|
|
||||||
|
|
||||||
@Inject(DI.emojisRepository)
|
@Inject(DI.emojisRepository)
|
||||||
private emojisRepository: EmojisRepository,
|
private emojisRepository: EmojisRepository,
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,13 @@ import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||||
import { WebhookService } from '@/core/WebhookService.js';
|
import { WebhookService } from '@/core/WebhookService.js';
|
||||||
import { NotificationService } from '@/core/NotificationService.js';
|
import { NotificationService } from '@/core/NotificationService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { FollowingsRepository, FollowRequestsRepository, InstancesRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
import type {
|
||||||
|
FollowingsRepository,
|
||||||
|
FollowRequestsRepository,
|
||||||
|
InstancesRepository,
|
||||||
|
UserProfilesRepository,
|
||||||
|
UsersRepository,
|
||||||
|
} from '@/models/_.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -51,25 +57,18 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private moduleRef: ModuleRef,
|
private moduleRef: ModuleRef,
|
||||||
|
|
||||||
@Inject(DI.config)
|
@Inject(DI.config)
|
||||||
private config: Config,
|
private config: Config,
|
||||||
|
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
@Inject(DI.userProfilesRepository)
|
@Inject(DI.userProfilesRepository)
|
||||||
private userProfilesRepository: UserProfilesRepository,
|
private userProfilesRepository: UserProfilesRepository,
|
||||||
|
|
||||||
@Inject(DI.followingsRepository)
|
@Inject(DI.followingsRepository)
|
||||||
private followingsRepository: FollowingsRepository,
|
private followingsRepository: FollowingsRepository,
|
||||||
|
|
||||||
@Inject(DI.followRequestsRepository)
|
@Inject(DI.followRequestsRepository)
|
||||||
private followRequestsRepository: FollowRequestsRepository,
|
private followRequestsRepository: FollowRequestsRepository,
|
||||||
|
|
||||||
@Inject(DI.instancesRepository)
|
@Inject(DI.instancesRepository)
|
||||||
private instancesRepository: InstancesRepository,
|
private instancesRepository: InstancesRepository,
|
||||||
|
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
|
@ -91,7 +90,9 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async follow(_follower: { id: MiUser['id'] }, _followee: { id: MiUser['id'] }, requestId?: string, silent = false): Promise<void> {
|
public async follow(_follower: { id: MiUser['id'] }, _followee: {
|
||||||
|
id: MiUser['id']
|
||||||
|
}, requestId?: string, silent = false): Promise<void> {
|
||||||
const [follower, followee] = await Promise.all([
|
const [follower, followee] = await Promise.all([
|
||||||
this.usersRepository.findOneByOrFail({ id: _follower.id }),
|
this.usersRepository.findOneByOrFail({ id: _follower.id }),
|
||||||
this.usersRepository.findOneByOrFail({ id: _followee.id }),
|
this.usersRepository.findOneByOrFail({ id: _followee.id }),
|
||||||
|
@ -184,10 +185,18 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
@bindThis
|
@bindThis
|
||||||
private async insertFollowingDoc(
|
private async insertFollowingDoc(
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox']
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox']
|
||||||
},
|
},
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox']
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox']
|
||||||
},
|
},
|
||||||
silent = false,
|
silent = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -233,8 +242,7 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 通知を作成
|
// 通知を作成
|
||||||
this.notificationService.createNotification(follower.id, 'followRequestAccepted', {
|
this.notificationService.createNotification(follower.id, 'followRequestAccepted', {}, followee.id);
|
||||||
}, followee.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alreadyFollowed) return;
|
if (alreadyFollowed) return;
|
||||||
|
@ -306,18 +314,25 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 通知を作成
|
// 通知を作成
|
||||||
this.notificationService.createNotification(followee.id, 'follow', {
|
this.notificationService.createNotification(followee.id, 'follow', {}, follower.id);
|
||||||
}, follower.id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async unfollow(
|
public async unfollow(
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
silent = false,
|
silent = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -446,10 +461,18 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async createFollowRequest(
|
public async createFollowRequest(
|
||||||
follower: {
|
follower: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
requestId?: string,
|
requestId?: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -541,7 +564,11 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async acceptFollowRequest(
|
public async acceptFollowRequest(
|
||||||
followee: {
|
followee: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
follower: MiUser,
|
follower: MiUser,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -569,7 +596,11 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async acceptAllFollowRequests(
|
public async acceptAllFollowRequests(
|
||||||
user: {
|
user: {
|
||||||
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'];
|
id: MiUser['id'];
|
||||||
|
host: MiUser['host'];
|
||||||
|
uri: MiUser['host'];
|
||||||
|
inbox: MiUser['inbox'];
|
||||||
|
sharedInbox: MiUser['sharedInbox'];
|
||||||
},
|
},
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const requests = await this.followRequestsRepository.findBy({
|
const requests = await this.followRequestsRepository.findBy({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { DriveFilesRepository } from '@/models/index.js';
|
import type { DriveFilesRepository } from '@/models/_.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
|
|
@ -41,17 +41,21 @@ export const paramDef = {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
description: 'Use `null` to reset the category.',
|
description: 'Use `null` to reset the category.',
|
||||||
},
|
},
|
||||||
aliases: { type: 'array', items: {
|
aliases: {
|
||||||
|
type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
},
|
||||||
|
},
|
||||||
license: { type: 'string', nullable: true },
|
license: { type: 'string', nullable: true },
|
||||||
isSensitive: { type: 'boolean' },
|
isSensitive: { type: 'boolean' },
|
||||||
localOnly: { type: 'boolean' },
|
localOnly: { type: 'boolean' },
|
||||||
roleIdsThatCanBeUsedThisEmojiAsReaction: { type: 'array', items: {
|
roleIdsThatCanBeUsedThisEmojiAsReaction: {
|
||||||
|
type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
|
||||||
},
|
},
|
||||||
required: ['name','fileId', 'draft'],
|
},
|
||||||
|
},
|
||||||
|
required: ['name', 'fileId', 'draft'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// TODO: ロジックをサービスに切り出す
|
// TODO: ロジックをサービスに切り出す
|
||||||
|
@ -61,9 +65,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.driveFilesRepository)
|
@Inject(DI.driveFilesRepository)
|
||||||
private driveFilesRepository: DriveFilesRepository,
|
private driveFilesRepository: DriveFilesRepository,
|
||||||
|
|
||||||
private customEmojiService: CustomEmojiService,
|
private customEmojiService: CustomEmojiService,
|
||||||
|
|
||||||
private emojiEntityService: EmojiEntityService,
|
private emojiEntityService: EmojiEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
|
|
@ -57,7 +57,7 @@ export const paramDef = {
|
||||||
} },
|
} },
|
||||||
draft: { type: 'boolean' },
|
draft: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['id', 'name', 'aliases'],
|
required: ['id', 'name', 'draft', 'aliases'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkModalWindow
|
<MkModalWindow
|
||||||
ref="dialog"
|
ref="dialog"
|
||||||
:width="400"
|
:width="400"
|
||||||
:with-ok-button="false "
|
:withOkButton="false "
|
||||||
@close="dialog.close()"
|
@close="dialog.close()"
|
||||||
@closed="$emit('closed')"
|
@closed="$emit('closed')"
|
||||||
>
|
>
|
||||||
|
@ -51,7 +51,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ i18n.ts.rolesThatCanBeUsedThisEmojiAsReaction }}</template>
|
<template #label>{{ i18n.ts.rolesThatCanBeUsedThisEmojiAsReaction }}</template>
|
||||||
<template #suffix>{{ rolesThatCanBeUsedThisEmojiAsReaction.length === 0 ? i18n.ts.all : rolesThatCanBeUsedThisEmojiAsReaction.length }}</template>
|
<template #suffix>{{ rolesThatCanBeUsedThisEmojiAsReaction.length === 0 ? i18n.ts.all : rolesThatCanBeUsedThisEmojiAsReaction.length }}</template>
|
||||||
|
|
||||||
<div class="_gaps" v-if="!isRequest">
|
<div v-if="!isRequest" class="_gaps">
|
||||||
<MkButton rounded @click="addRole"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
|
<MkButton rounded @click="addRole"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
|
||||||
|
|
||||||
<div v-for="role in rolesThatCanBeUsedThisEmojiAsReaction" :key="role.id" :class="$style.roleItem">
|
<div v-for="role in rolesThatCanBeUsedThisEmojiAsReaction" :key="role.id" :class="$style.roleItem">
|
||||||
|
@ -77,15 +77,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton v-if="validation" primary rounded style="margin: 0 auto;" @click="done"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
<MkButton v-if="validation" primary rounded style="margin: 0 auto;" @click="done"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
||||||
<MkButton v-else rounded style="margin: 0 auto;"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
<MkButton v-else rounded style="margin: 0 auto;"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</MkModalWindow>
|
</MkModalWindow>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch,ref } from 'vue';
|
import { computed, watch } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { DriveFile } from 'misskey-js/built/entities.js';
|
||||||
import MkModalWindow from '@/components/MkModalWindow.vue';
|
import MkModalWindow from '@/components/MkModalWindow.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import MkInput from '@/components/MkInput.vue';
|
import MkInput from '@/components/MkInput.vue';
|
||||||
|
@ -114,7 +114,7 @@ let localOnly = $ref(props.emoji ? props.emoji.localOnly : false);
|
||||||
let roleIdsThatCanBeUsedThisEmojiAsReaction = $ref(props.emoji ? props.emoji.roleIdsThatCanBeUsedThisEmojiAsReaction : []);
|
let roleIdsThatCanBeUsedThisEmojiAsReaction = $ref(props.emoji ? props.emoji.roleIdsThatCanBeUsedThisEmojiAsReaction : []);
|
||||||
let rolesThatCanBeUsedThisEmojiAsReaction = $ref([]);
|
let rolesThatCanBeUsedThisEmojiAsReaction = $ref([]);
|
||||||
let file = $ref<Misskey.entities.DriveFile>();
|
let file = $ref<Misskey.entities.DriveFile>();
|
||||||
let chooseFile: MkDriveFile|null = $ref(null);
|
let chooseFile: DriveFile|null = $ref(null);
|
||||||
let draft = $ref(props.emoji ? props.emoji.draft : false);
|
let draft = $ref(props.emoji ? props.emoji.draft : false);
|
||||||
let isRequest = $ref(props.isRequest);
|
let isRequest = $ref(props.isRequest);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ watch($$(roleIdsThatCanBeUsedThisEmojiAsReaction), async () => {
|
||||||
const imgUrl = computed(() => file ? file.url : props.emoji ? `/emoji/${props.emoji.name}.webp` : null);
|
const imgUrl = computed(() => file ? file.url : props.emoji ? `/emoji/${props.emoji.name}.webp` : null);
|
||||||
const validation = computed(() => {
|
const validation = computed(() => {
|
||||||
return name.match(/^[a-zA-Z0-9_]+$/) && imgUrl.value != null;
|
return name.match(/^[a-zA-Z0-9_]+$/) && imgUrl.value != null;
|
||||||
})
|
});
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: 'done', v: { deleted?: boolean; updated?: any; created?: any }): void,
|
(ev: 'done', v: { deleted?: boolean; updated?: any; created?: any }): void,
|
||||||
(ev: 'closed'): void
|
(ev: 'closed'): void
|
||||||
|
@ -209,7 +209,6 @@ async function update() {
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.close();
|
dialog.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
async function done() {
|
async function done() {
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -226,7 +225,7 @@ async function done() {
|
||||||
if (file) {
|
if (file) {
|
||||||
params.fileId = file.id;
|
params.fileId = file.id;
|
||||||
}
|
}
|
||||||
console.log(props.emoji)
|
console.log(props.emoji);
|
||||||
if (props.emoji) {
|
if (props.emoji) {
|
||||||
await os.apiWithDialog('admin/emoji/update', {
|
await os.apiWithDialog('admin/emoji/update', {
|
||||||
id: props.emoji.id,
|
id: props.emoji.id,
|
||||||
|
|
|
@ -25,7 +25,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const customEmojiName = computed(() => (props.name[0] === ':' ? props.name.substring(1, props.name.length - 1) : props.name).replace('@.', ''));
|
const customEmojiName = computed(() => (props.name[0] === ':' ? props.name.substring(1, props.name.length - 1) : props.name).replace('@.', ''));
|
||||||
const isLocal = computed(() => !props.host && (customEmojiName.value.endsWith('@.') || !customEmojiName.value.includes('@')));
|
const isLocal = computed(() => !props.host && (customEmojiName.value.endsWith('@.') || !customEmojiName.value.includes('@')));
|
||||||
const isDraft = computed(() => customEmojisNameMap.value.get(customEmojiName.value)?.draft ?? false);
|
const isDraft = computed(() => customEmojisMap.get(customEmojiName.value)?.draft ?? false);
|
||||||
|
|
||||||
const rawUrl = computed(() => {
|
const rawUrl = computed(() => {
|
||||||
if (props.url) {
|
if (props.url) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { shallowRef, computed, markRaw, triggerRef,watch } from 'vue';
|
import { shallowRef, computed, markRaw, triggerRef, watch } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { api, apiGet } from '@/os.js';
|
import { api, apiGet } from '@/os.js';
|
||||||
import { useStream } from '@/stream.js';
|
import { useStream } from '@/stream.js';
|
||||||
|
|
|
@ -12,7 +12,6 @@ import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { ui } from '@/config.js';
|
import { ui } from '@/config.js';
|
||||||
import { unisonReload } from '@/scripts/unison-reload.js';
|
import { unisonReload } from '@/scripts/unison-reload.js';
|
||||||
import {defaultStore} from "@/store.js";
|
|
||||||
|
|
||||||
export const navbarItemDef = reactive({
|
export const navbarItemDef = reactive({
|
||||||
notifications: {
|
notifications: {
|
||||||
|
|
|
@ -5,10 +5,22 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header>
|
||||||
|
<MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/>
|
||||||
|
</template>
|
||||||
<MkSpacer v-if="tab === 'emojis'" :contentMax="1000" :marginMin="20">
|
<MkSpacer v-if="tab === 'emojis'" :contentMax="1000" :marginMin="20">
|
||||||
<MkButton v-if="$i && ($i.isModerator || $i.policies.canManageCustomEmojis)" primary link to="/custom-emojis-manager">{{ i18n.ts.manageCustomEmojis }}</MkButton>
|
<MkButton
|
||||||
<MkButton v-if="$i && (!$i.isModerator || !$i.policies.canManageCustomEmojis || $i.policies.canRequestCustomEmojis)" primary @click="edit" style='margin-top: 8px;' >{{ i18n.ts.requestCustomEmojis }}</MkButton>
|
v-if="$i && ($i.isModerator || $i.policies.canManageCustomEmojis)" primary link
|
||||||
|
to="/custom-emojis-manager"
|
||||||
|
>
|
||||||
|
{{ i18n.ts.manageCustomEmojis }}
|
||||||
|
</MkButton>
|
||||||
|
<MkButton
|
||||||
|
v-if="$i && (!$i.isModerator || !$i.policies.canManageCustomEmojis || $i.policies.canRequestCustomEmojis)"
|
||||||
|
primary style="margin-top: 8px;" @click="edit"
|
||||||
|
>
|
||||||
|
{{ i18n.ts.requestCustomEmojis }}
|
||||||
|
</MkButton>
|
||||||
|
|
||||||
<div class="query" style="margin-top: 10px;">
|
<div class="query" style="margin-top: 10px;">
|
||||||
<MkInput v-model="q" class="" :placeholder="i18n.ts.search">
|
<MkInput v-model="q" class="" :placeholder="i18n.ts.search">
|
||||||
|
@ -32,7 +44,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkFoldableSection v-for="category in filteredCategories" v-once :key="category">
|
<MkFoldableSection v-for="category in filteredCategories" v-once :key="category">
|
||||||
<template #header>{{ category || i18n.ts.other }}</template>
|
<template #header>{{ category || i18n.ts.other }}</template>
|
||||||
<div :class="$style.emojis">
|
<div :class="$style.emojis">
|
||||||
<XEmoji v-for="emoji in customEmojis.filter(e => e.category === category && !e.draft)" :key="emoji.name" :emoji="emoji" :draft="emoji.draft"/>
|
<XEmoji
|
||||||
|
v-for="emoji in customEmojis.filter(e => e.category === category && !e.draft)" :key="emoji.name"
|
||||||
|
:emoji="emoji" :draft="emoji.draft"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</MkFoldableSection>
|
</MkFoldableSection>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
|
@ -87,6 +102,7 @@ let q = $ref('');
|
||||||
let searchEmojis = $ref<Misskey.entities.CustomEmoji[]>(null);
|
let searchEmojis = $ref<Misskey.entities.CustomEmoji[]>(null);
|
||||||
let selectedTags = $ref(new Set());
|
let selectedTags = $ref(new Set());
|
||||||
const draftEmojis = customEmojis.value.filter(emoji => emoji.draft);
|
const draftEmojis = customEmojis.value.filter(emoji => emoji.draft);
|
||||||
|
|
||||||
function search() {
|
function search() {
|
||||||
if ((q === '' || q == null) && selectedTags.size === 0) {
|
if ((q === '' || q == null) && selectedTags.size === 0) {
|
||||||
searchEmojis = null;
|
searchEmojis = null;
|
||||||
|
|
|
@ -41,7 +41,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
<MkPagination v-slot="{items}" ref="instances" :key="host + state" :pagination="pagination">
|
||||||
<div :class="$style.items">
|
<div :class="$style.items">
|
||||||
<MkA v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Status: ${getStatus(instance)}`" :class="$style.item" :to="`/instance-info/${instance.host}`">
|
<MkA
|
||||||
|
v-for="instance in items" :key="instance.id" v-tooltip.mfm="`Status: ${getStatus(instance)}`"
|
||||||
|
:class="$style.item" :to="`/instance-info/${instance.host}`"
|
||||||
|
>
|
||||||
<MkInstanceCardMini :instance="instance"/>
|
<MkInstanceCardMini :instance="instance"/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header>
|
||||||
|
<XHeader :actions="headerActions" :tabs="headerTabs"/>
|
||||||
|
</template>
|
||||||
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
|
||||||
<FormSuspense :p="init">
|
<FormSuspense :p="init">
|
||||||
<MkTextarea v-model="blockedHosts">
|
<MkTextarea v-model="blockedHosts">
|
||||||
|
@ -20,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { } from 'vue';
|
import {} from 'vue';
|
||||||
import XHeader from './_header_.vue';
|
import XHeader from './_header_.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import MkTextarea from '@/components/MkTextarea.vue';
|
import MkTextarea from '@/components/MkTextarea.vue';
|
||||||
|
|
Loading…
Reference in New Issue