mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-31 05:24:13 +00:00 
			
		
		
		
	append mandatory CW in note previews
This commit is contained in:
		
							parent
							
								
									905b637648
								
							
						
					
					
						commit
						3d23cdc0e4
					
				
					 2 changed files with 18 additions and 4 deletions
				
			
		|  | @ -3,6 +3,7 @@ | ||||||
|  * SPDX-License-Identifier: AGPL-3.0-only |  * SPDX-License-Identifier: AGPL-3.0-only | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | import { appendContentWarning } from './append-content-warning.js'; | ||||||
| import type { Packed } from './json-schema.js'; | import type { Packed } from './json-schema.js'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -20,9 +21,15 @@ export const getNoteSummary = (note: Packed<'Note'>): string => { | ||||||
| 
 | 
 | ||||||
| 	let summary = ''; | 	let summary = ''; | ||||||
| 
 | 
 | ||||||
|  | 	// Append mandatory CW, if applicable
 | ||||||
|  | 	let cw = note.cw; | ||||||
|  | 	if (note.user.mandatoryCW) { | ||||||
|  | 		cw = appendContentWarning(cw, note.user.mandatoryCW); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// 本文
 | 	// 本文
 | ||||||
| 	if (note.cw != null) { | 	if (cw != null) { | ||||||
| 		summary += `CW: ${note.cw}`; | 		summary += `CW: ${cw}`; | ||||||
| 	} else if (note.text) { | 	} else if (note.text) { | ||||||
| 		summary += note.text; | 		summary += note.text; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import * as Misskey from 'misskey-js'; | import * as Misskey from 'misskey-js'; | ||||||
|  | import { appendContentWarning } from '@@/js/append-content-warning.js'; | ||||||
| import { i18n } from '@/i18n.js'; | import { i18n } from '@/i18n.js'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -25,9 +26,15 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => { | ||||||
| 
 | 
 | ||||||
| 	let summary = ''; | 	let summary = ''; | ||||||
| 
 | 
 | ||||||
|  | 	// Append mandatory CW, if applicable
 | ||||||
|  | 	let cw = note.cw; | ||||||
|  | 	if (note.user.mandatoryCW) { | ||||||
|  | 		cw = appendContentWarning(cw, note.user.mandatoryCW); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// 本文
 | 	// 本文
 | ||||||
| 	if (note.cw != null) { | 	if (cw != null) { | ||||||
| 		summary += `CW: ${note.cw}`; | 		summary += `CW: ${cw}`; | ||||||
| 	} else if (note.text) { | 	} else if (note.text) { | ||||||
| 		summary += note.text; | 		summary += note.text; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue