<commit_before>(function () {
    angular
            .module('references')
            .controller('ReferenceBrowsingController', ReferenceBrowsingController);

    ReferenceBrowsingController.$inject = [
        'ReferencesService',
        'Restangular',
        'AuthService',
        '$route',
        'user'
    ];

    function ReferenceBrowsingController(ReferencesService, Restangular, AuthService, $route, user) {
        var vm = this;
        
        vm.researchEntity = user;
        vm.deleteReference = deleteReference;
        vm.canCreate = ($route.current.params.id == AuthService.user.id);
        vm.createNewUrl = "/users/" + user.id + "/references/new";
        vm.editUrl = '#/users/' + user.id + '/edit';

        activate();

        function activate() {
            return getReferences().then(function () {

            });
        }

        function getReferences() {
            return user.getList('references', {populate: ['owner', 'collaborators']})
                    .then(function (references) {
                        vm.references = references;
                        return vm.references;
            });
        }

        function deleteReference(reference) {
//            reference.remove(reference)
            ReferencesService.delete(reference)
                    .then(function () {
                        _.remove(vm.references, reference);
                    });
        }
    }
})();<commit_msg>Changed code to get public references.<commit_after>(function () {
    angular
            .module('references')
            .controller('ReferenceBrowsingController', ReferenceBrowsingController);

    ReferenceBrowsingController.$inject = [
        'ReferencesService',
        'Restangular',
        'AuthService',
        '$route',
        'user'
    ];

    function ReferenceBrowsingController(ReferencesService, Restangular, AuthService, $route, user) {
        var vm = this;
        
        vm.researchEntity = user;
        vm.deleteReference = deleteReference;
        vm.canCreate = ($route.current.params.id == AuthService.user.id);
        vm.createNewUrl = "/users/" + user.id + "/references/new";
        vm.editUrl = '#/users/' + user.id + '/edit';

        activate();

        function activate() {
            return getReferences().then(function () {

            });
        }

        function getReferences() {
            return user.getList('publicReferences', {populate: ['publicCoauthors', 'privateCoauthors']})
                    .then(function (references) {
                        vm.references = references;
                        return vm.references;
            });
        }

        function deleteReference(reference) {
//            reference.remove(reference)
            ReferencesService.delete(reference)
                    .then(function () {
                        _.remove(vm.references, reference);
                    });
        }
    }
})();
{'fraction_non_alphanumeric': 0.12169491525423728, 'fraction_numerical': 0.0, 'mean_word_length': 1.7400185701021356, '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': '933688', 'n_tokens_mistral': 745, 'n_tokens_neox': 703, 'n_words': 125}