mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-14 18:25:45 +01:00
Fix bug
This commit is contained in:
parent
8cb9852058
commit
1181fcdceb
4 changed files with 11 additions and 11 deletions
|
@ -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();
|
||||||
|
|
||||||
// 既存の文字列リアクションはそのまま
|
// 既存の文字列リアクションはそのまま
|
||||||
|
|
|
@ -152,7 +152,7 @@ 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) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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');
|
||||||
|
|
Loading…
Reference in a new issue