Fix codacy issues

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-10-09 10:55:48 +02:00
parent 27f9707058
commit 5edb95fc6b
4 changed files with 11 additions and 11 deletions

View File

@@ -20,7 +20,7 @@
*
*/
/* global OC OCA OCP _ */
/* global OC OCA OCP t escapeHTML */
import CommentCollection from '../legacy/commentcollection';
import CommentModel from '../legacy/commentmodel';
@@ -59,7 +59,7 @@ class ActivityController {
this.activityservice.subscribe(this.$scope, function() {
self.$scope.$apply();
})
});
}
applyAtWho($target) {
@@ -72,7 +72,7 @@ class ActivityController {
callbacks: {
remoteFilter: function(query, callback) {
let uids = self.boardservice.getUsers();
uids = uids.filter(x => x.uid.toLowerCase().includes(query.toLowerCase()) || x.displayname.toLowerCase().includes(query.toLowerCase()));
uids = uids.filter((x) => x.uid.toLowerCase().includes(query.toLowerCase()) || x.displayname.toLowerCase().includes(query.toLowerCase()));
callback(uids);
},
highlighter: function (li) {
@@ -126,15 +126,15 @@ class ActivityController {
$inserted.html('@' + $this.find('.avatar').data('username'));
});
$comment.html(OCP.Comments.richToPlain($comment.html()));
$comment.html($comment.html().replace(/<br\s*[\/]?>/gi, "\n"));
$comment.html($comment.html().replace(/<br\s*[\/]?>/gi, '\n'));
return $comment.text();
}
static _composeHTMLMention(uid, displayName) {
var avatar = '' +
'<span class="avatar" data-username="' + _.escape(uid) + '" data-user="' + _.escape(uid) + '" ng-attr-size="16" ' +
'ng-attr-user="' + _.escape(uid) + '" ' +
'ng-attr-displayname="' + _.escape(displayName) + '" ng-attr-contactsmenu="true">' +
'<span class="avatar" data-username="' + escapeHTML(uid) + '" data-user="' + escapeHTML(uid) + '" ng-attr-size="16" ' +
'ng-attr-user="' + escapeHTML(uid) + '" ' +
'ng-attr-displayname="' + escapeHTML(displayName) + '" ng-attr-contactsmenu="true">' +
'</span>';
var isCurrentUser = (uid === OC.getCurrentUser().uid);
@@ -143,7 +143,7 @@ class ActivityController {
'<span class="atwho-inserted" contenteditable="false">' +
'<span class="avatar-name-wrapper' + (isCurrentUser ? ' currentUser' : '') + '">' +
avatar +
'<strong>' + _.escape(displayName) + '</strong>' +
'<strong>' + escapeHTML(displayName) + '</strong>' +
'</span>' +
'</span>';
}

View File

@@ -49,7 +49,7 @@ app.directive('ngContenteditable', function($compile) {
});
element.bind('keydown', function(event) {
if(event.which == '13' && event.shiftKey) {
if(event.which === 13 && event.shiftKey) {
scope.submit();
}
});

View File

@@ -53,7 +53,7 @@ class ActivityService {
let item = this.toEnhanceWithComments[index];
item.commentModel = this.commentCollection.get(item.subject_rich[1].comment);
if (typeof item.commentModel !== 'undefined') {
this.toEnhanceWithComments = this.toEnhanceWithComments.filter(entry => entry.activity_id !== item.activity_id);
this.toEnhanceWithComments = this.toEnhanceWithComments.filter((entry) => entry.activity_id !== item.activity_id);
}
}
}

View File

@@ -131,7 +131,7 @@ class Application extends App {
/** @var CardMapper */
$service = $this->getContainer()->query(CardMapper::class);
try {
$card = $service->find((int) $name);
$service->find((int) $name);
} catch (\InvalidArgumentException $e) {
return false;
}