Fix codacy warnings

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-06-14 11:54:38 +02:00
parent 22190b90cf
commit 06ea03689b
5 changed files with 8 additions and 6 deletions

View File

@@ -20,7 +20,7 @@
* *
*/ */
/* global app moment */ /* global app moment angular OC */
import app from '../app/App.js'; import app from '../app/App.js';
app.controller('CardController', function ($scope, $rootScope, $sce, $location, $stateParams, $state, $interval, $timeout, $filter, BoardService, CardService, StackService, StatusService, markdownItConverter, FileService) { app.controller('CardController', function ($scope, $rootScope, $sce, $location, $stateParams, $state, $interval, $timeout, $filter, BoardService, CardService, StackService, StatusService, markdownItConverter, FileService) {

View File

@@ -27,7 +27,7 @@ app.filter('bytes', function () {
if (isNaN(parseFloat(bytes, 10)) || !isFinite(bytes)) { if (isNaN(parseFloat(bytes, 10)) || !isFinite(bytes)) {
return '-'; return '-';
} }
if (precision === undefined) { if (typeof precision === 'undefined') {
precision = 2; precision = 2;
} }
var units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'], var units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'],

View File

@@ -125,7 +125,7 @@ app.factory('ApiService', function ($http, $q) {
this.data[entity.id] = entity; this.data[entity.id] = entity;
} else { } else {
Object.keys(entity).forEach(function (key) { Object.keys(entity).forEach(function (key) {
if (entity[key] !== null) { if (entity[key] !== null && element[key] !== entity[key]) {
element[key] = entity[key]; element[key] = entity[key];
} }
}); });

View File

@@ -22,6 +22,7 @@
import app from '../app/App.js'; import app from '../app/App.js';
/* global OC oc_requesttoken */
export default class FileService { export default class FileService {
constructor ($http, FileUploader, CardService) { constructor ($http, FileUploader, CardService) {
@@ -51,7 +52,7 @@ export default class FileService {
}; };
this.uploader.uploadItem(fileItem); this.uploader.uploadItem(fileItem);
}; }
onAfterAddingFile (fileItem) { onAfterAddingFile (fileItem) {
// Fetch card details before trying to upload so we can detect filename collisions properly // Fetch card details before trying to upload so we can detect filename collisions properly
@@ -87,11 +88,11 @@ export default class FileService {
}); });
}; }
onSuccessItem(item, response) { onSuccessItem(item, response) {
let attachments = this.cardservice.get(item.cardId).attachments; let attachments = this.cardservice.get(item.cardId).attachments;
let index = attachments.indexOf(attachments.find(attachment => attachment.id === response.id)); let index = attachments.indexOf(attachments.find((attachment) => attachment.id === response.id));
if (~index) { if (~index) {
attachments = attachments.splice(index, 1); attachments = attachments.splice(index, 1);
} }

View File

@@ -21,6 +21,7 @@
*/ */
import app from '../app/App.js'; import app from '../app/App.js';
/* global app angular */
app.factory('StackService', function (ApiService, CardService, $http, $q) { app.factory('StackService', function (ApiService, CardService, $http, $q) {
var StackService = function ($http, ep, $q) { var StackService = function ($http, ep, $q) {
ApiService.call(this, $http, ep, $q); ApiService.call(this, $http, ep, $q);