Merge branch 'develop' into vue3

This commit is contained in:
syuilo
2020-09-05 01:08:31 +09:00
11 changed files with 75 additions and 17 deletions

View File

@@ -43,7 +43,7 @@ export default defineComponent({
tab: 'featured',
featuredPagination: {
endpoint: 'channels/featured',
limit: 5,
noPaging: true,
},
followingPagination: {
endpoint: 'channels/followed',

View File

@@ -1,5 +1,8 @@
import $ from 'cafy';
import { ID } from '../../../../misc/cafy-id';
import define from '../../define';
import { Channels, ChannelFollowings } from '../../../../models';
import { makePaginationQuery } from '../../common/make-pagination-query';
export const meta = {
tags: ['channels', 'account'],
@@ -8,6 +11,21 @@ export const meta = {
kind: 'read:channels',
params: {
sinceId: {
validator: $.optional.type(ID),
},
untilId: {
validator: $.optional.type(ID),
},
limit: {
validator: $.optional.num.range(1, 100),
default: 5
},
},
res: {
type: 'array' as const,
optional: false as const, nullable: false as const,
@@ -20,9 +38,12 @@ export const meta = {
};
export default define(meta, async (ps, me) => {
const followings = await ChannelFollowings.find({
followerId: me.id,
});
const query = makePaginationQuery(ChannelFollowings.createQueryBuilder(), ps.sinceId, ps.untilId)
.andWhere({ followerId: me.id });
const followings = await query
.take(ps.limit!)
.getMany();
return await Promise.all(followings.map(x => Channels.pack(x.followeeId, me)));
});

View File

@@ -1,5 +1,8 @@
import $ from 'cafy';
import { ID } from '../../../../misc/cafy-id';
import define from '../../define';
import { Channels } from '../../../../models';
import { makePaginationQuery } from '../../common/make-pagination-query';
export const meta = {
tags: ['channels', 'account'],
@@ -8,6 +11,21 @@ export const meta = {
kind: 'read:channels',
params: {
sinceId: {
validator: $.optional.type(ID),
},
untilId: {
validator: $.optional.type(ID),
},
limit: {
validator: $.optional.num.range(1, 100),
default: 5
},
},
res: {
type: 'array' as const,
optional: false as const, nullable: false as const,
@@ -20,9 +38,12 @@ export const meta = {
};
export default define(meta, async (ps, me) => {
const channels = await Channels.find({
userId: me.id,
});
const query = makePaginationQuery(Channels.createQueryBuilder(), ps.sinceId, ps.untilId)
.andWhere({ userId: me.id });
const channels = await query
.take(ps.limit!)
.getMany();
return await Promise.all(channels.map(x => Channels.pack(x, me)));
});

View File

@@ -99,6 +99,8 @@ export default define(meta, async (ps, me) => {
}
});
const proxyAccount = instance.proxyAccountId ? await Users.pack(instance.proxyAccountId).catch(() => null) : null;
const response: any = {
maintainerName: instance.maintainerName,
maintainerEmail: instance.maintainerEmail,
@@ -143,6 +145,8 @@ export default define(meta, async (ps, me) => {
enableDiscordIntegration: instance.enableDiscordIntegration,
enableServiceWorker: instance.enableServiceWorker,
proxyAccountName: proxyAccount ? proxyAccount.username : null,
};
if (ps.detail) {

View File

@@ -1,6 +1,7 @@
import * as Router from '@koa/router';
import config from '../config';
import { fetchMeta } from '../misc/fetch-meta';
import { Users } from '../models';
// import User from '../models/user';
// import Note from '../models/note';
@@ -34,6 +35,8 @@ const nodeinfo2 = async () => {
// Note.count({ '_user.host': null, replyId: { $ne: null } })
]);
const proxyAccount = meta.proxyAccountId ? await Users.pack(meta.proxyAccountId).catch(() => null) : null;
return {
software: {
name: 'misskey',
@@ -72,7 +75,8 @@ const nodeinfo2 = async () => {
enableGithubIntegration: meta.enableGithubIntegration,
enableDiscordIntegration: meta.enableDiscordIntegration,
enableEmail: meta.enableEmail,
enableServiceWorker: meta.enableServiceWorker
enableServiceWorker: meta.enableServiceWorker,
proxyAccountName: proxyAccount ? proxyAccount.username : null,
}
};
};

View File

@@ -326,6 +326,9 @@ router.get('/info', async ctx => {
const emojis = await Emojis.find({
where: { host: null }
});
const proxyAccount = meta.proxyAccountId ? await Users.pack(meta.proxyAccountId).catch(() => null) : null;
await ctx.render('info', {
version: config.version,
machine: os.hostname(),
@@ -339,6 +342,7 @@ router.get('/info', async ctx => {
},
emojis: emojis,
meta: meta,
proxyAccountName: proxyAccount ? proxyAccount.username : null,
originalUsersCount: await Users.count({ host: null }),
originalNotesCount: await Notes.count({ userHost: null })
});

View File

@@ -79,6 +79,9 @@ html
td
= meta.maintainerName
| <#{meta.maintainerEmail}>
tr
th Proxy account name
td= proxyAccountName || '(none)'
tr
th System
td= os

View File

@@ -16,7 +16,7 @@ export async function createNotification(
const profile = await UserProfiles.findOne({ userId: notifieeId });
const isMuted = !profile?.includingNotificationTypes?.includes(type);
const isMuted = !(profile?.includingNotificationTypes == null || profile?.includingNotificationTypes.includes(type));
// Create notification
const notification = await Notifications.save({

View File

@@ -135,6 +135,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
if (data.localOnly == null) data.localOnly = false;
if (data.channel != null) data.visibility = 'public';
if (data.channel != null) data.visibleUsers = [];
if (data.channel != null) data.localOnly = true;
// サイレンス
if (user.isSilenced && data.visibility === 'public' && data.channel == null) {