From 2cf80a8ccf77c8c905fbbca60d975c17862ad470 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Tue, 2 Jan 2024 23:42:46 +0100 Subject: [PATCH] remove pinned users Changelog: Removed --- locales/ar-SA.yml | 3 -- locales/bn-BD.yml | 3 -- locales/cs-CZ.yml | 1 - locales/de-DE.yml | 3 -- locales/en-US.yml | 3 -- locales/es-ES.yml | 3 -- locales/fr-FR.yml | 3 -- locales/id-ID.yml | 3 -- locales/it-IT.yml | 3 -- locales/ja-JP.yml | 2 - locales/ko-KR.yml | 2 - locales/pl-PL.yml | 3 -- locales/ro-RO.yml | 3 -- locales/ru-RU.yml | 3 -- locales/sk-SK.yml | 3 -- locales/uk-UA.yml | 3 -- locales/vi-VN.yml | 3 -- locales/zh-CN.yml | 2 - locales/zh-TW.yml | 2 - .../1704234742539-removePinnedUsers.js | 10 +++++ packages/backend/src/models/entities/meta.ts | 5 --- packages/backend/src/server/api/endpoints.ts | 2 - .../src/server/api/endpoints/admin/meta.ts | 9 ----- .../server/api/endpoints/admin/update-meta.ts | 7 ---- .../src/server/api/endpoints/pinned-users.ts | 40 ------------------- packages/client/src/pages/admin/settings.vue | 8 ---- packages/foundkey-js/src/api.types.ts | 1 - 27 files changed, 10 insertions(+), 123 deletions(-) create mode 100644 packages/backend/migration/1704234742539-removePinnedUsers.js delete mode 100644 packages/backend/src/server/api/endpoints/pinned-users.ts diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml index d6114a3a3..914123659 100644 --- a/locales/ar-SA.yml +++ b/locales/ar-SA.yml @@ -299,9 +299,6 @@ inMb: "بالميغابايت" iconUrl: "رابط الأيقونة" bannerUrl: "رابط صورة اللافتة" backgroundImageUrl: "رابط صورة الخلفية" -pinnedUsers: "المستخدمون المدبسون" -pinnedUsersDescription: "قائمة المستخدمين المدبسين في لسان \"استكشف\" ، اجعل كل اسم\ - \ مستخدم في سطر لوحده." hcaptchaSiteKey: "مفتاح الموقع" hcaptchaSecretKey: "المفتاح السري" recaptchaSiteKey: "مفتاح الموقع" diff --git a/locales/bn-BD.yml b/locales/bn-BD.yml index 9d330da38..8abe8f9c6 100644 --- a/locales/bn-BD.yml +++ b/locales/bn-BD.yml @@ -314,9 +314,6 @@ inMb: "মেগাবাইটে লিখুন" iconUrl: "আইকনের URL (ফ্যাভিকন, ইত্যাদি)" bannerUrl: "ব্যানার ছবির URL" backgroundImageUrl: "পটভূমির চিত্রের URL" -pinnedUsers: "পিন করা ব্যাবহারকারীগণ" -pinnedUsersDescription: "আপনি যেসব ব্যবহারকারীদের \"ঘুরে দেখুন\" পৃষ্ঠায় পিন করতে\ - \ চান তাদের বর্ণনা করুন, প্রত্যেকের বর্ণনা আলাদা লাইনে লিখুন" hcaptchaSiteKey: "সাইট কী" hcaptchaSecretKey: "সিক্রেট কী" recaptchaSiteKey: "সাইট কী" diff --git a/locales/cs-CZ.yml b/locales/cs-CZ.yml index 03eb5e82d..5c9ec25a2 100644 --- a/locales/cs-CZ.yml +++ b/locales/cs-CZ.yml @@ -280,7 +280,6 @@ inMb: "V megabajtech" iconUrl: "Favicon URL" bannerUrl: "Baner URL" backgroundImageUrl: "Adresa URL obrázku pozadí" -pinnedUsers: "Připnutí uživatelé" hcaptchaSecretKey: "Tajný Klíč (Secret Key)" recaptchaSecretKey: "Tajný Klíč (Secret Key)" antennas: "Antény" diff --git a/locales/de-DE.yml b/locales/de-DE.yml index d3037abc3..6f0ba5f22 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -327,9 +327,6 @@ inMb: "In Megabytes" iconUrl: "Icon-URL (favicon etc)" bannerUrl: "Banner-URL" backgroundImageUrl: "Hintergrundbild-URL" -pinnedUsers: "Angeheftete Benutzer" -pinnedUsersDescription: "Gib durch Leerzeichen getrennte Benutzer an, die an die \"\ - Erkunden\"-Seite angeheftet werden sollen." hcaptchaSiteKey: "Site key" hcaptchaSecretKey: "Geheimer Schlüssel" recaptchaSiteKey: "Site-Schlüssel" diff --git a/locales/en-US.yml b/locales/en-US.yml index cde51a664..758efd6dd 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -323,9 +323,6 @@ inMb: "In megabytes" iconUrl: "Icon URL" bannerUrl: "Banner image URL" backgroundImageUrl: "Background image URL" -pinnedUsers: "Pinned users" -pinnedUsersDescription: "List usernames separated by line breaks to be pinned in the\ - \ \"Explore\" tab." hcaptchaSiteKey: "Site key" hcaptchaSecretKey: "Secret key" recaptchaSiteKey: "Site key" diff --git a/locales/es-ES.yml b/locales/es-ES.yml index a2eb5099b..6c827e8a2 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -318,9 +318,6 @@ inMb: "En megabytes" iconUrl: "URL de la imagen del avatar" bannerUrl: "URL de la imagen del banner" backgroundImageUrl: "URL de la imagen de fondo" -pinnedUsers: "Usuarios fijados" -pinnedUsersDescription: "Describir los usuarios que quiere fijar en la página \"Descubrir\"\ - \ separados por una linea nueva" hcaptchaSiteKey: "Clave del sitio" hcaptchaSecretKey: "Clave secreta" recaptchaSiteKey: "Clave del sitio" diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index d7e3657c9..35c7f0cce 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -319,9 +319,6 @@ inMb: "en mégaoctets" iconUrl: "URL de l'icône" bannerUrl: "URL de l’image de la bannière" backgroundImageUrl: "URL de l'image d'arrière-plan" -pinnedUsers: "Utilisateur·rice épinglé·e" -pinnedUsersDescription: "Listez les utilisateur·rice·s que vous souhaitez voir épinglé·e·s\ - \ sur la page \"Découvrir\", un·e par ligne." hcaptchaSiteKey: "Clé du site" hcaptchaSecretKey: "Clé secrète" recaptchaSiteKey: "Clé du site" diff --git a/locales/id-ID.yml b/locales/id-ID.yml index 5f75b008e..6479ade21 100644 --- a/locales/id-ID.yml +++ b/locales/id-ID.yml @@ -316,9 +316,6 @@ inMb: "dalam Megabytes" iconUrl: "URL Gambar ikon" bannerUrl: "URL Banner" backgroundImageUrl: "URL Gambar latar" -pinnedUsers: "Pengguna yang disematkan" -pinnedUsersDescription: "Tuliskan satu nama pengguna dalam satu baris. Pengguna yang\ - \ dituliskan disini akan disematkan dalam bilah \"Jelajahi\"." hcaptchaSiteKey: "Site Key" hcaptchaSecretKey: "Secret Key" recaptchaSiteKey: "Site key" diff --git a/locales/it-IT.yml b/locales/it-IT.yml index ba541c28c..0316bf6e7 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -310,9 +310,6 @@ inMb: "in Megabytes" iconUrl: "URL di icona (favicon, ecc.)" bannerUrl: "URL dell'immagine d'intestazione" backgroundImageUrl: "URL dello sfondo" -pinnedUsers: "Utenti in evidenza" -pinnedUsersDescription: "Elenca gli/le utenti che vuoi fissare in cima alla pagina\ - \ \"Esplora\", un@ per riga." hcaptchaSiteKey: "Chiave del sito" hcaptchaSecretKey: "Chiave segreta" recaptchaSiteKey: "Chiave del sito" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 33997ed6f..0df62de7f 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -291,8 +291,6 @@ inMb: "メガバイト単位" iconUrl: "アイコン画像のURL (faviconなど)" bannerUrl: "バナー画像のURL" backgroundImageUrl: "背景画像のURL" -pinnedUsers: "ピン留めユーザー" -pinnedUsersDescription: "「みつける」ページなどにピン留めしたいユーザーを改行で区切って記述します。" hcaptchaSiteKey: "サイトキー" hcaptchaSecretKey: "シークレットキー" recaptchaSiteKey: "サイトキー" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index e5dee866a..fdaed1c35 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -297,8 +297,6 @@ inMb: "메가바이트 단위" iconUrl: "아이콘 URL" bannerUrl: "배너 이미지 URL" backgroundImageUrl: "배경 이미지 URL" -pinnedUsers: "고정된 유저" -pinnedUsersDescription: "\"발견하기\" 페이지 등에 고정하고 싶은 유저를 한 줄에 한 명씩 적습니다." hcaptchaSiteKey: "사이트 키" hcaptchaSecretKey: "시크릿 키" recaptchaSiteKey: "사이트 키" diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml index 955d9b581..d0a16ce7b 100644 --- a/locales/pl-PL.yml +++ b/locales/pl-PL.yml @@ -306,9 +306,6 @@ inMb: "W megabajtach" iconUrl: "Adres URL ikony" bannerUrl: "Adres URL banera" backgroundImageUrl: "Adres URL tła" -pinnedUsers: "Przypięty użytkownik" -pinnedUsersDescription: "Wypisz po jednej nazwie użytkownika w wierszu. Podani użytkownicy\ - \ zostaną przypięci pod kartą „Eksploruj”." hcaptchaSiteKey: "Klucz strony" hcaptchaSecretKey: "Tajny klucz" recaptchaSiteKey: "Klucz strony" diff --git a/locales/ro-RO.yml b/locales/ro-RO.yml index 63539f4ec..490c2b294 100644 --- a/locales/ro-RO.yml +++ b/locales/ro-RO.yml @@ -317,9 +317,6 @@ inMb: "În megabytes" iconUrl: "URL-ul iconiței" bannerUrl: "URL-ul imaginii de banner" backgroundImageUrl: "URL-ul imaginii de fundal" -pinnedUsers: "Utilizatori fixați" -pinnedUsersDescription: "Scrie utilizatorii, separați prin pauză de rând, care vor\ - \ fi fixați pe pagina \"Explorează\"." hcaptchaSiteKey: "Site key" hcaptchaSecretKey: "Secret key" recaptchaSiteKey: "Site key" diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index 159a5d9f4..4ecd3d4ec 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -311,9 +311,6 @@ inMb: "В мегабайтах" iconUrl: "Ссылка на аватар" bannerUrl: "Ссылка на изображение в шапке" backgroundImageUrl: "Ссылка на фоновое изображение" -pinnedUsers: "Прикреплённый пользователь" -pinnedUsersDescription: "Перечислите по одному имени пользователя в строке. Пользователи,\ - \ перечисленные здесь, будут привязаны к закладке \"Изучение\"." hcaptchaSiteKey: "Ключ сайта" hcaptchaSecretKey: "Секретный ключ" recaptchaSiteKey: "Ключ сайта" diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml index 36e25ddd6..59ec6b30e 100644 --- a/locales/sk-SK.yml +++ b/locales/sk-SK.yml @@ -311,9 +311,6 @@ inMb: "V megabajtoch" iconUrl: "Favicon URL" bannerUrl: "URL obrázku bannera" backgroundImageUrl: "URL obrázku pozadia" -pinnedUsers: "Pripnutí používatelia" -pinnedUsersDescription: "Zoznam mien používateľov oddelených riadkami, ktorý budú\ - \ pripnutí v záložke \"Objavovať\"." hcaptchaSiteKey: "Site key" hcaptchaSecretKey: "Secret key" recaptchaSiteKey: "Site key" diff --git a/locales/uk-UA.yml b/locales/uk-UA.yml index 1e618b9be..7f94f004f 100644 --- a/locales/uk-UA.yml +++ b/locales/uk-UA.yml @@ -313,9 +313,6 @@ inMb: "В мегабайтах" iconUrl: "URL аватара" bannerUrl: "URL банера" backgroundImageUrl: "URL-адреса фонового зображення" -pinnedUsers: "Закріплені користувачі" -pinnedUsersDescription: "Впишіть в список користувачів, яких хочете закріпити на сторінці\ - \ \"Знайти\", ім'я в стовпчик." hcaptchaSiteKey: "Ключ сайту" hcaptchaSecretKey: "Секретний ключ" recaptchaSiteKey: "Ключ сайту" diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml index 7536b81b5..ff52fa322 100644 --- a/locales/vi-VN.yml +++ b/locales/vi-VN.yml @@ -311,9 +311,6 @@ inMb: "Tính bằng MB" iconUrl: "URL Icon" bannerUrl: "URL Ảnh bìa" backgroundImageUrl: "URL Ảnh nền" -pinnedUsers: "Những người thú vị" -pinnedUsersDescription: "Liệt kê mỗi hàng một tên người dùng xuống dòng để ghim trên\ - \ tab \"Khám phá\"." hcaptchaSiteKey: "Khóa của trang" hcaptchaSecretKey: "Khóa bí mật" recaptchaSiteKey: "Khóa của trang" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 4f18310fd..fc8678b0b 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -289,8 +289,6 @@ inMb: "以兆字节(MegaByte)为单位" iconUrl: "图标URL" bannerUrl: "横幅URL" backgroundImageUrl: "背景图URL" -pinnedUsers: "置顶用户" -pinnedUsersDescription: "在「发现」页面中使用换行标记想要置顶的用户。" hcaptchaSiteKey: "网站密钥" hcaptchaSecretKey: "密钥" recaptchaSiteKey: "网站密钥" diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index 8df98bc1a..a9edc0f8b 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -289,8 +289,6 @@ inMb: "以Mbps為單位" iconUrl: "圖像URL" bannerUrl: "橫幅圖像URL" backgroundImageUrl: "背景圖片的來源網址" -pinnedUsers: "置頂用戶" -pinnedUsersDescription: "在「發現」頁面中使用換行標記想要置頂的使用者。" hcaptchaSiteKey: "網站金鑰" hcaptchaSecretKey: "金鑰" recaptchaSiteKey: "網站金鑰" diff --git a/packages/backend/migration/1704234742539-removePinnedUsers.js b/packages/backend/migration/1704234742539-removePinnedUsers.js new file mode 100644 index 000000000..e6a3526ea --- /dev/null +++ b/packages/backend/migration/1704234742539-removePinnedUsers.js @@ -0,0 +1,10 @@ + + +export class removePinnedUsers1704234742539 { + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedUsers"`); + } + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedUsers" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`); + } +} diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index 28ba51195..f00d0473e 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -67,11 +67,6 @@ export class Meta { }) public langs: string[]; - @Column('varchar', { - length: 256, array: true, default: '{}', - }) - public pinnedUsers: string[]; - @Column('varchar', { length: 256, array: true, default: '{}', }) diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index bae486fa7..2b07458c2 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -252,7 +252,6 @@ import * as ep___pages_show from './endpoints/pages/show.js'; 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___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'; @@ -548,7 +547,6 @@ const eps = [ ['pages/unlike', ep___pages_unlike], ['pages/update', ep___pages_update], ['ping', ep___ping], - ['pinned-users', ep___pinnedUsers], ['request-reset-password', ep___requestResetPassword], ['reset-db', ep___resetDb], ['reset-password', ep___resetPassword], diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 79f598014..fcf90a129 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -114,14 +114,6 @@ export const meta = { type: 'boolean', optional: true, nullable: false, }, - pinnedUsers: { - type: 'array', - optional: true, nullable: false, - items: { - type: 'string', - optional: false, nullable: false, - }, - }, hiddenTags: { type: 'array', optional: true, nullable: false, @@ -291,7 +283,6 @@ export default define(meta, paramDef, async () => { cacheRemoteFiles: instance.cacheRemoteFiles, useStarForReactionFallback: instance.useStarForReactionFallback, - pinnedUsers: instance.pinnedUsers, hiddenTags: instance.hiddenTags, blockedHosts: instance.blockedHosts, hcaptchaSecretKey: instance.hcaptchaSecretKey, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 984aa2a9d..f4a2172ec 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -17,9 +17,6 @@ export const paramDef = { disableLocalTimeline: { type: 'boolean', nullable: true }, disableGlobalTimeline: { type: 'boolean', nullable: true }, useStarForReactionFallback: { type: 'boolean', nullable: true }, - pinnedUsers: { type: 'array', nullable: true, items: { - type: 'string', - } }, hiddenTags: { type: 'array', nullable: true, items: { type: 'string', } }, @@ -101,10 +98,6 @@ export default define(meta, paramDef, async (ps, me) => { set.useStarForReactionFallback = ps.useStarForReactionFallback; } - if (Array.isArray(ps.pinnedUsers)) { - set.pinnedUsers = ps.pinnedUsers.filter(Boolean); - } - if (Array.isArray(ps.hiddenTags)) { set.hiddenTags = ps.hiddenTags.filter(Boolean); } diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts deleted file mode 100644 index 402e75c59..000000000 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { IsNull } from 'typeorm'; -import { Users } from '@/models/index.js'; -import { fetchMeta } from '@/misc/fetch-meta.js'; -import * as Acct from '@/misc/acct.js'; -import { User } from '@/models/entities/user.js'; -import define from '@/server/api/define.js'; - -export const meta = { - tags: ['users'], - - requireCredential: false, - - res: { - type: 'array', - optional: false, nullable: false, - items: { - type: 'object', - optional: false, nullable: false, - ref: 'UserDetailed', - }, - }, -} as const; - -export const paramDef = { - type: 'object', - properties: {}, - required: [], -} as const; - -// eslint-disable-next-line import/no-default-export -export default define(meta, paramDef, async (ps, me) => { - const meta = await fetchMeta(); - - const users = await Promise.all(meta.pinnedUsers.map(acct => Acct.parse(acct)).map(acct => Users.findOneBy({ - usernameLower: acct.username.toLowerCase(), - host: acct.host ?? IsNull(), - }))); - - return await Users.packMany(users.filter(x => x !== undefined) as User[], me, { detail: true }); -}); diff --git a/packages/client/src/pages/admin/settings.vue b/packages/client/src/pages/admin/settings.vue index 71eb15a2e..181b75da7 100644 --- a/packages/client/src/pages/admin/settings.vue +++ b/packages/client/src/pages/admin/settings.vue @@ -29,11 +29,6 @@ - - - - - @@ -140,7 +135,6 @@ let defaultLightTheme: any = $ref(null); let defaultDarkTheme: any = $ref(null); let enableLocalTimeline: boolean = $ref(false); let enableGlobalTimeline: boolean = $ref(false); -let pinnedUsers: string = $ref(''); let cacheRemoteFiles: boolean = $ref(false); let localDriveCapacityMb: any = $ref(0); let remoteDriveCapacityMb: any = $ref(0); @@ -162,7 +156,6 @@ async function init(): Promise { maintainerEmail = meta.maintainerEmail; enableLocalTimeline = !meta.disableLocalTimeline; enableGlobalTimeline = !meta.disableGlobalTimeline; - pinnedUsers = meta.pinnedUsers.join('\n'); cacheRemoteFiles = meta.cacheRemoteFiles; localDriveCapacityMb = meta.driveCapacityPerLocalUserMb; remoteDriveCapacityMb = meta.driveCapacityPerRemoteUserMb; @@ -185,7 +178,6 @@ function save(): void { maintainerEmail, disableLocalTimeline: !enableLocalTimeline, disableGlobalTimeline: !enableGlobalTimeline, - pinnedUsers: pinnedUsers.split('\n'), cacheRemoteFiles, localDriveCapacityMb: parseInt(localDriveCapacityMb, 10), remoteDriveCapacityMb: parseInt(remoteDriveCapacityMb, 10), diff --git a/packages/foundkey-js/src/api.types.ts b/packages/foundkey-js/src/api.types.ts index 73dcf32da..58c0dd060 100644 --- a/packages/foundkey-js/src/api.types.ts +++ b/packages/foundkey-js/src/api.types.ts @@ -446,7 +446,6 @@ export type Endpoints = { 'pages/unlike': { req: { pageId: Page['id']; }; res: null; }; 'pages/update': { req: TODO; res: null; }; 'ping': { req: NoParams; res: { pong: number; }; }; - 'pinned-users': { req: TODO; res: TODO; }; 'request-reset-password': { req: { username: string; email: string; }; res: null; }; 'reset-db': { req: TODO; res: TODO; }; 'reset-password': { req: { token: string; password: string; }; res: null; };