<commit_before>liveblogSyndication
    .factory('IngestPanelReducers', function() {
        var locallySyndicatedItems = function(syndicationIn, localSyndTokens) {
            return syndicationIn._items.filter(function(item) {
                return (localSyndTokens.indexOf(item.blog_token) != -1);
            });
        };

        return function(state, action) {
            switch (action.type) {
                case 'ON_GET_SYND':
                    var localSyndTokens = action.syndicationIn._items
                        .filter(function(syndication) {
                            return (syndication.blog_id == state.consumerBlogId);
                        })
                        .map(function(syndication) {
                            return syndication.blog_token;
                        });

                    return angular.extend(state, {
                        syndicationIn: action.syndicationIn, //ACTION
                        localSyndTokens: localSyndTokens,
                        locallySyndicatedItems: locallySyndicatedItems(
                            action.syndicationIn, 
                            localSyndTokens
                        ),
                        localProducerBlogIds: [], // Reset list after syndication
                        producerBlogs: [] // Same here
                    });

                case 'ON_UPDATED_SYND':
                    return angular.extend(state, {
                        syndicationIn: angular.extend(state.syndicationIn, {
                            _items: state.syndicationIn._items.map(function(item) {
                                if (item._id == action.syndEntry._id)
                                    return action.syndEntry;
                                else
                                    return item;
                            })
                        })
                    });

                case 'ON_GET_PRODUCERS':
                    return angular.extend(state, {
                        producers: action.producers
                    });

                case 'ON_GET_PRODUCER_BLOGS':
                    var localProducerBlogIds = [];

                    return angular.extend(state, {
                        producerBlogs: angular.extend(action.producerBlogs, {
                            _items: action.producerBlogs._items
                                .filter(function(blog) {
                                    // Only display the producer's blogs with an enabled syndication
                                    return (blog.syndication_enabled);
                                })
                                .map(function(blog) {
                                    blog.checked = false;
                                    blog.auto_publish = true; // Default autopublish as true

                                    state.locallySyndicatedItems.forEach(function(localBlog) {
                                        if (localBlog.producer_blog_id == blog._id) {
                                            localProducerBlogIds.push(blog._id);
                                            blog.checked = true;
                                        }

                                    });

                                    return blog;
                                })
                        }),
                        localProducerBlogIds: localProducerBlogIds
                    });

                case 'ON_TOGGLE_MODAL':
                    return angular.extend(state, {
                        modalActive: action.modalActive
                    });

                case 'ON_ERROR':
                    return angular.extend(state, {
                        error: action.error
                    });
            }
        }
    });
<commit_msg>Auto publish defaults to false<commit_after>liveblogSyndication
    .factory('IngestPanelReducers', function() {
        var locallySyndicatedItems = function(syndicationIn, localSyndTokens) {
            return syndicationIn._items.filter(function(item) {
                return (localSyndTokens.indexOf(item.blog_token) != -1);
            });
        };

        return function(state, action) {
            switch (action.type) {
                case 'ON_GET_SYND':
                    var localSyndTokens = action.syndicationIn._items
                        .filter(function(syndication) {
                            return (syndication.blog_id == state.consumerBlogId);
                        })
                        .map(function(syndication) {
                            return syndication.blog_token;
                        });

                    return angular.extend(state, {
                        syndicationIn: action.syndicationIn, //ACTION
                        localSyndTokens: localSyndTokens,
                        locallySyndicatedItems: locallySyndicatedItems(
                            action.syndicationIn, 
                            localSyndTokens
                        ),
                        localProducerBlogIds: [], // Reset list after syndication
                        producerBlogs: [] // Same here
                    });

                case 'ON_UPDATED_SYND':
                    return angular.extend(state, {
                        syndicationIn: angular.extend(state.syndicationIn, {
                            _items: state.syndicationIn._items.map(function(item) {
                                if (item._id == action.syndEntry._id)
                                    return action.syndEntry;
                                else
                                    return item;
                            })
                        })
                    });

                case 'ON_GET_PRODUCERS':
                    return angular.extend(state, {
                        producers: action.producers
                    });

                case 'ON_GET_PRODUCER_BLOGS':
                    var localProducerBlogIds = [];

                    return angular.extend(state, {
                        producerBlogs: angular.extend(action.producerBlogs, {
                            _items: action.producerBlogs._items
                                .filter(function(blog) {
                                    // Only display the producer's blogs with an enabled syndication
                                    return (blog.syndication_enabled);
                                })
                                .map(function(blog) {
                                    blog.checked = false;
                                    blog.auto_publish = false; // Default autopublish as false

                                    state.locallySyndicatedItems.forEach(function(localBlog) {
                                        if (localBlog.producer_blog_id == blog._id) {
                                            localProducerBlogIds.push(blog._id);
                                            blog.checked = true;
                                        }

                                    });

                                    return blog;
                                })
                        }),
                        localProducerBlogIds: localProducerBlogIds
                    });

                case 'ON_TOGGLE_MODAL':
                    return angular.extend(state, {
                        modalActive: action.modalActive
                    });

                case 'ON_ERROR':
                    return angular.extend(state, {
                        error: action.error
                    });
            }
        }
    });

{'fraction_non_alphanumeric': 0.0697765582124657, 'fraction_numerical': 0.00026133542401672545, 'mean_word_length': 0.8681962411520625, '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': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4669464', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1546, 'n_words': 252}