Page MenuHomePhabricator

[keyserver] Replace undefined subthread_permissions with null
ClosedPublic

Authored by tomek on Nov 8 2023, 9:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 2, 9:11 AM
Unknown Object (File)
Mon, Jul 1, 2:21 AM
Unknown Object (File)
Sun, Jun 30, 12:11 AM
Unknown Object (File)
Sat, Jun 29, 10:47 AM
Unknown Object (File)
Thu, Jun 27, 8:34 AM
Unknown Object (File)
Wed, Jun 26, 3:49 PM
Unknown Object (File)
Wed, Jun 26, 12:55 AM
Unknown Object (File)
Wed, Jun 26, 12:55 AM
Subscribers

Details

Summary

When fetching a message for entry action, we weren't selecting subthread_permissions. Then the result was passed to rawMessageInfoFromRows which uses JSON.parse on subthread_permissions. When a value is null, parsing returns null. But when a value is undefined, parsing throws an error.

Modified the code so that we're fetching NULL - all the entry messages are different from messageTypes.CREATE_SUB_THREAD so they don't have subthread_permissions.

https://linear.app/comm/issue/ENG-5684/editing-entries-doesnt-work

Test Plan

Create and edit an entry in the community root - it should work.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Nov 8 2023, 9:36 AM
Harbormaster failed remote builds in B23912: Diff 32949!

You should be able to rebase on master to fix the failing CommTest, but feel free to just publish now

I tried to investigate when this regression happened but I couldn't figure it out. I'm sure I was able to edit entries somewhat recently, but it appears that subthread_permissions has been in the other queries for a while, and was never in the fetchMessageInfoForEntryAction query.

keyserver/src/fetchers/message-fetchers.js
664 ↗(On Diff #32949)

Can you strip the trailing space you added to this line?

I tried to investigate when this regression happened but I couldn't figure it out. I'm sure I was able to edit entries somewhat recently, but it appears that subthread_permissions has been in the other queries for a while, and was never in the fetchMessageInfoForEntryAction query.

It could be introduced in D4521. Even now, editing works in some threads, and I'm not sure why it doesn't work in some cases.

keyserver/src/fetchers/message-fetchers.js
664 ↗(On Diff #32949)

Sure!

Harbormaster returned this revision to the author for changes because remote builds failed.Nov 9 2023, 1:45 AM
Harbormaster failed remote builds in B23947: Diff 32990!
tomek requested review of this revision.Nov 9 2023, 2:01 AM
This revision is now accepted and ready to land.Nov 9 2023, 3:20 AM