Compare commits
9 Commits
11.0.0-bet
...
11.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
60a11f8da5 | ||
![]() |
1181fcdceb | ||
![]() |
8cb9852058 | ||
![]() |
53d46d1cbe | ||
![]() |
275e1c8de9 | ||
![]() |
d46eca4c87 | ||
![]() |
2927fb1597 | ||
![]() |
8c72e011d2 | ||
![]() |
69662e24c3 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "11.0.0-beta.8",
|
"version": "11.0.0-beta.10",
|
||||||
"codename": "daybreak",
|
"codename": "daybreak",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@@ -20,7 +20,7 @@ export async function getFallbackReaction(): Promise<string> {
|
|||||||
return meta.useStarForReactionFallback ? 'star' : 'like';
|
return meta.useStarForReactionFallback ? 'star' : 'like';
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function toDbReaction(reaction: string, enableEmoji = true): Promise<string> {
|
export async function toDbReaction(reaction?: string | null, enableEmoji = true): Promise<string> {
|
||||||
if (reaction == null) return await getFallbackReaction();
|
if (reaction == null) return await getFallbackReaction();
|
||||||
|
|
||||||
// 既存の文字列リアクションはそのまま
|
// 既存の文字列リアクションはそのまま
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { EntityRepository, Repository } from 'typeorm';
|
import { EntityRepository, Repository } from 'typeorm';
|
||||||
import { UserList } from '../entities/user-list';
|
import { UserList } from '../entities/user-list';
|
||||||
import { ensure } from '../../prelude/ensure';
|
import { ensure } from '../../prelude/ensure';
|
||||||
|
import { UserListJoinings } from '..';
|
||||||
|
|
||||||
@EntityRepository(UserList)
|
@EntityRepository(UserList)
|
||||||
export class UserListRepository extends Repository<UserList> {
|
export class UserListRepository extends Repository<UserList> {
|
||||||
@@ -9,9 +10,14 @@ export class UserListRepository extends Repository<UserList> {
|
|||||||
) {
|
) {
|
||||||
const userList = typeof src === 'object' ? src : await this.findOne(src).then(ensure);
|
const userList = typeof src === 'object' ? src : await this.findOne(src).then(ensure);
|
||||||
|
|
||||||
|
const users = await UserListJoinings.find({
|
||||||
|
userListId: userList.id
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: userList.id,
|
id: userList.id,
|
||||||
name: userList.name
|
name: userList.name,
|
||||||
|
userIds: users.map(x => x.userId)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -120,13 +120,15 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
// リプライ
|
// リプライ
|
||||||
const reply: Note | undefined | null = note.inReplyTo
|
const reply: Note | null = note.inReplyTo
|
||||||
? await resolveNote(note.inReplyTo, resolver).catch(e => {
|
? await resolveNote(note.inReplyTo, resolver).then(x => {
|
||||||
// 4xxの場合はリプライしてないことにする
|
if (x == null) {
|
||||||
if (e.statusCode >= 400 && e.statusCode < 500) {
|
logger.warn(`Specified inReplyTo, but nout found`);
|
||||||
logger.warn(`Ignored inReplyTo ${note.inReplyTo} - ${e.statusCode} `);
|
throw 'inReplyTo not found';
|
||||||
return null;
|
} else {
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
}).catch(e => {
|
||||||
logger.warn(`Error in inReplyTo ${note.inReplyTo} - ${e.statusCode || e}`);
|
logger.warn(`Error in inReplyTo ${note.inReplyTo} - ${e.statusCode || e}`);
|
||||||
throw e;
|
throw e;
|
||||||
})
|
})
|
||||||
@@ -150,11 +152,11 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
|||||||
const cw = note.summary === '' ? null : note.summary;
|
const cw = note.summary === '' ? null : note.summary;
|
||||||
|
|
||||||
// テキストのパース
|
// テキストのパース
|
||||||
const text = note._misskey_content || fromHtml(note.content);
|
const text = note._misskey_content || (note.content ? fromHtml(note.content) : null);
|
||||||
|
|
||||||
// vote
|
// vote
|
||||||
if (reply && reply.hasPoll) {
|
if (reply && reply.hasPoll) {
|
||||||
const poll = await Polls.findOne({ noteId: reply.id }).then(ensure);
|
const poll = await Polls.findOne(reply.id).then(ensure);
|
||||||
|
|
||||||
const tryCreateVote = async (name: string, index: number): Promise<null> => {
|
const tryCreateVote = async (name: string, index: number): Promise<null> => {
|
||||||
if (poll.expiresAt && Date.now() > new Date(poll.expiresAt).getTime()) {
|
if (poll.expiresAt && Date.now() > new Date(poll.expiresAt).getTime()) {
|
||||||
|
@@ -12,7 +12,7 @@ export interface IObject {
|
|||||||
attachment?: any[];
|
attachment?: any[];
|
||||||
inReplyTo?: any;
|
inReplyTo?: any;
|
||||||
replies?: ICollection;
|
replies?: ICollection;
|
||||||
content: string;
|
content?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
startTime?: Date;
|
startTime?: Date;
|
||||||
endTime?: Date;
|
endTime?: Date;
|
||||||
@@ -44,16 +44,16 @@ export interface IOrderedCollection extends IObject {
|
|||||||
|
|
||||||
export interface INote extends IObject {
|
export interface INote extends IObject {
|
||||||
type: 'Note' | 'Question';
|
type: 'Note' | 'Question';
|
||||||
_misskey_content: string;
|
_misskey_content?: string;
|
||||||
_misskey_quote: string;
|
_misskey_quote?: string;
|
||||||
_misskey_question: string;
|
_misskey_question?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQuestion extends IObject {
|
export interface IQuestion extends IObject {
|
||||||
type: 'Note' | 'Question';
|
type: 'Note' | 'Question';
|
||||||
_misskey_content: string;
|
_misskey_content?: string;
|
||||||
_misskey_quote: string;
|
_misskey_quote?: string;
|
||||||
_misskey_question: string;
|
_misskey_question?: string;
|
||||||
oneOf?: IQuestionChoice[];
|
oneOf?: IQuestionChoice[];
|
||||||
anyOf?: IQuestionChoice[];
|
anyOf?: IQuestionChoice[];
|
||||||
endTime?: Date;
|
endTime?: Date;
|
||||||
@@ -129,7 +129,7 @@ export interface IRemove extends IActivity {
|
|||||||
|
|
||||||
export interface ILike extends IActivity {
|
export interface ILike extends IActivity {
|
||||||
type: 'Like';
|
type: 'Like';
|
||||||
_misskey_reaction: string;
|
_misskey_reaction?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAnnounce extends IActivity {
|
export interface IAnnounce extends IActivity {
|
||||||
|
@@ -124,7 +124,7 @@ export default define(meta, async (ps, user) => {
|
|||||||
|
|
||||||
// Increment votes count
|
// Increment votes count
|
||||||
const index = ps.choice + 1; // In SQL, array index is 1 based
|
const index = ps.choice + 1; // In SQL, array index is 1 based
|
||||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE noteId = '${poll.noteId}'`);
|
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE "noteId" = '${poll.noteId}'`);
|
||||||
|
|
||||||
publishNoteStream(note.id, 'pollVoted', {
|
publishNoteStream(note.id, 'pollVoted', {
|
||||||
choice: ps.choice,
|
choice: ps.choice,
|
||||||
|
@@ -8,7 +8,7 @@ import { genId } from '../../../misc/gen-id';
|
|||||||
import { createNotification } from '../../create-notification';
|
import { createNotification } from '../../create-notification';
|
||||||
|
|
||||||
export default async function(user: User, note: Note, choice: number) {
|
export default async function(user: User, note: Note, choice: number) {
|
||||||
const poll = await Polls.findOne({ noteId: note.id });
|
const poll = await Polls.findOne(note.id);
|
||||||
|
|
||||||
if (poll == null) throw 'poll not found';
|
if (poll == null) throw 'poll not found';
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ import { NoteReaction } from '../../../models/entities/note-reaction';
|
|||||||
import { createNotification } from '../../create-notification';
|
import { createNotification } from '../../create-notification';
|
||||||
import { isDuplicateKeyValueError } from '../../../misc/is-duplicate-key-value-error';
|
import { isDuplicateKeyValueError } from '../../../misc/is-duplicate-key-value-error';
|
||||||
|
|
||||||
export default async (user: User, note: Note, reaction: string) => {
|
export default async (user: User, note: Note, reaction?: string) => {
|
||||||
// Myself
|
// Myself
|
||||||
if (note.userId === user.id) {
|
if (note.userId === user.id) {
|
||||||
throw new IdentifiableError('2d8e7297-1873-4c00-8404-792c68d7bef0', 'cannot react to my note');
|
throw new IdentifiableError('2d8e7297-1873-4c00-8404-792c68d7bef0', 'cannot react to my note');
|
||||||
|
@@ -63,7 +63,9 @@ export async function updateHashtag(user: User, tag: string, isUserAttached = fa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
q.execute();
|
if (Object.keys(set).length > 0) {
|
||||||
|
q.execute();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isUserAttached) {
|
if (isUserAttached) {
|
||||||
Hashtags.save({
|
Hashtags.save({
|
||||||
|
Reference in New Issue
Block a user