fix: hardening pass — permissions, socket reconnect, canvas setup, arrangements
- Fix 403 on save for public collection viewers (return role in GET board response) - Add read-only status indicator (StatusBar + StatusIndicator) - Fix beforeunload save to use fetch+keepalive with auth header - Socket reconnect now rejoins board room automatically - Canvas setup uses polling instead of brittle 200ms timer - Fix double user:left on disconnect (use disconnecting event, snapshot rooms) - Thread + comment creation wrapped in db.transaction - Prevent owner downgrade via addCollectionMember (check existing member) - Bound redirect depth in downloadImage to 5 - Arrangement operations anchor to bounding box top-left (no drift) - Distribute H/V also anchor to top-left - Fix annotations fetch to use axios api instance (401 interceptor) - Replace require() with static import in shortcut-definitions
This commit is contained in:
+9
-1
@@ -552,6 +552,14 @@ function createThread({ id, boardId, objectId, anchorType, pinX, pinY, createdBy
|
||||
return getThread(id);
|
||||
}
|
||||
|
||||
function createThreadWithComment({ threadId, boardId, objectId, anchorType, pinX, pinY, createdBy, commentId, userId, authorName, authorColor, content }) {
|
||||
return db.transaction(() => {
|
||||
const thread = createThread({ id: threadId, boardId, objectId, anchorType, pinX, pinY, createdBy });
|
||||
const comment = createComment({ id: commentId, threadId, userId, authorName, authorColor, content });
|
||||
return { thread, comment };
|
||||
})();
|
||||
}
|
||||
|
||||
function updateThreadStatus(threadId, status, resolvedBy) {
|
||||
if (status === 'resolved') {
|
||||
db.prepare(`
|
||||
@@ -650,7 +658,7 @@ module.exports = {
|
||||
// Media Jobs
|
||||
createMediaJob, updateMediaJob, getMediaJob, getPendingMediaJobs, updateImageMedia,
|
||||
// Threads
|
||||
getThreadsByBoard, getThread, createThread, updateThreadStatus, deleteThread,
|
||||
getThreadsByBoard, getThread, createThread, createThreadWithComment, updateThreadStatus, deleteThread,
|
||||
incrementThreadCommentCount, decrementThreadCommentCount,
|
||||
// Comments
|
||||
getCommentsByThread, getCommentsByBoard, getComment, createComment, updateComment, deleteComment,
|
||||
|
||||
Reference in New Issue
Block a user