<commit_before>Template.messageInput.events({

    'submit form': function (event, template) {

        event.preventDefault();

        var messageInput = event.currentTarget.elements['message'];

        if (messageInput.value === "") return;

        Messages.insert({
            createdAt: new Date(),
            author: Meteor.user().username,
            body: messageInput.value
        });

        messageInput.value = "";

        Session.set("autoScroll", true);
        scrollToBottom();

    },

    'focus input[name="message"]': function () {

        if (Session.get("autoScroll")) {
            if (Meteor.isCordova) {
                // Give some time for the device to open keyboard...
                // Should be listening to keyboard events...
                Meteor.setTimeout(function () {
                    scrollToBottom();
                }, 200);
            } else {
                scrollToBottom();
            }
        }

    },

    'click #login-welcome': function () {
        $("#login-sign-in-link").click();
    },

    'click #take-picture': function () {

        MeteorCamera.getPicture({correctOrientation: true}, function (error, data) {

            Messages.insert({
                createdAt: new Date(),
                author: Meteor.user().username,
                picture: resizeImage(data)
            })

            Session.set("autoScroll", true);

        });
    }

});<commit_msg>Fix check on error when getting camera picture<commit_after>Template.messageInput.events({

    'submit form': function (event, template) {

        event.preventDefault();

        var messageInput = event.currentTarget.elements['message'];

        if (messageInput.value === "") return;

        Messages.insert({
            createdAt: new Date(),
            author: Meteor.user().username,
            body: messageInput.value
        });

        messageInput.value = "";

        Session.set("autoScroll", true);
        scrollToBottom();

    },

    'focus input[name="message"]': function () {

        if (Session.get("autoScroll")) {
            if (Meteor.isCordova) {
                // Give some time for the device to open keyboard...
                // Should be listening to keyboard events...
                Meteor.setTimeout(function () {
                    scrollToBottom();
                }, 200);
            } else {
                scrollToBottom();
            }
        }

    },

    'click #login-welcome': function () {
        $("#login-sign-in-link").click();
    },

    'click #take-picture': function () {

        MeteorCamera.getPicture({correctOrientation: true}, function (error, data) {

            if (!error) {
                Messages.insert({
                    createdAt: new Date(),
                    author: Meteor.user().username,
                    picture: resizeImage(data)
                });
            }

            Session.set("autoScroll", true);

        });
    }

});
{'fraction_non_alphanumeric': 0.1342281879194631, 'fraction_numerical': 0.0020134228187919465, 'mean_word_length': 1.5742659758203799, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6322414', 'n_tokens_mistral': 794, 'n_tokens_neox': 719, 'n_words': 157}