Fix bug
This commit is contained in:
		
							parent
							
								
									fe3dd25bc3
								
							
						
					
					
						commit
						1fea2cdcbe
					
				
					 3 changed files with 21 additions and 21 deletions
				
			
		| 
						 | 
					@ -36,6 +36,13 @@ export default async function(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Subscribe Home stream channel
 | 
						// Subscribe Home stream channel
 | 
				
			||||||
	subscriber.on(`user-stream:${user._id}`, async x => {
 | 
						subscriber.on(`user-stream:${user._id}`, async x => {
 | 
				
			||||||
 | 
							// Renoteなら再pack
 | 
				
			||||||
 | 
							if (x.type == 'note' && x.body.renoteId != null) {
 | 
				
			||||||
 | 
								x.body.renote = await pack(x.body.renoteId, user, {
 | 
				
			||||||
 | 
									detail: true
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する
 | 
							//#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する
 | 
				
			||||||
		if (x.type == 'note') {
 | 
							if (x.type == 'note') {
 | 
				
			||||||
			if (mutedUserIds.includes(x.body.userId)) {
 | 
								if (mutedUserIds.includes(x.body.userId)) {
 | 
				
			||||||
| 
						 | 
					@ -54,13 +61,6 @@ export default async function(
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		//#endregion
 | 
							//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Renoteなら再pack
 | 
					 | 
				
			||||||
		if (x.type == 'note' && x.body.renoteId != null) {
 | 
					 | 
				
			||||||
			x.body.renote = await pack(x.body.renoteId, user, {
 | 
					 | 
				
			||||||
				detail: true
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		connection.send(JSON.stringify(x));
 | 
							connection.send(JSON.stringify(x));
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,13 @@ export default async function(
 | 
				
			||||||
	subscriber.on(`hybrid-timeline:${user._id}`, onEvent);
 | 
						subscriber.on(`hybrid-timeline:${user._id}`, onEvent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	async function onEvent(note: any) {
 | 
						async function onEvent(note: any) {
 | 
				
			||||||
 | 
							// Renoteなら再pack
 | 
				
			||||||
 | 
							if (note.renoteId != null) {
 | 
				
			||||||
 | 
								note.renote = await pack(note.renoteId, user, {
 | 
				
			||||||
 | 
									detail: true
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
							//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
				
			||||||
		if (mutedUserIds.indexOf(note.userId) != -1) {
 | 
							if (mutedUserIds.indexOf(note.userId) != -1) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -31,13 +38,6 @@ export default async function(
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		//#endregion
 | 
							//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Renoteなら再pack
 | 
					 | 
				
			||||||
		if (note.renoteId != null) {
 | 
					 | 
				
			||||||
			note.renote = await pack(note.renoteId, user, {
 | 
					 | 
				
			||||||
				detail: true
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		connection.send(JSON.stringify({
 | 
							connection.send(JSON.stringify({
 | 
				
			||||||
			type: 'note',
 | 
								type: 'note',
 | 
				
			||||||
			body: note
 | 
								body: note
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,13 @@ export default async function(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Subscribe stream
 | 
						// Subscribe stream
 | 
				
			||||||
	subscriber.on('local-timeline', async note => {
 | 
						subscriber.on('local-timeline', async note => {
 | 
				
			||||||
 | 
							// Renoteなら再pack
 | 
				
			||||||
 | 
							if (note.renoteId != null) {
 | 
				
			||||||
 | 
								note.renote = await pack(note.renoteId, user, {
 | 
				
			||||||
 | 
									detail: true
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
							//#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
				
			||||||
		if (mutedUserIds.indexOf(note.userId) != -1) {
 | 
							if (mutedUserIds.indexOf(note.userId) != -1) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -28,13 +35,6 @@ export default async function(
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		//#endregion
 | 
							//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Renoteなら再pack
 | 
					 | 
				
			||||||
		if (note.renoteId != null) {
 | 
					 | 
				
			||||||
			note.renote = await pack(note.renoteId, user, {
 | 
					 | 
				
			||||||
				detail: true
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		connection.send(JSON.stringify({
 | 
							connection.send(JSON.stringify({
 | 
				
			||||||
			type: 'note',
 | 
								type: 'note',
 | 
				
			||||||
			body: note
 | 
								body: note
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue