rudeshark.net/src/server/api/endpoints/notes/create.ts

334 lines
7.7 KiB
TypeScript
Raw Normal View History

2019-02-05 03:48:08 +01:00
import $ from 'cafy';
import ID, { transform, transformMany } from '../../../../misc/cafy-id';
import * as ms from 'ms';
import { length } from 'stringz';
import Note, { INote, isValidCw, pack } from '../../../../models/note';
2018-11-02 05:47:44 +01:00
import User, { IUser } from '../../../../models/user';
2018-07-05 16:36:07 +02:00
import DriveFile, { IDriveFile } from '../../../../models/drive-file';
2018-04-07 19:30:37 +02:00
import create from '../../../../services/note/create';
2018-11-02 05:47:44 +01:00
import define from '../../define';
import fetchMeta from '../../../../misc/fetch-meta';
import { ApiError } from '../../error';
let maxNoteTextLength = 1000;
setInterval(() => {
fetchMeta().then(m => {
maxNoteTextLength = m.maxNoteTextLength;
});
}, 3000);
2018-07-05 15:35:35 +02:00
export const meta = {
2018-10-21 22:16:27 +02:00
stability: 'stable',
2018-07-05 16:47:36 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': '投稿します。'
2018-07-05 16:47:36 +02:00
},
2018-07-05 17:04:40 +02:00
tags: ['notes'],
2018-07-15 20:25:35 +02:00
requireCredential: true,
limit: {
duration: ms('1hour'),
2018-08-17 21:21:49 +02:00
max: 300
2018-07-15 20:25:35 +02:00
},
kind: 'note-write',
2018-07-05 15:35:35 +02:00
params: {
2018-11-01 19:32:24 +01:00
visibility: {
2019-02-13 08:33:07 +01:00
validator: $.optional.str.or(['public', 'home', 'followers', 'specified', 'private']),
2018-07-05 15:35:35 +02:00
default: 'public',
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': '投稿の公開範囲'
2018-07-05 15:35:35 +02:00
}
2018-11-01 19:32:24 +01:00
},
2018-07-05 16:36:07 +02:00
2018-11-01 19:32:24 +01:00
visibleUserIds: {
2019-02-13 08:33:07 +01:00
validator: $.optional.arr($.type(ID)).unique().min(0),
2018-11-01 19:32:24 +01:00
transform: transformMany,
2018-07-05 15:35:35 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': '(投稿の公開範囲が specified の場合)投稿を閲覧できるユーザー'
2018-07-05 15:35:35 +02:00
}
2018-11-01 19:32:24 +01:00
},
2018-07-05 16:36:07 +02:00
2018-11-01 19:32:24 +01:00
text: {
2019-02-13 08:33:07 +01:00
validator: $.optional.nullable.str.pipe(text =>
length(text.trim()) <= maxNoteTextLength && text.trim() != ''
),
2018-11-01 19:32:24 +01:00
default: null as any,
2018-07-05 15:35:35 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': '投稿内容'
2018-07-05 15:35:35 +02:00
}
2018-11-01 19:32:24 +01:00
},
2018-07-05 16:36:07 +02:00
2018-11-01 19:32:24 +01:00
cw: {
2019-02-13 08:33:07 +01:00
validator: $.optional.nullable.str.pipe(isValidCw),
2018-07-05 16:36:07 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': 'コンテンツの警告。このパラメータを指定すると設定したテキストで投稿のコンテンツを隠す事が出来ます。'
2018-07-05 16:36:07 +02:00
}
2018-11-01 19:32:24 +01:00
},
2018-07-05 16:36:07 +02:00
2018-11-01 19:32:24 +01:00
viaMobile: {
2019-02-13 08:33:07 +01:00
validator: $.optional.bool,
2018-07-05 16:36:07 +02:00
default: false,
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': 'モバイルデバイスからの投稿か否か。'
2018-07-05 16:36:07 +02:00
}
2018-11-01 19:32:24 +01:00
},
localOnly: {
2019-02-13 08:33:07 +01:00
validator: $.optional.bool,
default: false,
desc: {
'ja-JP': 'ローカルのみに投稿か否か。'
}
},
noExtractMentions: {
2019-02-13 08:33:07 +01:00
validator: $.optional.bool,
default: false,
desc: {
'ja-JP': '本文からメンションを展開しないか否か。'
}
},
noExtractHashtags: {
2019-02-13 08:33:07 +01:00
validator: $.optional.bool,
default: false,
desc: {
'ja-JP': '本文からハッシュタグを展開しないか否か。'
}
},
noExtractEmojis: {
2019-02-13 08:33:07 +01:00
validator: $.optional.bool,
default: false,
desc: {
'ja-JP': '本文からカスタム絵文字を展開しないか否か。'
}
},
2018-11-01 19:32:24 +01:00
geo: {
2019-02-13 08:33:07 +01:00
validator: $.optional.nullable.obj({
2018-11-01 19:32:24 +01:00
coordinates: $.arr().length(2)
.item(0, $.num.range(-180, 180))
.item(1, $.num.range(-90, 90)),
2019-02-13 08:33:07 +01:00
altitude: $.nullable.num,
accuracy: $.nullable.num,
altitudeAccuracy: $.nullable.num,
heading: $.nullable.num.range(0, 360),
speed: $.nullable.num
}).strict(),
2018-07-05 16:36:07 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': '位置情報'
2018-07-05 19:58:29 +02:00
},
ref: 'geo'
2018-11-01 19:32:24 +01:00
},
2018-07-05 16:36:07 +02:00
2018-11-01 19:32:24 +01:00
fileIds: {
2019-02-13 08:33:07 +01:00
validator: $.optional.arr($.type(ID)).unique().range(1, 4),
2018-11-01 19:32:24 +01:00
transform: transformMany,
2018-09-05 12:32:46 +02:00
desc: {
'ja-JP': '添付するファイル'
}
2018-11-01 19:32:24 +01:00
},
2018-09-05 12:32:46 +02:00
2018-11-01 19:32:24 +01:00
mediaIds: {
2019-02-13 08:33:07 +01:00
validator: $.optional.arr($.type(ID)).unique().range(1, 4),
2018-11-01 19:32:24 +01:00
transform: transformMany,
2019-02-24 20:18:09 +01:00
deprecated: true,
2018-07-05 16:36:07 +02:00
desc: {
2018-09-05 12:32:46 +02:00
'ja-JP': '添付するファイル (このパラメータは廃止予定です。代わりに fileIds を使ってください。)'
2018-07-05 16:36:07 +02:00
}
2018-11-01 19:32:24 +01:00
},
2018-07-05 16:36:07 +02:00
2018-11-01 19:32:24 +01:00
replyId: {
2019-02-13 08:33:07 +01:00
validator: $.optional.type(ID),
2018-11-01 19:32:24 +01:00
transform: transform,
desc: {
'ja-JP': '返信対象'
}
},
renoteId: {
2019-02-13 08:33:07 +01:00
validator: $.optional.type(ID),
2018-11-01 19:32:24 +01:00
transform: transform,
2018-07-05 16:36:07 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': 'Renote対象'
2018-07-05 16:36:07 +02:00
}
2018-11-01 19:32:24 +01:00
},
poll: {
2019-02-13 08:33:07 +01:00
validator: $.optional.obj({
2018-11-01 19:32:24 +01:00
choices: $.arr($.str)
.unique()
.range(2, 10)
Enhance poll (#4409) * Start working * WIP: Enhance poll * Fix bug * Use `name` in voting note refs: https://github.com/syuilo/misskey/issues/4407#issuecomment-469057296 * Fix style * Refactor Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> * WIP: Update poll editor * Fix bug * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r * Fix typo * Better design * Beautify poll editor * Fix UI * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r262217524 * Add debug logging * Fix bug * Log deliver * fix vote * Update ap/show refs: https://github.com/syuilo/misskey/pull/4409#issuecomment-469652386 * Update poll view * Maybe done * Add tests * Fix path * Fix test * Fix test * Fix test * Fix expired check on AP * Update note.ts * Squashed commit of the following: commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Squashed commit of the following: commit ae696b1ed12568b27c27367ac5a77035c97c9a1f Author: mei23 <m@m544.net> Date: Wed Mar 6 06:11:17 2019 +0900 fix commit b735e354e7a9e64534c4f17d04ecbc65fb735c21 Author: mei23 <m@m544.net> Date: Wed Mar 6 06:08:33 2019 +0900 messge commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Fix typo * Update vote.ts * Update vote.ts * Update poll-editor.vue * Update tslint.json * Fix layout * Add note * Fix bug * Rename text key * 投票するときに投稿として扱わないように (#4425) * wip * 形式をMastodonと合わせた * Bye something * Use - instead of ~ * Redundancy * Yes! * Refactor * Use moment instead of Date * Fix indent * Refactor if (votes.length) は必要なさそう * Clean up * Bye Date * Clean * Fix timer is not displayed * Fix リモートから無期限pollにvoteできない * Fix vote actor
2019-03-06 14:55:47 +01:00
.each(c => c.length > 0 && c.length < 50),
multiple: $.optional.bool,
expiresAt: $.optional.nullable.num.int(),
expiredAfter: $.optional.nullable.num.int().min(1)
2019-02-13 08:33:07 +01:00
}).strict(),
2018-07-05 16:36:07 +02:00
desc: {
2018-08-28 23:59:43 +02:00
'ja-JP': 'アンケート'
2018-07-05 19:58:29 +02:00
},
ref: 'poll'
2018-11-01 19:32:24 +01:00
}
2018-07-05 16:47:36 +02:00
},
2018-07-05 17:04:40 +02:00
2018-07-05 16:47:36 +02:00
res: {
2018-07-05 17:04:40 +02:00
type: 'object',
2019-02-24 01:45:27 +01:00
properties: {
2018-07-05 16:47:36 +02:00
createdNote: {
type: 'Note',
2019-02-24 01:45:27 +01:00
description: '作成した投稿'
2018-07-05 16:47:36 +02:00
}
}
},
errors: {
noSuchRenoteTarget: {
message: 'No such renote target.',
code: 'NO_SUCH_RENOTE_TARGET',
id: 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4'
},
cannotReRenote: {
message: 'You can not Renote a pure Renote.',
code: 'CANNOT_RENOTE_TO_A_PURE_RENOTE',
id: 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a'
},
noSuchReplyTarget: {
message: 'No such reply target.',
code: 'NO_SUCH_REPLY_TARGET',
id: '749ee0f6-d3da-459a-bf02-282e2da4292c'
},
cannotReplyToPureRenote: {
message: 'You can not reply to a pure Renote.',
code: 'CANNOT_REPLY_TO_A_PURE_RENOTE',
id: '3ac74a84-8fd5-4bb0-870f-01804f82ce15'
},
contentRequired: {
message: 'Content required. You need to set text, fileIds, renoteId or poll.',
code: 'CONTENT_REQUIRED',
id: '6f57e42b-c348-439b-bc45-993995cc515a'
},
Enhance poll (#4409) * Start working * WIP: Enhance poll * Fix bug * Use `name` in voting note refs: https://github.com/syuilo/misskey/issues/4407#issuecomment-469057296 * Fix style * Refactor Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> * WIP: Update poll editor * Fix bug * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r * Fix typo * Better design * Beautify poll editor * Fix UI * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r262217524 * Add debug logging * Fix bug * Log deliver * fix vote * Update ap/show refs: https://github.com/syuilo/misskey/pull/4409#issuecomment-469652386 * Update poll view * Maybe done * Add tests * Fix path * Fix test * Fix test * Fix test * Fix expired check on AP * Update note.ts * Squashed commit of the following: commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Squashed commit of the following: commit ae696b1ed12568b27c27367ac5a77035c97c9a1f Author: mei23 <m@m544.net> Date: Wed Mar 6 06:11:17 2019 +0900 fix commit b735e354e7a9e64534c4f17d04ecbc65fb735c21 Author: mei23 <m@m544.net> Date: Wed Mar 6 06:08:33 2019 +0900 messge commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Fix typo * Update vote.ts * Update vote.ts * Update poll-editor.vue * Update tslint.json * Fix layout * Add note * Fix bug * Rename text key * 投票するときに投稿として扱わないように (#4425) * wip * 形式をMastodonと合わせた * Bye something * Use - instead of ~ * Redundancy * Yes! * Refactor * Use moment instead of Date * Fix indent * Refactor if (votes.length) は必要なさそう * Clean up * Bye Date * Clean * Fix timer is not displayed * Fix リモートから無期限pollにvoteできない * Fix vote actor
2019-03-06 14:55:47 +01:00
cannotCreateAlreadyExpiredPoll: {
message: 'Poll is already expired.',
code: 'CANNOT_CREATE_ALREADY_EXPIRED_POLL',
id: '04da457d-b083-4055-9082-955525eda5a5'
}
2018-07-05 15:35:35 +02:00
}
};
2018-04-07 19:30:37 +02:00
export default define(meta, async (ps, user, app) => {
2018-06-18 02:54:53 +02:00
let visibleUsers: IUser[] = [];
2018-11-01 19:32:24 +01:00
if (ps.visibleUserIds) {
2018-07-05 15:35:35 +02:00
visibleUsers = await Promise.all(ps.visibleUserIds.map(id => User.findOne({
2018-04-28 21:30:51 +02:00
_id: id
})));
}
2018-07-05 16:36:07 +02:00
let files: IDriveFile[] = [];
2018-09-05 12:32:46 +02:00
const fileIds = ps.fileIds != null ? ps.fileIds : ps.mediaIds != null ? ps.mediaIds : null;
if (fileIds != null) {
2018-09-09 18:51:46 +02:00
files = await Promise.all(fileIds.map(fileId => {
return DriveFile.findOne({
2018-09-05 12:32:46 +02:00
_id: fileId,
2018-04-07 19:30:37 +02:00
'metadata.userId': user._id
});
2018-09-09 18:51:46 +02:00
}));
2018-04-07 19:30:37 +02:00
2018-09-09 18:51:46 +02:00
files = files.filter(file => file != null);
2018-04-07 19:30:37 +02:00
}
let renote: INote = null;
2018-11-01 19:32:24 +01:00
if (ps.renoteId != null) {
2018-04-07 19:30:37 +02:00
// Fetch renote to note
renote = await Note.findOne({
2018-07-05 16:36:07 +02:00
_id: ps.renoteId
2018-04-07 19:30:37 +02:00
});
if (renote == null) {
throw new ApiError(meta.errors.noSuchRenoteTarget);
2018-09-05 12:32:46 +02:00
} else if (renote.renoteId && !renote.text && !renote.fileIds) {
throw new ApiError(meta.errors.cannotReRenote);
2018-04-07 19:30:37 +02:00
}
}
let reply: INote = null;
2018-11-01 19:32:24 +01:00
if (ps.replyId != null) {
2018-04-07 19:30:37 +02:00
// Fetch reply
reply = await Note.findOne({
2018-11-01 19:32:24 +01:00
_id: ps.replyId
2018-04-07 19:30:37 +02:00
});
if (reply === null) {
throw new ApiError(meta.errors.noSuchReplyTarget);
2018-04-07 19:30:37 +02:00
}
// 返信対象が引用でないRenoteだったらエラー
2018-09-05 12:32:46 +02:00
if (reply.renoteId && !reply.text && !reply.fileIds) {
throw new ApiError(meta.errors.cannotReplyToPureRenote);
2018-04-07 19:30:37 +02:00
}
}
2018-07-05 16:36:07 +02:00
if (ps.poll) {
(ps.poll as any).choices = (ps.poll as any).choices.map((choice: string, i: number) => ({
2018-04-07 19:30:37 +02:00
id: i, // IDを付与
text: choice.trim(),
votes: 0
}));
Enhance poll (#4409) * Start working * WIP: Enhance poll * Fix bug * Use `name` in voting note refs: https://github.com/syuilo/misskey/issues/4407#issuecomment-469057296 * Fix style * Refactor Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> * WIP: Update poll editor * Fix bug * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r * Fix typo * Better design * Beautify poll editor * Fix UI * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r262217524 * Add debug logging * Fix bug * Log deliver * fix vote * Update ap/show refs: https://github.com/syuilo/misskey/pull/4409#issuecomment-469652386 * Update poll view * Maybe done * Add tests * Fix path * Fix test * Fix test * Fix test * Fix expired check on AP * Update note.ts * Squashed commit of the following: commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Squashed commit of the following: commit ae696b1ed12568b27c27367ac5a77035c97c9a1f Author: mei23 <m@m544.net> Date: Wed Mar 6 06:11:17 2019 +0900 fix commit b735e354e7a9e64534c4f17d04ecbc65fb735c21 Author: mei23 <m@m544.net> Date: Wed Mar 6 06:08:33 2019 +0900 messge commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Fix typo * Update vote.ts * Update vote.ts * Update poll-editor.vue * Update tslint.json * Fix layout * Add note * Fix bug * Rename text key * 投票するときに投稿として扱わないように (#4425) * wip * 形式をMastodonと合わせた * Bye something * Use - instead of ~ * Redundancy * Yes! * Refactor * Use moment instead of Date * Fix indent * Refactor if (votes.length) は必要なさそう * Clean up * Bye Date * Clean * Fix timer is not displayed * Fix リモートから無期限pollにvoteできない * Fix vote actor
2019-03-06 14:55:47 +01:00
if (typeof ps.poll.expiresAt === 'number') {
if (ps.poll.expiresAt < Date.now())
throw new ApiError(meta.errors.cannotCreateAlreadyExpiredPoll);
} else if (typeof ps.poll.expiredAfter === 'number') {
ps.poll.expiresAt = Date.now() + ps.poll.expiredAfter;
}
2018-04-07 19:30:37 +02:00
}
// テキストが無いかつ添付ファイルが無いかつRenoteも無いかつ投票も無かったらエラー
if (!(ps.text || files.length || renote || ps.poll)) {
throw new ApiError(meta.errors.contentRequired);
2018-04-07 19:30:37 +02:00
}
2018-12-28 18:55:46 +01:00
// 後方互換性のため
if (ps.visibility == 'private') {
ps.visibility = 'specified';
}
2018-04-07 19:30:37 +02:00
// 投稿を作成
const note = await create(user, {
2018-04-07 19:30:37 +02:00
createdAt: new Date(),
2018-09-05 12:32:46 +02:00
files: files,
Enhance poll (#4409) * Start working * WIP: Enhance poll * Fix bug * Use `name` in voting note refs: https://github.com/syuilo/misskey/issues/4407#issuecomment-469057296 * Fix style * Refactor Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> * WIP: Update poll editor * Fix bug * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r * Fix typo * Better design * Beautify poll editor * Fix UI * Fix bug refs: https://github.com/syuilo/misskey/pull/4409#discussion_r262217524 * Add debug logging * Fix bug * Log deliver * fix vote * Update ap/show refs: https://github.com/syuilo/misskey/pull/4409#issuecomment-469652386 * Update poll view * Maybe done * Add tests * Fix path * Fix test * Fix test * Fix test * Fix expired check on AP * Update note.ts * Squashed commit of the following: commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Squashed commit of the following: commit ae696b1ed12568b27c27367ac5a77035c97c9a1f Author: mei23 <m@m544.net> Date: Wed Mar 6 06:11:17 2019 +0900 fix commit b735e354e7a9e64534c4f17d04ecbc65fb735c21 Author: mei23 <m@m544.net> Date: Wed Mar 6 06:08:33 2019 +0900 messge commit d9a4beabf851893b8992a0f4568265eb9d4f0b8e Author: mei23 <m@m544.net> Date: Wed Mar 6 05:16:14 2019 +0900 tune commit 83ff421a6e978243f80ba9ec820189bc897e6e3b Author: mei23 <m@m544.net> Date: Wed Mar 6 05:01:14 2019 +0900 fallback commit 0b566af973b115ade9e75ea4b8094ee2b329dabc Author: mei23 <m@m544.net> Date: Wed Mar 6 04:40:12 2019 +0900 Note commit cc0296dd6127580ac584c40398db3f762a311f8b Author: mei23 <m@m544.net> Date: Wed Mar 6 04:33:58 2019 +0900 createで送る * Fix typo * Update vote.ts * Update vote.ts * Update poll-editor.vue * Update tslint.json * Fix layout * Add note * Fix bug * Rename text key * 投票するときに投稿として扱わないように (#4425) * wip * 形式をMastodonと合わせた * Bye something * Use - instead of ~ * Redundancy * Yes! * Refactor * Use moment instead of Date * Fix indent * Refactor if (votes.length) は必要なさそう * Clean up * Bye Date * Clean * Fix timer is not displayed * Fix リモートから無期限pollにvoteできない * Fix vote actor
2019-03-06 14:55:47 +01:00
poll: ps.poll ? {
choices: ps.poll.choices,
multiple: ps.poll.multiple || false,
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null
} : undefined,
2018-07-05 16:36:07 +02:00
text: ps.text,
2018-04-07 19:30:37 +02:00
reply,
renote,
2018-07-05 16:36:07 +02:00
cw: ps.cw,
2018-04-22 10:04:52 +02:00
app,
2018-07-05 16:36:07 +02:00
viaMobile: ps.viaMobile,
localOnly: ps.localOnly,
2018-07-05 16:36:07 +02:00
visibility: ps.visibility,
2018-04-28 21:30:51 +02:00
visibleUsers,
apMentions: ps.noExtractMentions ? [] : undefined,
apHashtags: ps.noExtractHashtags ? [] : undefined,
apEmojis: ps.noExtractEmojis ? [] : undefined,
2018-07-05 16:36:07 +02:00
geo: ps.geo
2018-04-07 19:30:37 +02:00
});
return {
createdNote: await pack(note, user)
};
});