mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 13:26:02 +02:00
Merge branch 'develop' of https://github.com/NodeBB/NodeBB into develop
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Mövzulara daxil olun",
|
||||
"create-topics": "Mövzular yarat",
|
||||
"reply-to-topics": "Mövzulara cavab ver",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Mövzuları təqvim et",
|
||||
"tag-topics": "Mövzuları teqlə",
|
||||
"edit-posts": "Yazıları redaktə et",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Достъп до теми",
|
||||
"create-topics": "Създаване на теми",
|
||||
"reply-to-topics": "Отговаряне в теми",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Насрочване на теми",
|
||||
"tag-topics": "Поставяне на етикети на теми",
|
||||
"edit-posts": "Редактиране на публикации",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Přístup k tématům",
|
||||
"create-topics": "Vytvořit téma",
|
||||
"reply-to-topics": "Odpovědět na téma",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Označit téma",
|
||||
"edit-posts": "Upravit příspěvek",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Etikettér Tråde",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Themenzutritt",
|
||||
"create-topics": "Themen erstellen",
|
||||
"reply-to-topics": "Auf Themen antworten",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Geplante Themen",
|
||||
"tag-topics": "Themen taggen",
|
||||
"edit-posts": "Beiträge editieren",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Acceder Temas",
|
||||
"create-topics": "Crear Temas",
|
||||
"reply-to-topics": "Responder a Temas",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Poner Tags (etiquetas) a Temas",
|
||||
"edit-posts": "Editar Entradas",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "پاسخ به موضوعها",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Luo aiheita",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Ajoita aiheita",
|
||||
"tag-topics": "Merkitse aiheita",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Droits des sujets",
|
||||
"create-topics": "Créer des sujets",
|
||||
"reply-to-topics": "Répondre aux sujets",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Planifier des sujets",
|
||||
"tag-topics": "Tag des sujets",
|
||||
"edit-posts": "Modifier les messages",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "גישה לנושאים",
|
||||
"create-topics": "יצירת נושאים",
|
||||
"reply-to-topics": "תגובה לנושאים",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "תזמון נושאים",
|
||||
"tag-topics": "תיוג נושאים",
|
||||
"edit-posts": "עריכת פוסטים",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Hozzáférés témakörhöz",
|
||||
"create-topics": "Témakör létrehozása",
|
||||
"reply-to-topics": "Hozzászólás a témakörhöz",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Témakörök időzítése",
|
||||
"tag-topics": "Téma címke hozzáadása",
|
||||
"edit-posts": "Bejegyzés szerkesztése",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Մուտք գործել թեմաներ",
|
||||
"create-topics": "Ստեղծել Թեմաներ",
|
||||
"reply-to-topics": "Պատասխանել թեմաներին",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Ժամանակացույցի թեմաներ",
|
||||
"tag-topics": "Նշեք թեմաները",
|
||||
"edit-posts": "Խմբագրել գրառումները",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Accesso discussioni",
|
||||
"create-topics": "Crea discussioni",
|
||||
"reply-to-topics": "Risposta alle discussioni",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Pianificazione discussioni",
|
||||
"tag-topics": "Tag discussioni",
|
||||
"edit-posts": "Modifica i post",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "トピックスにアクセス",
|
||||
"create-topics": "トピックスを作成",
|
||||
"reply-to-topics": "トピックスに返信",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "토픽 접근",
|
||||
"create-topics": "토픽 생성",
|
||||
"reply-to-topics": "토픽에 답장하기",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "토픽 예약",
|
||||
"tag-topics": "토픽 태깅",
|
||||
"edit-posts": "게시물 편집",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Piekļūt tematiem",
|
||||
"create-topics": "Izveidot tematus",
|
||||
"reply-to-topics": "Atbildēt tematos",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Pievienot birkas",
|
||||
"edit-posts": "Rediģēt rakstus",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Tilgang til emner",
|
||||
"create-topics": "Opprett emner",
|
||||
"reply-to-topics": "Svar på emner",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Planlegg emner",
|
||||
"tag-topics": "Legg til emneord",
|
||||
"edit-posts": "Rediger innlegg",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Tilgang til emne",
|
||||
"create-topics": "Opprett emne",
|
||||
"reply-to-topics": "Svar på emne",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Planlegg emne",
|
||||
"tag-topics": "Legg til emneord",
|
||||
"edit-posts": "Rediger innlegg",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Dostęp do tematów",
|
||||
"create-topics": "Tworzenie tematów",
|
||||
"reply-to-topics": "Odpowiadanie na tematy",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Zaplanuj tematy",
|
||||
"tag-topics": "Tagowanie tematów",
|
||||
"edit-posts": "Edycja postów",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Acessar Tópicos",
|
||||
"create-topics": "Criar Tópicos",
|
||||
"reply-to-topics": "Responder aos Tópicos",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Agendar Tópicos",
|
||||
"tag-topics": "Definir tag em tópicos",
|
||||
"edit-posts": "Editar Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Aceder aos Tópicos",
|
||||
"create-topics": "Criar Tópicos",
|
||||
"reply-to-topics": "Responder a Tópicos",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Marcar Tópicos",
|
||||
"edit-posts": "Editar Publicações",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Читать темы",
|
||||
"create-topics": "Создавать темы",
|
||||
"reply-to-topics": "Отвечать в темах",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Присваивать метки",
|
||||
"edit-posts": "Редактировать сообщения",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Prístup k témam",
|
||||
"create-topics": "Vytvoriť témy",
|
||||
"reply-to-topics": "Odpovedať na témy",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Značka tém",
|
||||
"edit-posts": "Upraviť príspevky",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Ustvari teme",
|
||||
"reply-to-topics": "Odgovori na teme",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Označi teme",
|
||||
"edit-posts": "Uredi objave",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Access Topics",
|
||||
"create-topics": "Create Topics",
|
||||
"reply-to-topics": "Reply to Topics",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Tag Topics",
|
||||
"edit-posts": "Edit Posts",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Başlıklara Eriş",
|
||||
"create-topics": "Başlık Oluştur",
|
||||
"reply-to-topics": "Başlığı Cevapla",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Konuları Planla",
|
||||
"tag-topics": "Başlığı etiketle",
|
||||
"edit-posts": "İletiyi düzenle",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Доступ до Тем",
|
||||
"create-topics": "Створювати Теми",
|
||||
"reply-to-topics": "Відповідати на Теми",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Schedule Topics",
|
||||
"tag-topics": "Тегувати Теми",
|
||||
"edit-posts": "Редагувати Пости",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "موضوعات تک رسائی",
|
||||
"create-topics": "موضوعات بنائیں",
|
||||
"reply-to-topics": "موضوعات میں جواب دیں",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "موضوعات شیڈول کریں",
|
||||
"tag-topics": "موضوعات پر ٹیگز لگائیں",
|
||||
"edit-posts": "پوسٹس ترمیم کریں",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "Truy Cập Chủ Đề",
|
||||
"create-topics": "Tạo Chủ Đề",
|
||||
"reply-to-topics": "Trả Lời Chủ Đề",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "Lên Lịch Chủ Đề",
|
||||
"tag-topics": "Gắn Thẻ Chủ Đề",
|
||||
"edit-posts": "Chỉnh Sửa Bài Đăng",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "访问主题",
|
||||
"create-topics": "创建主题",
|
||||
"reply-to-topics": "回复主题",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "定时主题",
|
||||
"tag-topics": "标签主题",
|
||||
"edit-posts": "修改回复",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"access-topics": "存取主題",
|
||||
"create-topics": "建立主題",
|
||||
"reply-to-topics": "回覆主題",
|
||||
"crosspost-topics": "Cross-post Topics",
|
||||
"schedule-topics": "預排的主題",
|
||||
"tag-topics": "新增標籤",
|
||||
"edit-posts": "修改回覆",
|
||||
|
||||
@@ -59,6 +59,7 @@ module.exports = function (Categories) {
|
||||
'groups:topics:read',
|
||||
'groups:topics:create',
|
||||
'groups:topics:reply',
|
||||
'groups:topics:crosspost',
|
||||
'groups:topics:tag',
|
||||
'groups:posts:edit',
|
||||
'groups:posts:history',
|
||||
|
||||
@@ -23,6 +23,7 @@ const _privilegeMap = new Map([
|
||||
['topics:read', { label: '[[admin/manage/privileges:access-topics]]', type: 'viewing' }],
|
||||
['topics:create', { label: '[[admin/manage/privileges:create-topics]]', type: 'posting' }],
|
||||
['topics:reply', { label: '[[admin/manage/privileges:reply-to-topics]]', type: 'posting' }],
|
||||
['topics:crosspost', { label: '[[admin/manage/privileges:crosspost-topics]]', type: 'posting' }],
|
||||
['topics:schedule', { label: '[[admin/manage/privileges:schedule-topics]]', type: 'posting' }],
|
||||
['topics:tag', { label: '[[admin/manage/privileges:tag-topics]]', type: 'posting' }],
|
||||
['posts:edit', { label: '[[admin/manage/privileges:edit-posts]]', type: 'posting' }],
|
||||
|
||||
@@ -6,6 +6,7 @@ const topics = require('.');
|
||||
const user = require('../user');
|
||||
const categories = require('../categories');
|
||||
const posts = require('../posts');
|
||||
const privileges = require('../privileges');
|
||||
const activitypub = require('../activitypub');
|
||||
const utils = require('../utils');
|
||||
|
||||
@@ -56,10 +57,16 @@ Crossposts.add = async function (tid, cid, uid) {
|
||||
if (!utils.isNumber(cid)) {
|
||||
await activitypub.actors.assert(cid);
|
||||
}
|
||||
const exists = await categories.exists(cid);
|
||||
const [exists, allowed] = await Promise.all([
|
||||
categories.exists(cid),
|
||||
uid === 0 || privileges.categories.can('topics:crosspost', cid, uid),
|
||||
]);
|
||||
if (!exists) {
|
||||
throw new Error('[[error:invalid-cid]]');
|
||||
}
|
||||
if (!allowed) {
|
||||
throw new Error('[[error:not-allowed]]');
|
||||
}
|
||||
if (uid < 0) {
|
||||
throw new Error('[[error:invalid-uid]]');
|
||||
}
|
||||
|
||||
18
src/upgrades/4.9.0/crosspost_privilege.js
Normal file
18
src/upgrades/4.9.0/crosspost_privilege.js
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const privileges = require('../../privileges');
|
||||
const db = require('../../database');
|
||||
|
||||
module.exports = {
|
||||
name: 'Give topic:crosspost privilege to registered-users on all categories',
|
||||
timestamp: Date.UTC(2026, 1, 12),
|
||||
method: async () => {
|
||||
const cids = await db.getSortedSetMembers('categories:cid');
|
||||
await Promise.all(cids.map(async (cid) => {
|
||||
const can = await privileges.categories.can('topics:create', cid, 'registered-users');
|
||||
if (can) {
|
||||
await privileges.categories.give(['groups:topics:crosspost'], cid, 'registered-users');
|
||||
}
|
||||
}));
|
||||
},
|
||||
};
|
||||
@@ -87,10 +87,19 @@ describe('Crossposting (& related logic)', () => {
|
||||
it('should not allow a spider (uid -1) to crosspost', async () => {
|
||||
await assert.rejects(
|
||||
topics.crossposts.add(tid, cid2, -1),
|
||||
{ message: '[[error:invalid-uid]]' }
|
||||
{ message: '[[error:not-allowed]]' }
|
||||
);
|
||||
});
|
||||
|
||||
it('should not allow a crosspost if privilege is missing', async () => {
|
||||
await privileges.categories.rescind(['groups:topics:crosspost'], cid2, 'registered-users');
|
||||
await assert.rejects(
|
||||
topics.crossposts.add(tid, cid2, uid),
|
||||
{ message: '[[error:not-allowed]]' }
|
||||
);
|
||||
await privileges.categories.give(['groups:topics:crosspost'], cid2, 'registered-users');
|
||||
});
|
||||
|
||||
it('should successfully crosspost to another cid', async () => {
|
||||
const crossposts = await topics.crossposts.add(tid, cid2, uid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user