<commit_before>Parse.Cloud.beforeSave("Bill", function (request, response) {
    request.object.get("Family").fetch().then(function (family) {
        family.get("Writers").fetch().then(function (writers) {
            writers.relation("users").query().find().then(function (results) {
                var found = false;
                for (var i = 0; i < results.length; ++i) {
                    if (results[i].id === request.user.id) {
                        found = true;
                        break;
                    }
                }
                if (found)
                    response.success();
                else
                    response.error("You cannot write to the family");
            });
        });
    });
});<commit_msg>Send push notifications via cloud code.<commit_after>Parse.Cloud.beforeSave("Bill", function (request, response) {
    request.object.get("Family").fetch().then(function (family) {
        family.get("Writers").fetch().then(function (writers) {
            writers.relation("users").query().find().then(function (results) {
                var found = false;
                for (var i = 0; i < results.length; ++i) {
                    if (results[i].id === request.user.id) {
                        found = true;
                        break;
                    }
                }
                if (found)
                    response.success();
                else
                    response.error("You cannot write to the family");
            });

            family.get("Readers").fetch().then(function (readers) {
                var writersQuery = writers.relation("users").query();
                var readersQuery = readers.relation("users").query();
                var usersQuery = Parse.Query.or(
                    writersQuery, readersQuery);

                var pushQuery = new Parse.Query(Parse.Installation);
                pushQuery.matchesQuery('user', usersQuery);

                Parse.Push.send({
                    where: pushQuery,
                    data: {
                        alert: "Bill added for " +
                            request.object.get("Payee")
                    }
                });
            });


        });
    });
});
{'fraction_non_alphanumeric': 0.13116940862605603, 'fraction_numerical': 0.0008892841262783459, 'mean_word_length': 1.275025278058645, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7214086', 'n_tokens_mistral': 553, 'n_tokens_neox': 508, 'n_words': 107}