<commit_before>/*global Router, Meteor, Session, $*/
(function () {

    'use strict';

    Router.configure({
        layoutTemplate: 'footer',
        onBeforeAction: function () {
            if (Meteor.loggingIn() || Meteor.userId() === undefined) {
                Router.go('login');
            } else {
                this.next();
            }
        }
    });

    Router.route('/', {
        name: 'home',
        onBeforeAction: function () {
            if (Meteor.loggingIn() || Meteor.userId() === undefined) {
                Router.go('login');
            } else {
                Router.go('events');
            }
        }
    });

    Router.route('/info', {
        name: 'info',
        template: 'info_page',
        onBeforeAction: null
    });

    Router.route('/login', {
        name: 'login',
        template: 'login_page',
        layoutTemplate: null
    });

    Router.route('/logout', {
        name: 'logout',
        onBeforeAction: function () {
            Meteor.logout();
            Router.go('login');
        }
    });

    Router.route('/logout/success', {
        name: 'logout_success',
        template: 'logout_page'
    });

    Router.route('/events', {
        name: 'events',
        template: 'events_page',
        waitOn: function () {
            Meteor.subscribe('events');
            return Meteor.subscribe('getUserData');
        },
        data: function () {
            var user,
                email,
                isFacebook,
                isGoogle,
                events;
            user = Meteor.user();
            isFacebook = user.services.facebook !== undefined;
            isGoogle = user.services.google !== undefined;
            if (isFacebook) {
                email = user.services.facebook.email;
            }
            if (isGoogle) {
                email = user.services.google.email;
            }
            return {
                single_events: Meteor.Events.find({
                    'users': {
                        $elemMatch: {
                            email: email
                        }
                    }
                })
            };
        }
    });

    Router.route('/create/event', {
        name: 'create_event',
        template: 'create_event_page',
        waitOn: function () {
            return Meteor.subscribe('events');
        }
    });
<commit_msg>Find events by user email for cross-accounting.<commit_after>/*global Router, Meteor, Session, $*/
(function () {

    'use strict';

    Router.configure({
        layoutTemplate: 'footer',
        onBeforeAction: function () {
            if (Meteor.loggingIn() || Meteor.userId() === undefined) {
                Router.go('login');
            } else {
                this.next();
            }
        }
    });

    Router.route('/', {
        name: 'home',
        onBeforeAction: function () {
            if (Meteor.loggingIn() || Meteor.userId() === undefined) {
                Router.go('login');
            } else {
                Router.go('events');
            }
        }
    });

    Router.route('/info', {
        name: 'info',
        template: 'info_page',
        onBeforeAction: null
    });

    Router.route('/login', {
        name: 'login',
        template: 'login_page',
        layoutTemplate: null
    });

    Router.route('/logout', {
        name: 'logout',
        onBeforeAction: function () {
            Meteor.logout();
            Router.go('login');
        }
    });

    Router.route('/logout/success', {
        name: 'logout_success',
        template: 'logout_page'
    });

    Router.route('/events', {
        name: 'events',
        template: 'events_page',
        waitOn: function () {
            Meteor.subscribe('events');
            return Meteor.subscribe('getUserData');
        },
        data: function () {
            var user,
                email,
                isFacebook = false,
                isGoogle = false;
            user = Meteor.user();
            try {
                isFacebook = user.services.facebook !== undefined;
            } catch (ignore) {

            }
            try {
                isGoogle = user.services.google !== undefined;
            } catch (ignore) {

            }
            if (isFacebook) {
                email = user.services.facebook.email;
            }
            if (isGoogle) {
                email = user.services.google.email;
            }
            return {
                single_events: Meteor.Events.find({
                    'users': {
                        $elemMatch: {
                            email: email
                        }
                    }
                })
            };
        }
    });

    Router.route('/create/event', {
        name: 'create_event',
        template: 'create_event_page',
        waitOn: function () {
            return Meteor.subscribe('events');
        }
    });

{'fraction_non_alphanumeric': 0.13474747474747475, 'fraction_numerical': 0.0, 'mean_word_length': 1.2162041181736796, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2447598', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1257, 'n_words': 227}