<commit_before>import outputModalTpl from 'scripts/liveblog-edit/views/output-modal.ng1';
import {TAGS} from '../../liveblog-common/constants';

/**
 * @desc directive to open a modal to create or edit a channel output
 * @example <output-modal modal-active="x" outputs="array" output="object" blog="blog"></output-modal>
 */

export default function outputModal() {
    return {
        restrict: 'E',
        scope: {
            modalActive: '=',
            outputs: '=',
            output: '=',
            oldOutput: '=',
            blog: '=',
        },
        templateUrl: outputModalTpl,
        controllerAs: 'self',
        controller: outputModalController,
        bindToController: true,
    };
}

outputModalController.$inject = ['$rootScope', '$q', 'api', 'urls', 'notify', 'modal', 'upload', 'adsUtilSevice'];

function outputModalController($rootScope, $q, api, urls, notify, modal, upload, adsUtilSevice) {
    const self = this;

    self.themes = [];
    self.collections = [];
    self.readyToSave = false;
    self.disableSave = false;
    self.imageSaved = false;
    self.cancelModal = cancelModal;
    self.saveOutput = saveOutput;
    self.saveOutputImage = saveOutputImage;
    self.removeOutputImage = removeOutputImage;
    self.removeLogoImage = removeLogoImage;
    self.notValidName = adsUtilSevice.uniqueNameInItems;
    self.ordering = [{title: 'Ascending', value: 1}, {title: 'Descending', value: -1}];

    self.showTagsSelector = true;

    self.onTagsChange = (value) => {
        self.output.tags = value;
    };

    $rootScope.$on('blog', (e, data) => {
        if (data.blog_id === self.blog._id && data.published === 1) {
            // update the blog property
            self.blog.public_urls = data.public_urls;
        }
    });

    if (!$rootScope.globalTags) {
        api.global_preferences.query({where: {key: TAGS}})
            .then((preferences) => {
                const tagSetting = _.find(preferences._items, (item) => item.key === TAGS);

                $rootScope.globalTags = tagSetting.value || [];
            });
    }

    initialize().then(() => {<commit_msg>Minor change to prevent tags selector from failing<commit_after>import outputModalTpl from 'scripts/liveblog-edit/views/output-modal.ng1';
import {TAGS} from '../../liveblog-common/constants';

/**
 * @desc directive to open a modal to create or edit a channel output
 * @example <output-modal modal-active="x" outputs="array" output="object" blog="blog"></output-modal>
 */

export default function outputModal() {
    return {
        restrict: 'E',
        scope: {
            modalActive: '=',
            outputs: '=',
            output: '=',
            oldOutput: '=',
            blog: '=',
        },
        templateUrl: outputModalTpl,
        controllerAs: 'self',
        controller: outputModalController,
        bindToController: true,
    };
}

outputModalController.$inject = ['$rootScope', '$q', 'api', 'urls', 'notify', 'modal', 'upload', 'adsUtilSevice'];

function outputModalController($rootScope, $q, api, urls, notify, modal, upload, adsUtilSevice) {
    const self = this;

    self.themes = [];
    self.collections = [];
    self.readyToSave = false;
    self.disableSave = false;
    self.imageSaved = false;
    self.cancelModal = cancelModal;
    self.saveOutput = saveOutput;
    self.saveOutputImage = saveOutputImage;
    self.removeOutputImage = removeOutputImage;
    self.removeLogoImage = removeLogoImage;
    self.notValidName = adsUtilSevice.uniqueNameInItems;
    self.ordering = [{title: 'Ascending', value: 1}, {title: 'Descending', value: -1}];

    self.showTagsSelector = true;

    self.onTagsChange = (value) => {
        self.output.tags = value;
    };

    $rootScope.$on('blog', (e, data) => {
        if (data.blog_id === self.blog._id && data.published === 1) {
            // update the blog property
            self.blog.public_urls = data.public_urls;
        }
    });

    if (!$rootScope.globalTags) {
        api.global_preferences.query({where: {key: TAGS}})
            .then((preferences) => {
                const tagSetting = _.find(preferences._items, (item) => item.key === TAGS);

                if (tagSetting)
                    $rootScope.globalTags = tagSetting.value || [];
                else
                    $rootScope.globalTags = [];
            });
    }

    initialize().then(() => {
{'fraction_non_alphanumeric': 0.1483666061705989, 'fraction_numerical': 0.0018148820326678765, 'mean_word_length': 2.5470635559131134, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '2273662', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1296, 'n_words': 277}