<commit_before>var view = require('../../lib/view');
var clone = require('clone');
var page = require('page');
var auth = require('../../lib/auth');

module.exports = view.extend({
    id: 'profile',
    template: require('./index.html'),
    data: {
        title: 'My Profile',
        back: false
    },
    computed: {
        user: function () {
            return this.model.data.user;
        },
        myApps: function () {
            return this.model.data.apps;
        }
    },
    methods: {
        logout: function (e) {
            e.preventDefault();
            auth.logout();
        },
        clean: function (e) {
            var sh = this.model._fs.Shell();
            var fs = this.model._fs;
            var sync = fs.sync;
            fs.stat('/', function(e, stat) {
                if (!stat.isDirectory()) {
                    fs.unlink('/', function(e) {
                        sync.request();
                    });
                } else {
                    sh.rm('/', {
                        recursive: true
                    }, function(e) {
                        console.log(e);
                        sync.request();
                    });
                }
            });
        }
    }
});<commit_msg>slightly fixed state issues on /profile<commit_after>var view = require('../../lib/view');
var clone = require('clone');
var page = require('page');
var auth = require('../../lib/auth');

module.exports = view.extend({
    id: 'profile',
    template: require('./index.html'),
    data: {
        title: 'My Profile',
        back: false
    },
    computed: {
        user: function () {
            return this.model.data.user;
        },
        myApps: function () {
            // temporary hack to only show current user's data
            var username = this.model.data.user.username;
            var myApps = this.model.data.apps.filter(function (app) {
                return app.author.username === username;
            });
            return myApps;
        }
    },
    methods: {
        logout: function (e) {
            e.preventDefault();
            auth.logout();
        },
        clean: function (e) {
            var self = this;
            var sh = self.model._fs.Shell();
            var fs = self.model._fs;
            var sync = fs.sync;

            function onClear(err) {
                sync.request();
                page('/ftu-3');
            }

            fs.stat('/', function(e, stat) {
                if (!stat.isDirectory()) {
                    fs.unlink('/', onClear);
                } else {
                    sh.rm('/', {
                        recursive: true
                    }, onClear);
                }
            });
        }
    }
});
{'fraction_non_alphanumeric': 0.14798694232861806, 'fraction_numerical': 0.0003627130939426913, 'mean_word_length': 1.1463035019455252, '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': '6164330', 'n_tokens_mistral': 741, 'n_tokens_neox': 718, 'n_words': 159}