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