mirror of
https://github.com/documize/community.git
synced 2025-07-23 23:29:42 +02:00
fixed audit.js to initialize Intercom correctly
This commit is contained in:
parent
c80c7430ec
commit
481b6ac057
1 changed files with 14 additions and 12 deletions
|
@ -14,7 +14,8 @@ import netUtil from '../utils/net';
|
||||||
import config from '../config/environment';
|
import config from '../config/environment';
|
||||||
|
|
||||||
export default Ember.Service.extend({
|
export default Ember.Service.extend({
|
||||||
sessionService: Ember.inject.service('session'),
|
session: Ember.inject.service('session'),
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
ready: false,
|
ready: false,
|
||||||
enabled: config.APP.auditEnabled,
|
enabled: config.APP.auditEnabled,
|
||||||
appId: config.APP.intercomKey,
|
appId: config.APP.intercomKey,
|
||||||
|
@ -45,9 +46,10 @@ export default Ember.Service.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
let session = this.get('sessionService');
|
let self = this;
|
||||||
|
let user = this.get('session.user');
|
||||||
|
|
||||||
if (this.get('appId') === "" || !this.get('enabled') || !session.authenticated || this.get('ready')) {
|
if (is.undefined(user) || this.get('appId') === "" || !this.get('enabled') || !this.get('session.authenticated') || this.get('ready')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,19 +57,19 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
window.intercomSettings = {
|
window.intercomSettings = {
|
||||||
app_id: this.get('appId'),
|
app_id: this.get('appId'),
|
||||||
name: session.user.firstname + " " + session.user.lastname,
|
name: user.fullname,
|
||||||
email: session.user.email,
|
email: user.email,
|
||||||
user_id: session.user.id,
|
user_id: user.id,
|
||||||
"administrator": session.user.admin,
|
"administrator": user.admin,
|
||||||
company: {
|
company: {
|
||||||
id: session.get('appMeta.orgId'),
|
id: self.get('appMeta.orgId'),
|
||||||
name: session.get('appMeta.title').string,
|
name: self.get('appMeta.title').string,
|
||||||
"domain": netUtil.getSubdomain(),
|
"domain": netUtil.getSubdomain(),
|
||||||
"version": session.get('appMeta.version')
|
"version": self.get('appMeta.version')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!session.get('isMobile')) {
|
if (!this.get('session.isMobile')) {
|
||||||
window.intercomSettings.widget = {
|
window.intercomSettings.widget = {
|
||||||
activator: "#IntercomDefaultWidget"
|
activator: "#IntercomDefaultWidget"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue