Compare commits

...

4 Commits

Author SHA1 Message Date
syuilo
71bada97df 8.45.1 2018-09-17 12:19:54 +09:00
syuilo
62509edcbe Refactor 2018-09-17 12:18:59 +09:00
syuilo
f97cdfaa20 Fix #2725 2018-09-17 11:59:24 +09:00
syuilo
67ec10e86d Add untilId param 2018-09-17 11:43:53 +09:00
4 changed files with 42 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "8.45.0",
"clientVersion": "1.0.9834",
"version": "8.45.1",
"clientVersion": "1.0.9840",
"codename": "nighthike",
"main": "./built/index.js",
"private": true,

View File

@@ -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;
}

View File

@@ -82,20 +82,38 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
const files = await promisedFiles;
const text = note.text ? parseMfm(note.text).map(x => {
if (x.type == 'mention' && x.host == null) {
return `${x.content}@${config.host}`;
} else {
return x.content;
}
}).join('') : null;
let text = note.text;
if (note.poll != null) {
if (text == null) text = '';
const url = `${config.url}/notes/${note._id}`;
// TODO: i18n
text += `\n\n[投票を見る](${url})`;
}
if (note.renoteId != null) {
if (text == null) text = '';
const url = `${config.url}/notes/${note.renoteId}`;
text += `\n\nRE: ${url}`;
}
// 省略されたメンションのホストを復元する
if (text != null) {
text = parseMfm(text).map(x => {
if (x.type == 'mention' && x.host == null) {
return `${x.content}@${config.host}`;
} else {
return x.content;
}
}).join('');
}
return {
id: `${config.url}/notes/${note._id}`,
type: 'Note',
attributedTo,
summary: note.cw,
content: toHtml(note),
content: toHtml(Object.assign({}, note, { text })),
_misskey_content: text,
published: note.createdAt.toISOString(),
to,

View File

@@ -87,6 +87,12 @@ export const meta = {
}
}),
untilId: $.type(ID).optional.note({
desc: {
'ja-JP': '指定すると、この投稿を基点としてより古い投稿を取得します'
}
}),
sinceDate: $.num.optional.note({
}),
@@ -318,6 +324,14 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
}
}
if (ps.untilId) {
push({
_id: {
$lt: ps.untilId
}
});
}
if (ps.sinceDate) {
push({
createdAt: {