sharedInbox対応
This commit is contained in:
		
							parent
							
								
									297a7f541e
								
							
						
					
					
						commit
						900a9cb34f
					
				
					 6 changed files with 25 additions and 8 deletions
				
			
		| 
						 | 
					@ -17,10 +17,12 @@ export type IFollowRequest = {
 | 
				
			||||||
	_followee: {
 | 
						_followee: {
 | 
				
			||||||
		host: string;
 | 
							host: string;
 | 
				
			||||||
		inbox?: string;
 | 
							inbox?: string;
 | 
				
			||||||
 | 
							sharedInbox?: string;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	_follower: {
 | 
						_follower: {
 | 
				
			||||||
		host: string;
 | 
							host: string;
 | 
				
			||||||
		inbox?: string;
 | 
							inbox?: string;
 | 
				
			||||||
 | 
							sharedInbox?: string;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,10 +16,12 @@ export type IFollowing = {
 | 
				
			||||||
	_followee: {
 | 
						_followee: {
 | 
				
			||||||
		host: string;
 | 
							host: string;
 | 
				
			||||||
		inbox?: string;
 | 
							inbox?: string;
 | 
				
			||||||
 | 
							sharedInbox?: string;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	_follower: {
 | 
						_follower: {
 | 
				
			||||||
		host: string;
 | 
							host: string;
 | 
				
			||||||
		inbox?: string;
 | 
							inbox?: string;
 | 
				
			||||||
 | 
							sharedInbox?: string;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,11 +22,13 @@ export default async function(follower: IUser, followee: IUser) {
 | 
				
			||||||
			// 非正規化
 | 
								// 非正規化
 | 
				
			||||||
			_follower: {
 | 
								_follower: {
 | 
				
			||||||
				host: follower.host,
 | 
									host: follower.host,
 | 
				
			||||||
				inbox: isRemoteUser(follower) ? follower.inbox : undefined
 | 
									inbox: isRemoteUser(follower) ? follower.inbox : undefined,
 | 
				
			||||||
 | 
									sharedInbox: isRemoteUser(follower) ? follower.sharedInbox : undefined
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			_followee: {
 | 
								_followee: {
 | 
				
			||||||
				host: followee.host,
 | 
									host: followee.host,
 | 
				
			||||||
				inbox: isRemoteUser(followee) ? followee.inbox : undefined
 | 
									inbox: isRemoteUser(followee) ? followee.inbox : undefined,
 | 
				
			||||||
 | 
									sharedInbox: isRemoteUser(followee) ? followee.sharedInbox : undefined
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,11 +18,13 @@ export default async function(followee: IUser, follower: IUser) {
 | 
				
			||||||
		// 非正規化
 | 
							// 非正規化
 | 
				
			||||||
		_follower: {
 | 
							_follower: {
 | 
				
			||||||
			host: follower.host,
 | 
								host: follower.host,
 | 
				
			||||||
			inbox: isRemoteUser(follower) ? follower.inbox : undefined
 | 
								inbox: isRemoteUser(follower) ? follower.inbox : undefined,
 | 
				
			||||||
 | 
								sharedInbox: isRemoteUser(follower) ? follower.sharedInbox : undefined
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		_followee: {
 | 
							_followee: {
 | 
				
			||||||
			host: followee.host,
 | 
								host: followee.host,
 | 
				
			||||||
			inbox: isRemoteUser(followee) ? followee.inbox : undefined
 | 
								inbox: isRemoteUser(followee) ? followee.inbox : undefined,
 | 
				
			||||||
 | 
								sharedInbox: isRemoteUser(followee) ? followee.sharedInbox : undefined
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,11 +17,13 @@ export default async function(follower: IUser, followee: IUser) {
 | 
				
			||||||
		// 非正規化
 | 
							// 非正規化
 | 
				
			||||||
		_follower: {
 | 
							_follower: {
 | 
				
			||||||
			host: follower.host,
 | 
								host: follower.host,
 | 
				
			||||||
			inbox: isRemoteUser(follower) ? follower.inbox : undefined
 | 
								inbox: isRemoteUser(follower) ? follower.inbox : undefined,
 | 
				
			||||||
 | 
								sharedInbox: isRemoteUser(follower) ? follower.sharedInbox : undefined
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		_followee: {
 | 
							_followee: {
 | 
				
			||||||
			host: followee.host,
 | 
								host: followee.host,
 | 
				
			||||||
			inbox: isRemoteUser(followee) ? followee.inbox : undefined
 | 
								inbox: isRemoteUser(followee) ? followee.inbox : undefined,
 | 
				
			||||||
 | 
								sharedInbox: isRemoteUser(followee) ? followee.sharedInbox : undefined
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -403,7 +403,9 @@ async function publishToFollowers(note: INote, noteObj: any, user: IUser, noteAc
 | 
				
			||||||
		followeeId: note.userId
 | 
							followeeId: note.userId
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	followers.map(async (following) => {
 | 
						const queue: string[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						followers.map(following => {
 | 
				
			||||||
		const follower = following._follower;
 | 
							const follower = following._follower;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (isLocalUser(follower)) {
 | 
							if (isLocalUser(follower)) {
 | 
				
			||||||
| 
						 | 
					@ -423,10 +425,15 @@ async function publishToFollowers(note: INote, noteObj: any, user: IUser, noteAc
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			// フォロワーがリモートユーザーかつ投稿者がローカルユーザーなら投稿を配信
 | 
								// フォロワーがリモートユーザーかつ投稿者がローカルユーザーなら投稿を配信
 | 
				
			||||||
			if (isLocalUser(user)) {
 | 
								if (isLocalUser(user)) {
 | 
				
			||||||
				deliver(user, noteActivity, follower.inbox);
 | 
									const inbox = follower.sharedInbox || follower.inbox;
 | 
				
			||||||
 | 
									if (!queue.includes(inbox)) queue.push(inbox);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						queue.forEach(inbox => {
 | 
				
			||||||
 | 
							deliver(user, noteActivity, inbox);
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function deliverNoteToMentionedRemoteUsers(mentionedUsers: IUser[], user: ILocalUser, noteActivity: any) {
 | 
					function deliverNoteToMentionedRemoteUsers(mentionedUsers: IUser[], user: ILocalUser, noteActivity: any) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue