From bbb9a4601963d0283802ed0e9e268a2dc63f63da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 31 Jul 2025 09:02:49 -0400 Subject: [PATCH] feat: add filter:post.getDiffs --- src/api/posts.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/posts.js b/src/api/posts.js index b39c173eb6..f41b6a66ea 100644 --- a/src/api/posts.js +++ b/src/api/posts.js @@ -508,8 +508,9 @@ postsAPI.getDiffs = async (caller, data) => { // timestamps returned by posts.diffs.list are strings timestamps.push(String(post.timestamp)); - - return { + const result = await plugins.hooks.fire('filter:post.getDiffs', { + uid: caller.uid, + pid: data.pid, timestamps: timestamps, revisions: timestamps.map((timestamp, idx) => ({ timestamp: timestamp, @@ -519,7 +520,8 @@ postsAPI.getDiffs = async (caller, data) => { deletable: isAdmin || isModerator, // These and post owners can restore to a different post version editable: isAdmin || isModerator || parseInt(caller.uid, 10) === parseInt(post.uid, 10), - }; + }); + return result; }; postsAPI.loadDiff = async (caller, data) => {