This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/mixins/has_current_user.js
2013-09-11 13:26:46 +10:00

32 lines
728 B
JavaScript

/**
This mixin provides a `currentUser` property that can be used to retrieve information
about the currently logged in user. It is mostly useful to controllers so it can be
exposted to templates.
Outside of templates, code should probably use `Discourse.User.current()` instead of
this property.
@class Discourse.HasCurrentUser
@extends Ember.Mixin
@namespace Discourse
@module HasCurrentUser
**/
Discourse.HasCurrentUser = Em.Mixin.create({
/**
Returns a reference to the currently logged in user.
@method currentUser
@return {Discourse.User} the currently logged in user if present.
*/
currentUser: function() {
return Discourse.User.current();
}.property().volatile()
});