Comment

Comment by 04091948

I personally, would've overridden the equal function of record (or made an equality helper function).

so the code would become

if(!record.isBuiltIn() || !user.canChange(record) || !record.equals(oldRecord)){ // can't save / or no need too }

and if no one can change a builtin, then a user certainly can't change it.

so it becomes:

if( !user.canChange(record || !record.equals(oldRecord))){ // can't save / or no need too }

parent 04091948 6 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton