forked from FoundKeyGang/FoundKey
commit
b137a39160
32 changed files with 26 additions and 286 deletions
|
@ -465,8 +465,6 @@ dayOverDayChanges: "يوميا"
|
|||
appearance: "المظهر"
|
||||
clientSettings: "إعدادات العميل"
|
||||
accountSettings: "إعدادات الحساب"
|
||||
promotion: "ترقية"
|
||||
promote: "روِّج"
|
||||
numberOfDays: "عدد الأيام"
|
||||
hideThisNote: "إخفاء هذه الملاحظة"
|
||||
showFeaturedNotesInTimeline: "أظهر الملاحظات الشائعة في الخيط الزمني"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "গতকাল"
|
|||
appearance: "অবয়ব"
|
||||
clientSettings: "ক্লায়েন্ট সেটিংস"
|
||||
accountSettings: "অ্যাকাউন্ট সেটিংস"
|
||||
promotion: "প্রমোশন"
|
||||
promote: "প্রচার করুন"
|
||||
numberOfDays: "দিনের সংখ্যা"
|
||||
hideThisNote: "নোটটি লুকান"
|
||||
showFeaturedNotesInTimeline: "টাইমলাইনে সুপারিশকৃত নোটগুলি দেখান"
|
||||
|
|
|
@ -406,8 +406,6 @@ dayOverDayChanges: "Denně"
|
|||
appearance: "Vzhled"
|
||||
clientSettings: "Nastavení klienta"
|
||||
accountSettings: "Nastavení účtu"
|
||||
promotion: "Propagace"
|
||||
promote: "Propagovat"
|
||||
numberOfDays: "Počet dní"
|
||||
deleteAll: "Smazat vše"
|
||||
showFixedPostForm: "Zobrazit formulář pro nové příspěvky nad časovou osou"
|
||||
|
|
|
@ -473,8 +473,6 @@ dayOverDayChanges: "Veränderung zu Gestern"
|
|||
appearance: "Aussehen"
|
||||
clientSettings: "Client-Einstellungen"
|
||||
accountSettings: "Benutzerkonto-Einstellungen"
|
||||
promotion: "Werbung"
|
||||
promote: "Werbung schalten"
|
||||
numberOfDays: "Anzahl der Tage"
|
||||
hideThisNote: "Diese Notiz verstecken"
|
||||
showFeaturedNotesInTimeline: "Beliebte Notizen in der Chronik anzeigen"
|
||||
|
|
|
@ -473,8 +473,6 @@ dayOverDayChanges: "Changes to yesterday"
|
|||
appearance: "Appearance"
|
||||
clientSettings: "Client Settings"
|
||||
accountSettings: "Account Settings"
|
||||
promotion: "Promoted"
|
||||
promote: "Promote"
|
||||
numberOfDays: "Number of days"
|
||||
hideThisNote: "Hide this note"
|
||||
showFeaturedNotesInTimeline: "Show featured notes in timelines"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "Dif diaria"
|
|||
appearance: "Apariencia"
|
||||
clientSettings: "Configuración del cliente"
|
||||
accountSettings: "Ajustes de cuenta"
|
||||
promotion: "Promovido"
|
||||
promote: "Promover"
|
||||
numberOfDays: "Cantidad de dias"
|
||||
hideThisNote: "Ocultar esta nota"
|
||||
showFeaturedNotesInTimeline: "Mostrar notas destacadas en la línea de tiempo"
|
||||
|
|
|
@ -469,8 +469,6 @@ dayOverDayChanges: "Journalier"
|
|||
appearance: "Apparence"
|
||||
clientSettings: "Paramètres du client"
|
||||
accountSettings: "Paramètres du compte"
|
||||
promotion: "Promu"
|
||||
promote: "Promouvoir"
|
||||
numberOfDays: "Nombre de jours"
|
||||
hideThisNote: "Masquer cette note"
|
||||
showFeaturedNotesInTimeline: "Afficher les notes des Tendances dans le fil d'actualité"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "Harian"
|
|||
appearance: "Tampilan"
|
||||
clientSettings: "Pengaturan Klien"
|
||||
accountSettings: "Pengaturan Akun"
|
||||
promotion: "Promosi"
|
||||
promote: "Promosikan"
|
||||
numberOfDays: "Jumlah hari"
|
||||
hideThisNote: "Sembunyikan catatan ini"
|
||||
showFeaturedNotesInTimeline: "Tampilkan catatan yang diunggulkan di linimasa"
|
||||
|
|
|
@ -468,8 +468,6 @@ dayOverDayChanges: "Giornaliero"
|
|||
appearance: "Aspetto"
|
||||
clientSettings: "Impostazioni client"
|
||||
accountSettings: "Impostazioni account"
|
||||
promotion: "Promossa"
|
||||
promote: "Pubblicizza"
|
||||
numberOfDays: "Numero di giorni"
|
||||
hideThisNote: "Nasconda la nota"
|
||||
showFeaturedNotesInTimeline: "Mostrare le note di tendenza nella tua timeline"
|
||||
|
|
|
@ -473,8 +473,6 @@ dayOverDayChanges: "前日比"
|
|||
appearance: "アピアランス"
|
||||
clientSettings: "クライアント設定"
|
||||
accountSettings: "アカウント設定"
|
||||
promotion: "プロモーション"
|
||||
promote: "プロモート"
|
||||
numberOfDays: "日数"
|
||||
hideThisNote: "このノートを非表示"
|
||||
showFeaturedNotesInTimeline: "タイムラインにおすすめのノートを表示する"
|
||||
|
|
|
@ -462,8 +462,6 @@ dayOverDayChanges: "前日比"
|
|||
appearance: "見た目"
|
||||
clientSettings: "クライアントの設定"
|
||||
accountSettings: "アカウントの設定"
|
||||
promotion: "宣伝"
|
||||
promote: "宣伝"
|
||||
numberOfDays: "日数"
|
||||
hideThisNote: "このノートは表示せんでいい"
|
||||
showFeaturedNotesInTimeline: "タイムラインにおすすめのノートを表示してや"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "어제보다"
|
|||
appearance: "모양"
|
||||
clientSettings: "클라이언트 설정"
|
||||
accountSettings: "계정 설정"
|
||||
promotion: "프로모션"
|
||||
promote: "프로모션하기"
|
||||
numberOfDays: "며칠동안"
|
||||
hideThisNote: "이 노트를 숨기기"
|
||||
showFeaturedNotesInTimeline: "타임라인에 추천 노트를 표시"
|
||||
|
|
|
@ -465,8 +465,6 @@ dayOverDayChanges: "Codziennie"
|
|||
appearance: "Wygląd"
|
||||
clientSettings: "Ustawienia klienta"
|
||||
accountSettings: "Ustawienia konta"
|
||||
promotion: "Promowane"
|
||||
promote: "Promuj"
|
||||
numberOfDays: "Liczba dni"
|
||||
hideThisNote: "Ukryj ten wpis"
|
||||
showFeaturedNotesInTimeline: "Pokazuj wyróżnione wpisy w osi czasu"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "Schimbări până ieri"
|
|||
appearance: "Aspect"
|
||||
clientSettings: "Setări client"
|
||||
accountSettings: "Setări cont"
|
||||
promotion: "Promovat"
|
||||
promote: "Promovează"
|
||||
numberOfDays: "Numărul zilelor"
|
||||
hideThisNote: "Ascunde această notă"
|
||||
showFeaturedNotesInTimeline: "Arată notele recomandate în cronologii"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "За день"
|
|||
appearance: "Внешний вид"
|
||||
clientSettings: "Настройки клиента"
|
||||
accountSettings: "Настройки учетной записи"
|
||||
promotion: "Продвинуто"
|
||||
promote: "Продвинуть"
|
||||
numberOfDays: "Количество дней"
|
||||
hideThisNote: "Спрятать эту запись"
|
||||
showFeaturedNotesInTimeline: "Показывать в ленте заметки из «Горячего»"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "Medzidenné zmeny"
|
|||
appearance: "Vzhľad"
|
||||
clientSettings: "Nastavenia klienta"
|
||||
accountSettings: "Nastavenia účtu"
|
||||
promotion: "Propagácia"
|
||||
promote: "Propagovať"
|
||||
numberOfDays: "Počet dní"
|
||||
hideThisNote: "Skryť túto poznámku"
|
||||
showFeaturedNotesInTimeline: "Zobraziť významné poznámky v časovej osi"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "Доба"
|
|||
appearance: "Вигляд"
|
||||
clientSettings: "Налаштування клієнта"
|
||||
accountSettings: "Налаштування акаунта"
|
||||
promotion: "Виділене"
|
||||
promote: "Виділити"
|
||||
numberOfDays: "Кількість днів"
|
||||
hideThisNote: "Сховати цю нотатку"
|
||||
showFeaturedNotesInTimeline: "Показувати популярні нотатки у стрічці"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "Thay đổi hôm qua"
|
|||
appearance: "Giao diện"
|
||||
clientSettings: "Cài đặt Client"
|
||||
accountSettings: "Cài đặt tài khoản"
|
||||
promotion: "Quảng cáo"
|
||||
promote: "Quảng cáo"
|
||||
numberOfDays: "Số ngày"
|
||||
hideThisNote: "Ẩn tút này"
|
||||
showFeaturedNotesInTimeline: "Hiện tút nổi bật trong bảng tin"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "与前一日相比"
|
|||
appearance: "外观"
|
||||
clientSettings: "客户端设置"
|
||||
accountSettings: "账户设置"
|
||||
promotion: "推广"
|
||||
promote: "推广"
|
||||
numberOfDays: "天数"
|
||||
hideThisNote: "隐藏这条帖子"
|
||||
showFeaturedNotesInTimeline: "在时间线上显示热门推荐"
|
||||
|
|
|
@ -472,8 +472,6 @@ dayOverDayChanges: "與前一日相比"
|
|||
appearance: "外觀"
|
||||
clientSettings: "用戶端設定"
|
||||
accountSettings: "帳戶設定"
|
||||
promotion: "推廣"
|
||||
promote: "推廣"
|
||||
numberOfDays: "有效天數"
|
||||
hideThisNote: "隱藏此貼文"
|
||||
showFeaturedNotesInTimeline: "在時間軸上顯示熱門推薦"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
export class removePromoEntities1660251834642 {
|
||||
name = 'removePromoEntities1660251834642';
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "promo_note" DROP CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2882b8a1a07c7d281a98b6db16"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9657d55550c3d37bfafaf7d4b0"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "promo_read"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_83f0862e9bae44af52ced7099e"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "promo_note"`, undefined);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`CREATE TABLE "promo_note" ("noteId" character varying(32) NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "REL_e263909ca4fe5d57f8d4230dd5" UNIQUE ("noteId"), CONSTRAINT "PK_e263909ca4fe5d57f8d4230dd5c" PRIMARY KEY ("noteId"))`, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_83f0862e9bae44af52ced7099e" ON "promo_note" ("userId") `, undefined);
|
||||
await queryRunner.query(`CREATE TABLE "promo_read" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_61917c1541002422b703318b7c9" PRIMARY KEY ("id"))`, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_9657d55550c3d37bfafaf7d4b0" ON "promo_read" ("userId") `, undefined);
|
||||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_2882b8a1a07c7d281a98b6db16" ON "promo_read" ("userId", "noteId") `, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "promo_note" ADD CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" ADD CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "promo_read" ADD CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, undefined);
|
||||
}
|
||||
}
|
|
@ -57,8 +57,6 @@ import { Clip } from '@/models/entities/clip.js';
|
|||
import { ClipNote } from '@/models/entities/clip-note.js';
|
||||
import { Antenna } from '@/models/entities/antenna.js';
|
||||
import { AntennaNote } from '@/models/entities/antenna-note.js';
|
||||
import { PromoNote } from '@/models/entities/promo-note.js';
|
||||
import { PromoRead } from '@/models/entities/promo-read.js';
|
||||
import { Relay } from '@/models/entities/relay.js';
|
||||
import { MutedNote } from '@/models/entities/muted-note.js';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
|
@ -159,8 +157,6 @@ export const entities = [
|
|||
ClipNote,
|
||||
Antenna,
|
||||
AntennaNote,
|
||||
PromoNote,
|
||||
PromoRead,
|
||||
Relay,
|
||||
MutedNote,
|
||||
Channel,
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
|
||||
import { id } from '../id.js';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
|
||||
@Entity()
|
||||
export class PromoNote {
|
||||
@PrimaryColumn(id())
|
||||
public noteId: Note['id'];
|
||||
|
||||
@OneToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
public expiresAt: Date;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: '[Denormalized]',
|
||||
})
|
||||
public userId: User['id'];
|
||||
//#endregion
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { id } from '../id.js';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
export class PromoRead {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the PromoRead.',
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column(id())
|
||||
public userId: User['id'];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column(id())
|
||||
public noteId: Note['id'];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
}
|
|
@ -49,8 +49,6 @@ import { ClipRepository } from './repositories/clip.js';
|
|||
import { ClipNote } from './entities/clip-note.js';
|
||||
import { AntennaRepository } from './repositories/antenna.js';
|
||||
import { AntennaNote } from './entities/antenna-note.js';
|
||||
import { PromoNote } from './entities/promo-note.js';
|
||||
import { PromoRead } from './entities/promo-read.js';
|
||||
import { EmojiRepository } from './repositories/emoji.js';
|
||||
import { RelayRepository } from './repositories/relay.js';
|
||||
import { ChannelRepository } from './repositories/channel.js';
|
||||
|
@ -115,8 +113,6 @@ export const Clips = (ClipRepository);
|
|||
export const ClipNotes = db.getRepository(ClipNote);
|
||||
export const Antennas = (AntennaRepository);
|
||||
export const AntennaNotes = db.getRepository(AntennaNote);
|
||||
export const PromoNotes = db.getRepository(PromoNote);
|
||||
export const PromoReads = db.getRepository(PromoRead);
|
||||
export const Relays = (RelayRepository);
|
||||
export const MutedNotes = db.getRepository(MutedNote);
|
||||
export const Channels = (ChannelRepository);
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import rndstr from 'rndstr';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { PromoReads, PromoNotes, Notes, Users } from '@/models/index.js';
|
||||
|
||||
export async function injectPromo(timeline: Note[], user?: User | null) {
|
||||
if (timeline.length < 5) return;
|
||||
|
||||
// TODO: readやexpireフィルタはクエリ側でやる
|
||||
|
||||
const reads = user ? await PromoReads.findBy({
|
||||
userId: user.id,
|
||||
}) : [];
|
||||
|
||||
let promos = await PromoNotes.find();
|
||||
|
||||
promos = promos.filter(n => n.expiresAt.getTime() > Date.now());
|
||||
promos = promos.filter(n => !reads.map(r => r.noteId).includes(n.noteId));
|
||||
|
||||
if (promos.length === 0) return;
|
||||
|
||||
// Pick random promo
|
||||
const promo = promos[Math.floor(Math.random() * promos.length)];
|
||||
|
||||
const note = await Notes.findOneByOrFail({ id: promo.noteId });
|
||||
|
||||
// Join
|
||||
note.user = await Users.findOneByOrFail({ id: note.userId });
|
||||
|
||||
(note as any)._prId_ = rndstr('a-z0-9', 8);
|
||||
|
||||
// Inject promo
|
||||
timeline.splice(3, 0, note);
|
||||
}
|
|
@ -33,7 +33,6 @@ import * as ep___admin_getTableStats from './endpoints/admin/get-table-stats.js'
|
|||
import * as ep___admin_invite from './endpoints/admin/invite.js';
|
||||
import * as ep___admin_moderators_add from './endpoints/admin/moderators/add.js';
|
||||
import * as ep___admin_moderators_remove from './endpoints/admin/moderators/remove.js';
|
||||
import * as ep___admin_promo_create from './endpoints/admin/promo/create.js';
|
||||
import * as ep___admin_queue_clear from './endpoints/admin/queue/clear.js';
|
||||
import * as ep___admin_queue_deliverDelayed from './endpoints/admin/queue/deliver-delayed.js';
|
||||
import * as ep___admin_queue_inboxDelayed from './endpoints/admin/queue/inbox-delayed.js';
|
||||
|
@ -261,7 +260,6 @@ import * as ep___pages_unlike from './endpoints/pages/unlike.js';
|
|||
import * as ep___pages_update from './endpoints/pages/update.js';
|
||||
import * as ep___ping from './endpoints/ping.js';
|
||||
import * as ep___pinnedUsers from './endpoints/pinned-users.js';
|
||||
import * as ep___promo_read from './endpoints/promo/read.js';
|
||||
import * as ep___requestResetPassword from './endpoints/request-reset-password.js';
|
||||
import * as ep___resetDb from './endpoints/reset-db.js';
|
||||
import * as ep___resetPassword from './endpoints/reset-password.js';
|
||||
|
@ -342,7 +340,6 @@ const eps = [
|
|||
['admin/invite', ep___admin_invite],
|
||||
['admin/moderators/add', ep___admin_moderators_add],
|
||||
['admin/moderators/remove', ep___admin_moderators_remove],
|
||||
['admin/promo/create', ep___admin_promo_create],
|
||||
['admin/queue/clear', ep___admin_queue_clear],
|
||||
['admin/queue/deliver-delayed', ep___admin_queue_deliverDelayed],
|
||||
['admin/queue/inbox-delayed', ep___admin_queue_inboxDelayed],
|
||||
|
@ -570,7 +567,6 @@ const eps = [
|
|||
['pages/update', ep___pages_update],
|
||||
['ping', ep___ping],
|
||||
['pinned-users', ep___pinnedUsers],
|
||||
['promo/read', ep___promo_read],
|
||||
['request-reset-password', ep___requestResetPassword],
|
||||
['reset-db', ep___resetDb],
|
||||
['reset-password', ep___resetPassword],
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
import { PromoNotes } from '@/models/index.js';
|
||||
import define from '../../../define.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { getNote } from '../../../common/getters.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
|
||||
requireCredential: true,
|
||||
requireModerator: true,
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'ee449fbe-af2a-453b-9cae-cf2fe7c895fc',
|
||||
},
|
||||
|
||||
alreadyPromoted: {
|
||||
message: 'The note has already promoted.',
|
||||
code: 'ALREADY_PROMOTED',
|
||||
id: 'ae427aa2-7a41-484f-a18c-2c1104051604',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
noteId: { type: 'string', format: 'misskey:id' },
|
||||
expiresAt: { type: 'integer' },
|
||||
},
|
||||
required: ['noteId', 'expiresAt'],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const note = await getNote(ps.noteId, user).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
});
|
||||
|
||||
const exist = await PromoNotes.findOneBy({ noteId: note.id });
|
||||
|
||||
if (exist != null) {
|
||||
throw new ApiError(meta.errors.alreadyPromoted);
|
||||
}
|
||||
|
||||
await PromoNotes.insert({
|
||||
noteId: note.id,
|
||||
expiresAt: new Date(ps.expiresAt),
|
||||
userId: note.userId,
|
||||
});
|
||||
});
|
|
@ -1,51 +0,0 @@
|
|||
import { PromoReads } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { getNote } from '../../common/getters.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'd785b897-fcd3-4fe9-8fc3-b85c26e6c932',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
noteId: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
required: ['noteId'],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const note = await getNote(ps.noteId, user).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
});
|
||||
|
||||
const exist = await PromoReads.findOneBy({
|
||||
noteId: note.id,
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (exist != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
await PromoReads.insert({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
noteId: note.id,
|
||||
userId: user.id,
|
||||
});
|
||||
});
|
|
@ -11,7 +11,6 @@
|
|||
>
|
||||
<MkNoteSub v-if="appearNote.reply" :note="appearNote.reply" class="reply-to"/>
|
||||
<div v-if="pinned" class="info"><i class="fas fa-thumbtack"></i> {{ i18n.ts.pinnedNote }}</div>
|
||||
<div v-if="appearNote._prId_" class="info"><i class="fas fa-bullhorn"></i> {{ i18n.ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ i18n.ts.hideThisNote }} <i class="fas fa-times"></i></button></div>
|
||||
<div v-if="appearNote._featuredId_" class="info"><i class="fas fa-bolt"></i> {{ i18n.ts.featured }}</div>
|
||||
<div v-if="isRenote" class="renote">
|
||||
<MkAvatar class="avatar" :user="note.user"/>
|
||||
|
@ -281,13 +280,6 @@ function focusBefore() {
|
|||
function focusAfter() {
|
||||
focusNext(el.value);
|
||||
}
|
||||
|
||||
function readPromo() {
|
||||
os.api('promo/read', {
|
||||
noteId: appearNote.id,
|
||||
});
|
||||
isDeleted.value = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<template #default="{ items: notes }">
|
||||
<div class="giivymft" :class="{ noGap }">
|
||||
<XList ref="notes" v-slot="{ item: note }" :items="notes" :direction="pagination.reversed ? 'up' : 'down'" :reversed="pagination.reversed" :no-gap="noGap" class="notes">
|
||||
<XNote :key="note._featuredId_ || note._prId_ || note.id" class="qtqtichx" :note="note"/>
|
||||
<XNote :key="note._featuredId_ || note.id" class="qtqtichx" :note="note"/>
|
||||
</XList>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -157,19 +157,6 @@ export function getNoteMenu(props: {
|
|||
props.isDeleted.value = true;
|
||||
}
|
||||
|
||||
async function promote(): Promise<void> {
|
||||
const { canceled, result: days } = await os.inputNumber({
|
||||
title: i18n.ts.numberOfDays,
|
||||
});
|
||||
|
||||
if (canceled) return;
|
||||
|
||||
os.apiWithDialog('admin/promo/create', {
|
||||
noteId: appearNote.id,
|
||||
expiresAt: Date.now() + (86400000 * days),
|
||||
});
|
||||
}
|
||||
|
||||
function share(): void {
|
||||
navigator.share({
|
||||
title: i18n.t('noteOf', { user: appearNote.user.name }),
|
||||
|
@ -271,16 +258,6 @@ export function getNoteMenu(props: {
|
|||
text: i18n.ts.pin,
|
||||
action: () => togglePin(true),
|
||||
} : undefined,
|
||||
/*
|
||||
...($i.isModerator || $i.isAdmin ? [
|
||||
null,
|
||||
{
|
||||
icon: 'fas fa-bullhorn',
|
||||
text: i18n.ts.promote,
|
||||
action: promote
|
||||
}]
|
||||
: []
|
||||
),*/
|
||||
...(appearNote.userId !== $i.id ? [
|
||||
null,
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue