Fix #2725
This commit is contained in:
		
							parent
							
								
									67ec10e86d
								
							
						
					
					
						commit
						f97cdfaa20
					
				
					 2 changed files with 14 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1,22 +1,10 @@
 | 
			
		|||
import { INote } from '../../../models/note';
 | 
			
		||||
import toHtml from '../../../mfm/html';
 | 
			
		||||
import parse from '../../../mfm/parse';
 | 
			
		||||
import config from '../../../config';
 | 
			
		||||
 | 
			
		||||
export default function(note: INote) {
 | 
			
		||||
	let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
 | 
			
		||||
	if (html == null) html = '';
 | 
			
		||||
 | 
			
		||||
	if (note.poll != null) {
 | 
			
		||||
		const url = `${config.url}/notes/${note._id}`;
 | 
			
		||||
		// TODO: i18n
 | 
			
		||||
		html += `<p><a href="${url}">【Misskeyで投票を見る】</a></p>`;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (note.renoteId != null) {
 | 
			
		||||
		const url = `${config.url}/notes/${note.renoteId}`;
 | 
			
		||||
		html += `<p>RE: <a href="${url}">${url}</a></p>`;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return html;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,6 +82,20 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
 | 
			
		|||
 | 
			
		||||
	const files = await promisedFiles;
 | 
			
		||||
 | 
			
		||||
	if (note.poll != null) {
 | 
			
		||||
		if (note.text == null) note.text = '';
 | 
			
		||||
		const url = `${config.url}/notes/${note._id}`;
 | 
			
		||||
		// TODO: i18n
 | 
			
		||||
		note.text += `\n\n[投票を見る](${url})`;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (note.renoteId != null) {
 | 
			
		||||
		if (note.text == null) note.text = '';
 | 
			
		||||
		const url = `${config.url}/notes/${note.renoteId}`;
 | 
			
		||||
		note.text += `\n\nRE: ${url}`;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 省略されたメンションのホストを復元する
 | 
			
		||||
	const text = note.text ? parseMfm(note.text).map(x => {
 | 
			
		||||
		if (x.type == 'mention' && x.host == null) {
 | 
			
		||||
			return `${x.content}@${config.host}`;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue