Skip to content

Instantly share code, notes, and snippets.

@kamaravichow
Created August 18, 2021 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamaravichow/d56d74a154a80efd24d149b56f2de1ca to your computer and use it in GitHub Desktop.
Save kamaravichow/d56d74a154a80efd24d149b56f2de1ca to your computer and use it in GitHub Desktop.
function isValidNewPost() {
let post = request.resource.data;
let isOwner = post.uid request.auth.uid;
let isNotFromPastOrFuture = request.time == request.resource.data.timestamp;
let hasMandatoryFields = post.keys().hasAll(['caption', 'uid', 'timestamp', 'published']);
return isOwner && hasMandatoryFields && isNotFromPastorFuture;
}
@R-F-R
Copy link

R-F-R commented Nov 25, 2021

I think line 3 is missing the "equals".
Should it not read like this?:
let isOwner = post.uid == request.auth.uid;

@kamaravichow
Copy link
Author

Yeah, right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment