mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	refactor: Rename function
This commit is contained in:
		
							parent
							
								
									0efa969a15
								
							
						
					
					
						commit
						a8adc46f3b
					
				
					 9 changed files with 17 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
export default function(note: any, mutedUserIds: string[]): boolean {
 | 
			
		||||
export function isMutedUserRelated(note: any, mutedUserIds: string[]): boolean {
 | 
			
		||||
	if (mutedUserIds.includes(note.userId)) {
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
 | 
			
		||||
export default class extends Channel {
 | 
			
		||||
	public readonly chName = 'antenna';
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ export default class extends Channel {
 | 
			
		|||
			const note = await Notes.pack(body.id, this.user, { detail: true });
 | 
			
		||||
 | 
			
		||||
			// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
			if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
			if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
			this.send('note', note);
 | 
			
		||||
		} else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { fetchMeta } from '../../../../misc/fetch-meta';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ export default class extends Channel {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
		if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
		if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートすべきNoteだったら無視する
 | 
			
		||||
		// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
import { PackedNote } from '../../../../models/repositories/note';
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ export default class extends Channel {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
		if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
		if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
		this.send('note', note);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
import { PackedNote } from '../../../../models/repositories/note';
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +51,7 @@ export default class extends Channel {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
		if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
		if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートすべきNoteだったら無視する
 | 
			
		||||
		// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { fetchMeta } from '../../../../misc/fetch-meta';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ export default class extends Channel {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
		if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
		if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートすべきNoteだったら無視する
 | 
			
		||||
		// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { fetchMeta } from '../../../../misc/fetch-meta';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ export default class extends Channel {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
		if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
		if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートすべきNoteだったら無視する
 | 
			
		||||
		// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Channel from '../channel';
 | 
			
		||||
import { Notes, UserListJoinings, UserLists } from '../../../../models';
 | 
			
		||||
import shouldMuteThisNote from '../../../../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../../../../misc/is-muted-user-related';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
import { PackedNote } from '../../../../models/repositories/note';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -73,7 +73,7 @@ export default class extends Channel {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
 | 
			
		||||
		if (shouldMuteThisNote(note, this.muting)) return;
 | 
			
		||||
		if (isMutedUserRelated(note, this.muting)) return;
 | 
			
		||||
 | 
			
		||||
		this.send('note', note);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@ import { Antenna } from '../models/entities/antenna';
 | 
			
		|||
import { Note } from '../models/entities/note';
 | 
			
		||||
import { AntennaNotes, Mutings, Notes } from '../models';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import shouldMuteThisNote from '../misc/should-mute-this-note';
 | 
			
		||||
import { isMutedUserRelated } from '../misc/is-muted-user-related';
 | 
			
		||||
import { ensure } from '../prelude/ensure';
 | 
			
		||||
import { publishAntennaStream, publishMainStream } from './stream';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: U
 | 
			
		|||
			_note.renote = await Notes.findOne(note.renoteId).then(ensure);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (shouldMuteThisNote(_note, mutings.map(x => x.muteeId))) {
 | 
			
		||||
		if (isMutedUserRelated(_note, mutings.map(x => x.muteeId))) {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue