<commit_before>define([
    'knockout-plus',
    'kb_common/html',
    './components/hamburgerMenu',
    'bootstrap'
], function (
    ko,
    html,
    HamburgerMenuComponent
) {
    'use strict';

    function factory(config) {
        var t = html.tag,
            div = t('div'),
            runtime = config.runtime,
            hostNode, container;


        function attach(node) {
            hostNode = node;
            container = hostNode.appendChild(document.createElement('div'));
            container.classList.add('widget-menu');
        }

        function ViewModel() {
            var menu = runtime.service('menu').getCurrentMenu('hamburger');
            var initiallyLoggedIn = runtime.service('session').isLoggedIn();
            var isLoggedIn = ko.observable(initiallyLoggedIn);
            var roles = runtime.service('session').getRoles().map((role) => {
                return role.id;
            });
            // var username = ko.ovservable(runtime.service('session').getUsername());

            // TODO: can this just be a more generic change in session state?
            runtime.recv('session', 'change', function () {
                isLoggedIn(runtime.service('session').isLoggedIn());
            });
<commit_msg>menu widget needs to update roles with session change event.<commit_after>define([
    'knockout-plus',
    'kb_common/html',
    './components/hamburgerMenu',
    'bootstrap'
], function (
    ko,
    html,
    HamburgerMenuComponent
) {
    'use strict';

    function factory(config) {
        var t = html.tag,
            div = t('div'),
            runtime = config.runtime,
            hostNode, container;


        function attach(node) {
            hostNode = node;
            container = hostNode.appendChild(document.createElement('div'));
            container.classList.add('widget-menu');
        }

        function ViewModel() {
            var menu = runtime.service('menu').getCurrentMenu('hamburger');
            var initiallyLoggedIn = runtime.service('session').isLoggedIn();
            var isLoggedIn = ko.observable(initiallyLoggedIn);
            var roles = ko.observableArray(runtime.service('session').getRoles().map((role) => {
                return role.id;
            }));
            // var username = ko.ovservable(runtime.service('session').getUsername());

            // TODO: can this just be a more generic change in session state?
            runtime.recv('session', 'change', function () {
                isLoggedIn(runtime.service('session').isLoggedIn());
                roles(runtime.service('session').getRoles().map((role) => {
                    return role.id;
                }));
            });

{'fraction_non_alphanumeric': 0.1329394387001477, 'fraction_numerical': 0.0, 'mean_word_length': 2.0575620767494356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3007987', 'n_tokens_mistral': 715, 'n_tokens_neox': 700, 'n_words': 140}