<commit_before>package controllers;

import models.User;
import play.Logger;
import play.Logger.ALogger;
import play.mvc.Controller;
import play.mvc.Result;
import socialauth.controllers.SocialLogin;
import socialauth.core.Secure;
import socialauth.core.SocialAware;
import socialauth.core.SocialUser;
import views.html.userShow;

public class UserController extends Controller {

	private static ALogger log = Logger.of(UserController.class);
	
	@SocialAware
	public static Result show(String key) {
		if (log.isDebugEnabled())
			log.debug("index() <-");
		if (log.isDebugEnabled())
			log.debug("key : " + key);
		
		final SocialUser self = (SocialUser) ctx().args.get(SocialLogin.USER_KEY);
		if (log.isDebugEnabled())
			log.debug("self : " + self);
		
		User user = User.get(key);
		if (log.isDebugEnabled())
			log.debug("user : " + user);
		if (user == null) {
			return badRequest(userShow.render(user, false));
		}
		boolean selfPage = false;
		if (user != null && self != null && (user.getKey() + "").equals(self.getUserKey())) {
			selfPage  = true;
		}
		
		return ok(userShow.render(user, selfPage));
	}

	@Secure
	public static Result showSelf() {
		if (log.isDebugEnabled())
			log.debug("index() <-");
		
		final SocialUser self = (SocialUser) ctx().args.get(SocialLogin.USER_KEY);
		if (log.isDebugEnabled())
			log.debug("self : " + self);
		
		User user = new User(self);
		if (log.isDebugEnabled())
			log.debug("user : " + user);
		boolean selfPage = true;
		
		return ok(userShow.render(user, selfPage));
	}
}<commit_msg>fix minor issue creating a user from session context<commit_after>package controllers;

import models.User;
import play.Logger;
import play.Logger.ALogger;
import play.mvc.Controller;
import play.mvc.Result;
import socialauth.controllers.SocialLogin;
import socialauth.core.Secure;
import socialauth.core.SocialAware;
import socialauth.core.SocialUser;
import utils.HttpUtils;
import views.html.userShow;

public class UserController extends Controller {

	private static ALogger log = Logger.of(UserController.class);
	
	@SocialAware
	public static Result show(String key) {
		if (log.isDebugEnabled())
			log.debug("show() <-");
		if (log.isDebugEnabled())
			log.debug("key : " + key);
		
		final SocialUser self = (SocialUser) ctx().args.get(SocialLogin.USER_KEY);
		
		User user = HttpUtils.loginUser(ctx());
		if (log.isDebugEnabled())
			log.debug("user : " + user);
		if (user == null) {
			return badRequest(userShow.render(user, false));
		}
		boolean selfPage = false;
		if (user != null && self != null && (user.getKey() + "").equals(self.getUserKey())) {
			selfPage  = true;
		}
		
		return ok(userShow.render(user, selfPage));
	}

	@Secure
	public static Result showSelf() {
		if (log.isDebugEnabled())
			log.debug("showSelf() <-");
		
		User user = HttpUtils.loginUser(ctx());
		
		if (log.isDebugEnabled())
			log.debug("user : " + user);
		boolean selfPage = true;
		
		return ok(userShow.render(user, selfPage));
	}
}
{'fraction_non_alphanumeric': 0.14760147601476015, 'fraction_numerical': 0.0, 'mean_word_length': 4.222416812609457, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4804944', 'n_tokens_mistral': 1085, 'n_tokens_neox': 957, 'n_words': 222}