1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-03 09:06:17 +02:00
This commit is contained in:
syuilo
2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View File

@@ -34,7 +34,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[
followerSharedInbox: Users.isRemoteUser(follower) ? follower.sharedInbox : null,
followeeHost: followee.host,
followeeInbox: Users.isRemoteUser(followee) ? followee.inbox : null,
followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : null
followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : null,
}).catch(e => {
if (isDuplicateKeyValueError(e) && Users.isRemoteUser(follower) && Users.isLocalUser(followee)) {
logger.info(`Insert duplicated ignore. ${follower.id} => ${followee.id}`);
@@ -46,13 +46,13 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[
const req = await FollowRequests.findOne({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
if (req) {
await FollowRequests.delete({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
// 通知を作成
@@ -87,7 +87,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[
// Publish follow event
if (Users.isLocalUser(follower)) {
Users.pack(followee.id, follower, {
detail: true
detail: true,
}).then(packed => {
publishUserEvent(follower.id, 'follow', packed);
publishMainStream(follower.id, 'follow', packed);
@@ -100,7 +100,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[
// 通知を作成
createNotification(followee.id, 'follow', {
notifierId: follower.id
notifierId: follower.id,
});
}
}
@@ -108,7 +108,7 @@ export async function insertFollowingDoc(followee: { id: User['id']; host: User[
export default async function(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string) {
const [follower, followee] = await Promise.all([
Users.findOneOrFail(_follower.id),
Users.findOneOrFail(_followee.id)
Users.findOneOrFail(_followee.id),
]);
// check blocking
@@ -120,7 +120,7 @@ export default async function(_follower: { id: User['id'] }, _followee: { id: Us
Blockings.findOne({
blockerId: followee.id,
blockeeId: follower.id,
})
}),
]);
if (Users.isRemoteUser(follower) && Users.isLocalUser(followee) && blocked) {
@@ -159,7 +159,7 @@ export default async function(_follower: { id: User['id'] }, _followee: { id: Us
if (!autoAccept && (Users.isLocalUser(followee) && followeeProfile.autoAcceptFollowed)) {
const followed = await Followings.findOne({
followerId: followee.id,
followeeId: follower.id
followeeId: follower.id,
});
if (followed) autoAccept = true;

View File

@@ -15,7 +15,7 @@ const logger = new Logger('following/delete');
export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, silent = false) {
const following = await Followings.findOne({
followerId: follower.id,
followeeId: followee.id
followeeId: followee.id,
});
if (following == null) {
@@ -30,7 +30,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
// Publish unfollow event
if (!silent && Users.isLocalUser(follower)) {
Users.pack(followee.id, follower, {
detail: true
detail: true,
}).then(packed => {
publishUserEvent(follower.id, 'unfollow', packed);
publishMainStream(follower.id, 'unfollow', packed);

View File

@@ -56,7 +56,7 @@ export async function remoteReject(actor: Remote, follower: Local) {
async function removeFollowRequest(followee: Both, follower: Both) {
const request = await FollowRequests.findOne({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
if (!request) return;
@@ -70,7 +70,7 @@ async function removeFollowRequest(followee: Both, follower: Both) {
async function removeFollow(followee: Both, follower: Both) {
const following = await Followings.findOne({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
if (!following) return;
@@ -85,7 +85,7 @@ async function removeFollow(followee: Both, follower: Both) {
async function deliverReject(followee: Local, follower: Remote) {
const request = await FollowRequests.findOne({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
const content = renderActivity(renderReject(renderFollow(follower, followee, request?.requestId || undefined), followee));
@@ -97,7 +97,7 @@ async function deliverReject(followee: Local, follower: Remote) {
*/
async function publishUnfollow(followee: Both, follower: Local) {
const packedFollowee = await Users.pack(followee.id, follower, {
detail: true
detail: true,
});
publishUserEvent(follower.id, 'unfollow', packedFollowee);

View File

@@ -8,7 +8,7 @@ import { FollowRequests, Users } from '@/models/index';
*/
export default async function(user: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }) {
const requests = await FollowRequests.find({
followeeId: user.id
followeeId: user.id,
});
for (const request of requests) {

View File

@@ -11,7 +11,7 @@ import { IdentifiableError } from '@/misc/identifiable-error';
export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: User) {
const request = await FollowRequests.findOne({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
if (request == null) {
@@ -26,6 +26,6 @@ export default async function(followee: { id: User['id']; host: User['host']; ur
}
Users.pack(followee.id, followee, {
detail: true
detail: true,
}).then(packed => publishMainStream(followee.id, 'meUpdated', packed));
}

View File

@@ -18,7 +18,7 @@ export default async function(followee: { id: User['id']; host: User['host']; ur
const request = await FollowRequests.findOne({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
if (request == null) {
@@ -27,10 +27,10 @@ export default async function(followee: { id: User['id']; host: User['host']; ur
await FollowRequests.delete({
followeeId: followee.id,
followerId: follower.id
followerId: follower.id,
});
Users.pack(followee.id, followee, {
detail: true
detail: true,
}).then(packed => publishMainStream(followee.id, 'meUpdated', packed));
}

View File

@@ -19,7 +19,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
Blockings.findOne({
blockerId: followee.id,
blockeeId: follower.id,
})
}),
]);
if (blocking != null) throw new Error('blocking');
@@ -38,7 +38,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
followerSharedInbox: Users.isRemoteUser(follower) ? follower.sharedInbox : undefined,
followeeHost: followee.host,
followeeInbox: Users.isRemoteUser(followee) ? followee.inbox : undefined,
followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : undefined
followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : undefined,
});
// Publish receiveRequest event
@@ -46,13 +46,13 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
Users.pack(follower.id, followee).then(packed => publishMainStream(followee.id, 'receiveFollowRequest', packed));
Users.pack(followee.id, followee, {
detail: true
detail: true,
}).then(packed => publishMainStream(followee.id, 'meUpdated', packed));
// 通知を作成
createNotification(followee.id, 'receiveFollowRequest', {
notifierId: follower.id,
followRequestId: followRequest.id
followRequestId: followRequest.id,
});
}