<commit_before>/**
 * Sesions
 */
import { EventEmitter, ReflectiveInjector, provide } from '@angular/core';

export class Session {
	loggedinEmitter : EventEmitter<any> = new EventEmitter();
	userEmitter : EventEmitter<any> = new EventEmitter();

	/**
	 * Return if loggedin, with an optional listener
	 */
	isLoggedIn(observe: any = null){

		if(observe){
			this.loggedinEmitter.subscribe({next: (is) => {
				if(is)
					observe(true);
				else
					observe(false);
				}
			});
		}

		if(window.Minds.LoggedIn)
			return true;

		return false
	}

	isAdmin(){
		if(!this.isLoggedIn)
			return false;
		if(window.Minds.Admin)
			return true;

		return false;
	}

	/**
	 * Get the loggedin user
	 */
	getLoggedInUser(observe: any = null){

		if(observe){
			this.userEmitter.subscribe({next: (user) => {
				observe(user);
			}});
		}

		if(window.Minds.user)
			return window.Minds.user;

		return false;
	}

	/**
	 * Emit login event
	 */
	login(user : any = null){
		//clear stale local storage
		window.localStorage.clear();
		this.userEmitter.next(user);
		window.Minds.user = user;
		if(user.admin == 'user')
			window.Minds.Admin = true;
		window.Minds.LoggedIn = true;
		this.loggedinEmitter.next(true);
	}

	/**
	 * Emit logout event
	 */
	logout(){
		this.userEmitter.next(null);
		delete window.Minds.user;
		window.Minds.LoggedIn = false;
		window.localStorage.clear();
		this.loggedinEmitter.next(false);
	}

}

var injector = ReflectiveInjector.resolveAndCreate([
	provide(Session, { useFactory: () => new Session() })
]);

export class SessionFactory {
	static build(){
		return injector.get(Session);
	}
}
<commit_msg>(fix): user admin should be true.. wrong val<commit_after>/**
 * Sesions
 */
import { EventEmitter, ReflectiveInjector, provide } from '@angular/core';

export class Session {
	loggedinEmitter : EventEmitter<any> = new EventEmitter();
	userEmitter : EventEmitter<any> = new EventEmitter();

	/**
	 * Return if loggedin, with an optional listener
	 */
	isLoggedIn(observe: any = null){

		if(observe){
			this.loggedinEmitter.subscribe({next: (is) => {
				if(is)
					observe(true);
				else
					observe(false);
				}
			});
		}

		if(window.Minds.LoggedIn)
			return true;

		return false
	}

	isAdmin(){
		if(!this.isLoggedIn)
			return false;
		if(window.Minds.Admin)
			return true;

		return false;
	}

	/**
	 * Get the loggedin user
	 */
	getLoggedInUser(observe: any = null){

		if(observe){
			this.userEmitter.subscribe({next: (user) => {
				observe(user);
			}});
		}

		if(window.Minds.user)
			return window.Minds.user;

		return false;
	}

	/**
	 * Emit login event
	 */
	login(user : any = null){
		//clear stale local storage
		window.localStorage.clear();
		this.userEmitter.next(user);
		window.Minds.user = user;
		if(user.admin == true)
			window.Minds.Admin = true;
		window.Minds.LoggedIn = true;
		this.loggedinEmitter.next(true);
	}

	/**
	 * Emit logout event
	 */
	logout(){
		this.userEmitter.next(null);
		delete window.Minds.user;
		window.Minds.LoggedIn = false;
		window.localStorage.clear();
		this.loggedinEmitter.next(false);
	}

}

var injector = ReflectiveInjector.resolveAndCreate([
	provide(Session, { useFactory: () => new Session() })
]);

export class SessionFactory {
	static build(){
		return injector.get(Session);
	}
}

{'fraction_non_alphanumeric': 0.14813692820357469, 'fraction_numerical': 0.0, 'mean_word_length': 3.390957446808511, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '5495468', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1188, 'n_words': 231}