Hi,
Community moderators have prevented the ability to post new answers.
This should be able to help you at least get started:
$.ajax({ url: contextPath + "/rest/prototype/1/user/non-system/" + AJS.params.remoteUser + ".json", success: function(response) { console.log(response.displayableEmail); } });
You should know that AJS.params and $action are different. AJS.params is a javascript object which has some details about the current session, but does not have e-mail information (which is why you have to do a REST API request as shown above to get "response.displayableEmail"). $action is an Apache Velocity object (a scripting language that Confluence uses on the backend) so it can be used inside of a user macro or plugin, but not on the frontend using Javascript.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As an alternate approach, you could edit your main decorator layout file and add the line
<!DOCTYPE html> <html> <head> #putMetadata("remote-user-email", $action.remoteUser.getEmail()) </head>
in the head section. Afterwards you can get the value in JavaScript with
AJS.Meta.get("remote-user-email")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nice, I like it!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.