投稿を削除したときにお気に入りからも削除するように
This commit is contained in:
		
							parent
							
								
									13e43a4f74
								
							
						
					
					
						commit
						68a6758302
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -15,6 +15,7 @@ import DriveFile from '../../models/drive-file';
 | 
				
			||||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
 | 
					import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
 | 
				
			||||||
import Instance from '../../models/instance';
 | 
					import Instance from '../../models/instance';
 | 
				
			||||||
import instanceChart from '../../services/chart/instance';
 | 
					import instanceChart from '../../services/chart/instance';
 | 
				
			||||||
 | 
					import Favorite from '../../models/favorite';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 投稿を削除します。
 | 
					 * 投稿を削除します。
 | 
				
			||||||
| 
						 | 
					@ -61,6 +62,11 @@ export default async function(user: IUser, note: INote, quiet = false) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// この投稿をお気に入りから削除
 | 
				
			||||||
 | 
						Favorite.remove({
 | 
				
			||||||
 | 
							noteId: note._id
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// ファイルが添付されていた場合ドライブのファイルの「このファイルが添付された投稿一覧」プロパティからこの投稿を削除
 | 
						// ファイルが添付されていた場合ドライブのファイルの「このファイルが添付された投稿一覧」プロパティからこの投稿を削除
 | 
				
			||||||
	if (note.fileIds) {
 | 
						if (note.fileIds) {
 | 
				
			||||||
		for (const fileId of note.fileIds) {
 | 
							for (const fileId of note.fileIds) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue