Merge branch 'develop' into vue3

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

View File

@ -32,7 +32,7 @@
"constantinople": "^4.0.1",
"core-js": "^3.6.5",
"gulp/gulp-cli/yargs/yargs-parser": "5.0.0-security.0",
"lodash": "^4.17.19",
"lodash": "^4.17.20",
"mocha/serialize-javascript": "^3.1.0"
},
"dependencies": {

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) {

View File

@ -1775,9 +1775,9 @@ binaryextensions@2:
integrity sha512-bHhs98rj/7i/RZpCSJ3uk55pLXOItjIrh2sRQZSM6OoktScX+LxJzvlU+FELp9j3TdcddTmmYArLSGptCTwjuw==
bl@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.2.tgz#52b71e9088515d0606d9dd9cc7aa48dc1f98e73a"
integrity sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==
version "4.0.3"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.3.tgz#12d6287adc29080e22a705e5764b2a9522cdc489"
integrity sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==
dependencies:
buffer "^5.5.0"
inherits "^2.0.4"
@ -5917,10 +5917,10 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
log-symbols@3.0.0:
version "3.0.0"