From 493d32b3dcbf05e66ccf124bea2a92f92d05f134 Mon Sep 17 00:00:00 2001
From: tamaina <tamaina@hotmail.co.jp>
Date: Sat, 29 Aug 2020 03:14:27 +0900
Subject: [PATCH 1/6] Fix #6676

---
 src/services/create-notification.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/services/create-notification.ts b/src/services/create-notification.ts
index 4e713e3804..b2bcaaa836 100644
--- a/src/services/create-notification.ts
+++ b/src/services/create-notification.ts
@@ -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({

From 5864b52a813c5fbb38bbe5ef5ad3648e313a5be1 Mon Sep 17 00:00:00 2001
From: tamaina <tamaina@hotmail.co.jp>
Date: Sat, 29 Aug 2020 03:26:44 +0900
Subject: [PATCH 2/6] Update create-notification.ts

---
 src/services/create-notification.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/services/create-notification.ts b/src/services/create-notification.ts
index b2bcaaa836..7471c349ee 100644
--- a/src/services/create-notification.ts
+++ b/src/services/create-notification.ts
@@ -16,7 +16,7 @@ export async function createNotification(
 
 	const profile = await UserProfiles.findOne({ userId: notifieeId });
 
-	const isMuted = !(profile?.includingNotificationTypes === null || profile?.includingNotificationTypes.includes(type));
+	const isMuted = !(profile?.includingNotificationTypes == null || profile?.includingNotificationTypes.includes(type));
 
 	// Create notification
 	const notification = await Notifications.save({

From c2d7929391d18072b46e6f829c956fd8d99e4b80 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Sat, 29 Aug 2020 08:56:32 +0900
Subject: [PATCH 3/6] Expose proxyAccountName (#6670)

---
 src/server/api/endpoints/meta.ts | 4 ++++
 src/server/nodeinfo.ts           | 6 +++++-
 src/server/web/index.ts          | 4 ++++
 src/server/web/views/info.pug    | 3 +++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts
index f011a6751f..f46139aa23 100644
--- a/src/server/api/endpoints/meta.ts
+++ b/src/server/api/endpoints/meta.ts
@@ -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) {
diff --git a/src/server/nodeinfo.ts b/src/server/nodeinfo.ts
index b0de850dd0..5c51137c92 100644
--- a/src/server/nodeinfo.ts
+++ b/src/server/nodeinfo.ts
@@ -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,
 		}
 	};
 };
diff --git a/src/server/web/index.ts b/src/server/web/index.ts
index 18cd102eba..507ddac3ce 100644
--- a/src/server/web/index.ts
+++ b/src/server/web/index.ts
@@ -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 })
 	});
diff --git a/src/server/web/views/info.pug b/src/server/web/views/info.pug
index 4553d2e2b9..eed69fc99e 100644
--- a/src/server/web/views/info.pug
+++ b/src/server/web/views/info.pug
@@ -79,6 +79,9 @@ html
 					td
 						= meta.maintainerName
 						|  &lt;#{meta.maintainerEmail}&gt;
+				tr
+					th Proxy account name
+					td= proxyAccountName || '(none)'
 				tr
 					th System
 					td= os

From 42d1c67d568e424f9f7cdecacb72de90a8ccb69c Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Sat, 29 Aug 2020 09:39:50 +0900
Subject: [PATCH 4/6] fix(server): Fix #6669

---
 src/services/note/create.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index a530b86f55..c8e3db540d 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -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) {

From d7df26d92b3363df197afa47343d3a05e943e362 Mon Sep 17 00:00:00 2001
From: takonomura <takonomura@users.noreply.github.com>
Date: Sun, 30 Aug 2020 18:18:34 +0900
Subject: [PATCH 5/6] Fix channels list pagination (#6679)

---
 src/client/pages/channels.vue                 |  2 +-
 src/server/api/endpoints/channels/followed.ts | 27 ++++++++++++++++---
 src/server/api/endpoints/channels/owned.ts    | 27 ++++++++++++++++---
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/src/client/pages/channels.vue b/src/client/pages/channels.vue
index 85804141f1..34a79e70eb 100644
--- a/src/client/pages/channels.vue
+++ b/src/client/pages/channels.vue
@@ -44,7 +44,7 @@ export default Vue.extend({
 			tab: 'featured',
 			featuredPagination: {
 				endpoint: 'channels/featured',
-				limit: 5,
+				noPaging: true,
 			},
 			followingPagination: {
 				endpoint: 'channels/followed',
diff --git a/src/server/api/endpoints/channels/followed.ts b/src/server/api/endpoints/channels/followed.ts
index 05c2ec6a75..bd37d420f6 100644
--- a/src/server/api/endpoints/channels/followed.ts
+++ b/src/server/api/endpoints/channels/followed.ts
@@ -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)));
 });
diff --git a/src/server/api/endpoints/channels/owned.ts b/src/server/api/endpoints/channels/owned.ts
index 9e563c0ac5..1a7e04640d 100644
--- a/src/server/api/endpoints/channels/owned.ts
+++ b/src/server/api/endpoints/channels/owned.ts
@@ -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)));
 });

From 925868dcdb51c9fdb0ab2508e857cb7b7c533820 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Sun, 30 Aug 2020 18:20:14 +0900
Subject: [PATCH 6/6] Update dependencies (#6678)

---
 package.json |  2 +-
 yarn.lock    | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/package.json b/package.json
index d04fdf6026..1c14aa5548 100644
--- a/package.json
+++ b/package.json
@@ -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": {
diff --git a/yarn.lock b/yarn.lock
index 3fe0ae5667..0852367fb9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1677,9 +1677,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"
@@ -5787,10 +5787,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"