feat: #8521, allow editing title before posting from queue

This commit is contained in:
Barış Soner Uşaklı
2020-07-20 21:28:17 -04:00
parent 8ddc8dd10f
commit 2485a55092
5 changed files with 45 additions and 14 deletions

View File

@@ -147,7 +147,7 @@ module.exports = function (Posts) {
socketHelpers.notifyNew(data.uid, 'newPost', result);
}
Posts.editQueuedContent = async function (uid, id, content) {
Posts.editQueuedContent = async function (uid, id, content, title) {
const canEditQueue = await Posts.canEditQueue(uid, id);
if (!canEditQueue) {
throw new Error('[[error:no-privileges]]');
@@ -156,7 +156,12 @@ module.exports = function (Posts) {
if (!data) {
return;
}
data.data.content = content;
if (content !== undefined) {
data.data.content = content;
}
if (title !== undefined) {
data.data.title = title;
}
await db.setObjectField('post:queue:' + id, 'data', JSON.stringify(data.data));
};