mirror of
https://github.com/documize/community.git
synced 2025-08-08 06:55:28 +02:00
Fix jshint errors and cleanup
This commit is contained in:
parent
d856879e82
commit
acf4cc4478
16 changed files with 35 additions and 85 deletions
|
@ -180,7 +180,7 @@ export default function() {
|
||||||
return db.permissions;
|
return db.permissions;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/folders/VzMuyEw_3WqiafcG/permissions', (db) => {
|
this.get('/folders/VzMuyEw_3WqiafcG/permissions', () => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"folderId":"VzMuyEw_3WqiafcG",
|
"folderId":"VzMuyEw_3WqiafcG",
|
||||||
|
@ -483,11 +483,11 @@ export default function() {
|
||||||
/**
|
/**
|
||||||
very helpful for debugging
|
very helpful for debugging
|
||||||
*/
|
*/
|
||||||
this.handledRequest = function(verb, path, request) {
|
this.handledRequest = function(verb, path) {
|
||||||
console.log(`👊${verb} ${path}`);
|
console.log(`👊${verb} ${path}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.unhandledRequest = function(verb, path, request) {
|
this.unhandledRequest = function(verb, path) {
|
||||||
console.log(`🔥${verb} ${path}`);
|
console.log(`🔥${verb} ${path}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
import Mirage, {faker} from 'ember-cli-mirage';
|
|
||||||
|
|
||||||
export default Mirage.Factory.extend({
|
|
||||||
"folderId":"VzMuyEw_3WqiafcG",
|
|
||||||
"userId":"VzMuyEw_3WqiafcE",
|
|
||||||
"canView":true,
|
|
||||||
"canEdit":true
|
|
||||||
});
|
|
|
@ -32,9 +32,9 @@ export default Ember.Controller.extend(NotifierMixin, {
|
||||||
$("#newUserFirstname").focus();
|
$("#newUserFirstname").focus();
|
||||||
this.get('model').pushObject(user);
|
this.get('model').pushObject(user);
|
||||||
})
|
})
|
||||||
.catch(function(){
|
.catch(function(error){
|
||||||
let msg = error.status === 409 ? 'Unable to add duplicate user' : 'Unable to add user';
|
let msg = error.status === 409 ? 'Unable to add duplicate user' : 'Unable to add user';
|
||||||
self.showNotification(msg);
|
this.showNotification(msg);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ export default Ember.Service.extend({
|
||||||
let url = this.get('sessionService').appMeta.getUrl(`documents/${documentId}`);
|
let url = this.get('sessionService').appMeta.getUrl(`documents/${documentId}`);
|
||||||
|
|
||||||
return this.get('ajax').request(url).then((response) => {
|
return this.get('ajax').request(url).then((response) => {
|
||||||
let doc = models.DocumentModel.create(response);
|
return models.DocumentModel.create(response);
|
||||||
return doc;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -71,8 +70,6 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: JSON.stringify(doc)
|
data: JSON.stringify(doc)
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -97,8 +94,6 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -108,8 +103,6 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -118,8 +111,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -131,8 +122,6 @@ export default Ember.Service.extend({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -143,8 +132,6 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -155,8 +142,6 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -166,16 +151,14 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getPageRevisions(documentId, pageId) {
|
getPageRevisions(documentId, pageId) {
|
||||||
let url = this.get('sessionService').appMeta.getUrl("documents/" + documentId + "/pages/" + pageId + "/revisions");
|
let url = this.get('sessionService').appMeta.getUrl("documents/" + documentId + "/pages/" + pageId + "/revisions");
|
||||||
|
|
||||||
return this.get('ajax').request(url).then((response) => {
|
return this.get('ajax').request(url, {
|
||||||
return response;
|
method: "GET"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -184,16 +167,14 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
dataType: 'text'
|
dataType: 'text'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
rollbackPage(documentId, pageId, revisionId) {
|
rollbackPage(documentId, pageId, revisionId) {
|
||||||
let url = this.get('sessionService').appMeta.getUrl("documents/" + documentId + "/pages/" + pageId + "/revisions/" + revisionId);
|
let url = this.get('sessionService').appMeta.getUrl("documents/" + documentId + "/pages/" + pageId + "/revisions/" + revisionId);
|
||||||
|
|
||||||
return this.get('ajax').post(url).then((response) => {
|
return this.get('ajax').request(url, {
|
||||||
return response;
|
method: "POST"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -201,8 +182,8 @@ export default Ember.Service.extend({
|
||||||
getMeta(documentId) {
|
getMeta(documentId) {
|
||||||
let url = this.get('sessionService').appMeta.getUrl(`documents/${documentId}/meta`);
|
let url = this.get('sessionService').appMeta.getUrl(`documents/${documentId}/meta`);
|
||||||
|
|
||||||
return this.get('ajax').request(url).then((response) => {
|
return this.get('ajax').request(url, {
|
||||||
return response;
|
method: "GET"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -278,8 +259,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,8 +66,6 @@ export default BaseService.extend({
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: JSON.stringify(folder)
|
data: JSON.stringify(folder)
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -76,8 +74,6 @@ export default BaseService.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -86,8 +82,6 @@ export default BaseService.extend({
|
||||||
|
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: payload
|
data: payload
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -141,8 +135,6 @@ export default BaseService.extend({
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: JSON.stringify(payload)
|
data: JSON.stringify(payload)
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -152,8 +144,6 @@ export default BaseService.extend({
|
||||||
|
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(invitation)
|
data: JSON.stringify(invitation)
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,6 @@ export default Ember.Service.extend({
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: JSON.stringify(org)
|
data: JSON.stringify(org)
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,8 +19,8 @@ export default Ember.Service.extend({
|
||||||
find(keywords) {
|
find(keywords) {
|
||||||
let url = this.get('sessionService').appMeta.getUrl("search?keywords=" + encodeURIComponent(keywords));
|
let url = this.get('sessionService').appMeta.getUrl("search?keywords=" + encodeURIComponent(keywords));
|
||||||
|
|
||||||
return this.get('ajax').request(url).then((response) => {
|
return this.get('ajax').request(url, {
|
||||||
return response;
|
method: "GET"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,8 +43,6 @@ export default BaseService.extend({
|
||||||
|
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
let url = this.get('sessionService').appMeta.getUrl("templates/" + templateId + "/folder/" + folderId + "?type=stock");
|
let url = this.get('sessionService').appMeta.getUrl("templates/" + templateId + "/folder/" + folderId + "?type=stock");
|
||||||
|
|
||||||
return this.get('ajax').post(url).then((response)=>{
|
return this.get('ajax').request(url, {
|
||||||
return response;
|
method: "POST"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -61,8 +61,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
type: 'GET'
|
type: 'GET'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,8 +83,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').post(url, {
|
return this.get('ajax').post(url, {
|
||||||
data: password
|
data: password
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -94,8 +92,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.get('ajax').request(url, {
|
return this.get('ajax').request(url, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).then((response) => {
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -104,8 +100,7 @@ export default Ember.Service.extend({
|
||||||
let url = this.get('sessionService').appMeta.getUrl('public/forgot');
|
let url = this.get('sessionService').appMeta.getUrl('public/forgot');
|
||||||
|
|
||||||
if (is.empty(email)) {
|
if (is.empty(email)) {
|
||||||
reject("invalid");
|
return Ember.RSVP.reject("invalid");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
|
@ -114,8 +109,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.request('ajax').post(url, {
|
return this.request('ajax').post(url, {
|
||||||
data: data
|
data: data
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -129,8 +122,6 @@ export default Ember.Service.extend({
|
||||||
|
|
||||||
return this.request('ajax').post(url, {
|
return this.request('ajax').post(url, {
|
||||||
data: password
|
data: password
|
||||||
}).then((response)=>{
|
|
||||||
return response;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,10 @@
|
||||||
"pauseTest",
|
"pauseTest",
|
||||||
"userLogin",
|
"userLogin",
|
||||||
"skip",
|
"skip",
|
||||||
"waitToAppear"
|
"waitToAppear",
|
||||||
|
"waitToAppear",
|
||||||
|
"stubUserNotification",
|
||||||
|
"is"
|
||||||
],
|
],
|
||||||
"node": false,
|
"node": false,
|
||||||
"browser": false,
|
"browser": false,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { test, skip } from 'qunit';
|
import { test} from 'qunit';
|
||||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
|
|
||||||
moduleForAcceptance('Acceptance | User Settings');
|
moduleForAcceptance('Acceptance | User Settings');
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import netUtil from 'documize/utils/net';
|
// import netUtil from 'documize/utils/net';
|
||||||
import config from 'documize/config/environment';
|
|
||||||
|
|
||||||
const Audit = Ember.Service.extend({
|
const Audit = Ember.Service.extend({
|
||||||
sessionService: Ember.inject.service('session'),
|
sessionService: Ember.inject.service('session'),
|
||||||
|
@ -20,6 +19,8 @@ const Audit = Ember.Service.extend({
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return id;
|
||||||
|
|
||||||
// Intercom('trackEvent', id); //jshint ignore: line
|
// Intercom('trackEvent', id); //jshint ignore: line
|
||||||
// Intercom('update'); //jshint ignore: line
|
// Intercom('update'); //jshint ignore: line
|
||||||
},
|
},
|
||||||
|
@ -37,7 +38,7 @@ const Audit = Ember.Service.extend({
|
||||||
|
|
||||||
this.set('ready', true);
|
this.set('ready', true);
|
||||||
|
|
||||||
let appId = config.environment === 'production' ? 'c6cocn4z' : 'itgvb1vo';
|
// let appId = config.environment === 'production' ? 'c6cocn4z' : 'itgvb1vo';
|
||||||
|
|
||||||
// window.intercomSettings = {
|
// window.intercomSettings = {
|
||||||
// app_id: appId,
|
// app_id: appId,
|
||||||
|
|
|
@ -80,7 +80,7 @@ const Session = Ember.Service.extend({
|
||||||
}).then((response)=>{
|
}).then((response)=>{
|
||||||
this.setSession(response.token, models.UserModel.create(response.user));
|
this.setSession(response.token, models.UserModel.create(response.user));
|
||||||
this.get('ready', true);
|
this.get('ready', true);
|
||||||
resolve(response);
|
return response;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -113,17 +113,17 @@ const Session = Ember.Service.extend({
|
||||||
// localStorage.clear();
|
// localStorage.clear();
|
||||||
},
|
},
|
||||||
|
|
||||||
storeSessionItem: function(key, data) {
|
storeSessionItem: function() {
|
||||||
// localStorage[key] = data;
|
// localStorage[key] = data;
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSessionItem: function(key) {
|
getSessionItem: function() {
|
||||||
// return localStorage[key];
|
// return localStorage[key];
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearSessionItem: function(key) {
|
clearSessionItem: function() {
|
||||||
// delete localStorage[key];
|
// delete localStorage[key];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -181,12 +181,12 @@ const Session = Ember.Service.extend({
|
||||||
return this.get('ajax').request(tokenCheckUrl, {
|
return this.get('ajax').request(tokenCheckUrl, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
contentType: 'json'
|
contentType: 'json'
|
||||||
}).then((response) => {
|
}).then((user) => {
|
||||||
this.setSession(token, models.UserModel.create(user));
|
this.setSession(token, models.UserModel.create(user));
|
||||||
this.set('ready', true);
|
this.set('ready', true);
|
||||||
}).catch((reason) => {
|
}).catch((reason) => {
|
||||||
if (reason.status === 401 || reason.status === 403) {
|
if (reason.status === 401 || reason.status === 403) {
|
||||||
localStorage.clear();
|
// localStorage.clear();
|
||||||
window.location.href = "/auth/login";
|
window.location.href = "/auth/login";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ const userNotification = Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
showNotification(msg) {
|
showNotification(msg) {
|
||||||
// return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Test.registerAsyncHelper('userLogin', function(app) {
|
export default Ember.Test.registerAsyncHelper('userLogin', function() {
|
||||||
visit('/auth/login');
|
visit('/auth/login');
|
||||||
|
|
||||||
fillIn('#authEmail', 'brizdigital@gmail.com');
|
fillIn('#authEmail', 'brizdigital@gmail.com');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue