|
|
|
@ -60,7 +60,7 @@ Events._types = {
|
|
|
|
|
},
|
|
|
|
|
fork: {
|
|
|
|
|
icon: 'fa-code-fork',
|
|
|
|
|
text: '[[topic:forked-by]]'
|
|
|
|
|
text: '[[topic:forked-by]]',
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -159,7 +159,7 @@ async function modifyEvent({ tid, uid, eventIds, timestamps, events }) {
|
|
|
|
|
Events.log = async (tid, payload) => {
|
|
|
|
|
const topics = require('.');
|
|
|
|
|
const { type } = payload;
|
|
|
|
|
const now = Date.now();
|
|
|
|
|
const timestamp = payload.timestamp || Date.now();
|
|
|
|
|
|
|
|
|
|
if (!Events._types.hasOwnProperty(type)) {
|
|
|
|
|
throw new Error(`[[error:topic-event-unrecognized, ${type}]]`);
|
|
|
|
@ -171,12 +171,12 @@ Events.log = async (tid, payload) => {
|
|
|
|
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
db.setObject(`topicEvent:${eventId}`, payload),
|
|
|
|
|
db.sortedSetAdd(`topic:${tid}:events`, now, eventId),
|
|
|
|
|
db.sortedSetAdd(`topic:${tid}:events`, timestamp, eventId),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
let events = await modifyEvent({
|
|
|
|
|
eventIds: [eventId],
|
|
|
|
|
timestamps: [now],
|
|
|
|
|
timestamps: [timestamp],
|
|
|
|
|
events: [payload],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|