File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ admin.initializeApp(functions.config().firebase);
2121
2222// Keeps track of the length of the 'likes' child list in a separate property.
2323exports . countlikechange = functions . database . ref ( '/posts/{postid}/likes/{likeid}' ) . onWrite ( event => {
24- var collectionRef = event . data . ref . parent ;
25- var countRef = collectionRef . parent . child ( 'likes_count' ) ;
24+ const collectionRef = event . data . ref . parent ;
25+ const countRef = collectionRef . parent . child ( 'likes_count' ) ;
2626
2727 // return the promise from .transaction() so our function
2828 // waits for this async event to complete before it exits
@@ -39,8 +39,9 @@ exports.countlikechange = functions.database.ref('/posts/{postid}/likes/{likeid}
3939// If the number of likes gets deleted, recount the number of likes
4040exports . recountlikes = functions . database . ref ( '/posts/{postid}/likes_count' ) . onWrite ( event => {
4141 if ( ! event . data . exists ( ) ) {
42- var counterRef = event . data . ref ;
43- var collectionRef = counterRef . parent . child ( 'likes' ) ;
42+ const counterRef = event . data . ref ;
43+ const collectionRef = counterRef . parent . child ( 'likes' ) ;
44+
4445 // return the promise from counterRef.set() so our function
4546 // waits for this async event to complete before it exits
4647 return collectionRef . once ( 'value' )
You can’t perform that action at this time.
0 commit comments