mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: add filter:post.getDiffs
This commit is contained in:
@@ -508,8 +508,9 @@ postsAPI.getDiffs = async (caller, data) => {
|
|||||||
|
|
||||||
// timestamps returned by posts.diffs.list are strings
|
// timestamps returned by posts.diffs.list are strings
|
||||||
timestamps.push(String(post.timestamp));
|
timestamps.push(String(post.timestamp));
|
||||||
|
const result = await plugins.hooks.fire('filter:post.getDiffs', {
|
||||||
return {
|
uid: caller.uid,
|
||||||
|
pid: data.pid,
|
||||||
timestamps: timestamps,
|
timestamps: timestamps,
|
||||||
revisions: timestamps.map((timestamp, idx) => ({
|
revisions: timestamps.map((timestamp, idx) => ({
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
@@ -519,7 +520,8 @@ postsAPI.getDiffs = async (caller, data) => {
|
|||||||
deletable: isAdmin || isModerator,
|
deletable: isAdmin || isModerator,
|
||||||
// These and post owners can restore to a different post version
|
// These and post owners can restore to a different post version
|
||||||
editable: isAdmin || isModerator || parseInt(caller.uid, 10) === parseInt(post.uid, 10),
|
editable: isAdmin || isModerator || parseInt(caller.uid, 10) === parseInt(post.uid, 10),
|
||||||
};
|
});
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
postsAPI.loadDiff = async (caller, data) => {
|
postsAPI.loadDiff = async (caller, data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user