From 93abc31936d29c724eaa2c004ccdaaec24ea5d9d Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 16 Nov 2021 18:16:47 -0500 Subject: [PATCH] changesettracker: Fix author attribute ID fetch --- src/static/js/changesettracker.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/static/js/changesettracker.js b/src/static/js/changesettracker.js index 0a0ef9332..cfb6c88a3 100644 --- a/src/static/js/changesettracker.js +++ b/src/static/js/changesettracker.js @@ -139,18 +139,9 @@ const makeChangesetTracker = (scheduler, apool, aceCallbacksProvider) => { // Get my authorID const authorId = parent.parent.pad.myUserInfo.userId; - // Sanitize authorship - // We need to replace all author attribs with thisSession.author, - // in case they copy/pasted or otherwise inserted other peoples changes - let authorAttr; - for (const attr in apool.numToAttrib) { - if (apool.numToAttrib[attr][0] === 'author' && - apool.numToAttrib[attr][1] === authorId) { - authorAttr = Number(attr).toString(36); - } - } - - // Replace all added 'author' attribs with the value of the current user + // Sanitize authorship: Replace all author attributes with this user's author ID in case the + // text was copied from another author. + const authorAttr = Changeset.numToString(apool.putAttrib(['author', authorId])); const cs = Changeset.unpack(userChangeset); const iterator = Changeset.opIterator(cs.ops); let op;