Skip to content

Commit

Permalink
compat nc20
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Oct 5, 2020
1 parent 89a90c6 commit d938bbc
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 179 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ clean:
rm -rf node_modules

# composer packages
composer:
build-composer:
composer install --prefer-dist

appstore: clean composer
appstore: clean build-composer
mkdir -p $(sign_dir)
rsync -a \
--exclude=/build \
Expand Down
44 changes: 0 additions & 44 deletions appinfo/app.php

This file was deleted.

40 changes: 0 additions & 40 deletions appinfo/autoload.php

This file was deleted.

2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Users won't be able to find this Circle using Nextcloud search engine.
<repository>https://github.com/nextcloud/circles.git</repository>
<screenshot>https://raw.githubusercontent.com/nextcloud/circles/master/screenshots/0.12.0.png</screenshot>
<dependencies>
<nextcloud min-version="19" max-version="19"/>
<nextcloud min-version="20" max-version="20"/>
</dependencies>

<background-jobs>
Expand Down
18 changes: 10 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
"description": "circles",
"minimum-stability": "stable",
"license": "agpl",
"config": {
"vendor-dir": "composer/",
"optimize-autoloader": true,
"classmap-authoritative": true,
"autoloader-suffix": "Circles"
},
"authors": [
{
"name": "Maxence Lange",
"email": "maxence@nextcloud.com"
}
],
"require": {
"daita/my-small-php-tools": "dev-master"
},
"config": {
"optimize-autoloader": true
},
"autoload": {
"psr-4": {
"UpdateServer\\": "src/",
"Tests\\": "tests/unit/"
"OCA\\Circles\\": "lib/"
}
},
"require": {
"daita/my-small-php-tools": "dev-master"
}
}
65 changes: 33 additions & 32 deletions js/circles.app.elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
/** global: api */
/** global: define */


var elements = {

newTypeDefinition: null,
Expand Down Expand Up @@ -342,7 +343,7 @@ var elements = {
fillExactMembersSearch: function(source, exact) {
curr.exactMemberSearchType = '';
$.each(exact, function(index, value) {
var details = escapeHTML(value.value.shareWith);
var details = nav.escapeHtml(value.value.shareWith);
if (source === 'groups') {
if (exact.length === 1) {
curr.exactMemberSearchType = 'group';
Expand All @@ -352,7 +353,7 @@ var elements = {

elements.membersSearchResult.append(
'<div class="members_search exact" source="' + source + '" searchresult="' +
escapeHTML(value.value.shareWith) + '">' + escapeHTML(value.label) + ' (' +
nav.escapeHtml(value.value.shareWith) + '">' + nav.escapeHtml(value.label) + ' (' +
details + ')</div>');
});

Expand All @@ -363,23 +364,23 @@ var elements = {
$.each(partial, function(index, value) {

var currSearch = elements.addMember.val().trim();
var line = escapeHTML(value.label);
var line = nav.escapeHtml(value.label);

if (source === 'groups') {
if (currSearch.length > 0) {
line = line.replace(new RegExp('(' + currSearch + ')', 'gi'), '<b>$1</b>');
}
line += ' (group)';
} else {
line += ' (' + escapeHTML(value.value.shareWith) + ')';
line += ' (' + nav.escapeHtml(value.value.shareWith) + ')';
if (currSearch.length > 0) {
line = line.replace(new RegExp('(' + currSearch + ')', 'gi'), '<b>$1</b>');
}
}

elements.membersSearchResult.append(
'<div class="members_search" source="' + source + '" searchresult="' +
escapeHTML(value.value.shareWith) + '">' + line + '</div>');
nav.escapeHtml(value.value.shareWith) + '">' + line + '</div>');
});
},

Expand All @@ -395,8 +396,8 @@ var elements = {
$.each(exact, function(index, value) {
elements.groupsSearchResult.append(
'<div class="groups_search exact" searchresult="' +
escapeHTML(value.value.shareWith) + '">' + escapeHTML(value.label) + ' (' +
escapeHTML(value.value.shareWith) + ')</div>');
nav.escapeHtml(value.value.shareWith) + '">' + nav.escapeHtml(value.label) + ' (' +
nav.escapeHtml(value.value.shareWith) + ')</div>');
});

},
Expand All @@ -406,14 +407,14 @@ var elements = {
$.each(partial, function(index, value) {

var currSearch = elements.addMember.val().trim();
var line = escapeHTML(value.label) + ' (' + escapeHTML(value.value.shareWith) + ')';
var line = nav.escapeHtml(value.label) + ' (' + nav.escapeHtml(value.value.shareWith) + ')';
if (currSearch.length > 0) {
line = line.replace(new RegExp('(' + currSearch + ')', 'gi'), '<b>$1</b>');
}

elements.groupsSearchResult.append(
'<div class="groups_search" searchresult="' +
escapeHTML(value.value.shareWith) + '">' + line + '</div>');
nav.escapeHtml(value.value.shareWith) + '">' + line + '</div>');
});
},

Expand All @@ -432,12 +433,12 @@ var elements = {
generateTmplCircle: function(entry) {
var tmpl = $('#tmpl_circle').html();

tmpl = tmpl.replace(/%title%/g, escapeHTML(entry.name));
tmpl = tmpl.replace(/%type%/g, t('circles', escapeHTML(entry.type_string)));
tmpl = tmpl.replace(/%owner%/g, escapeHTML(entry.owner.display_name));
tmpl = tmpl.replace(/%status%/g, t('circles', escapeHTML(entry.user.status)));
tmpl = tmpl.replace(/%level_string%/g, t('circles', escapeHTML(entry.user.level_string)));
tmpl = tmpl.replace(/%creation%/g, escapeHTML(entry.creation));
tmpl = tmpl.replace(/%title%/g, nav.escapeHtml(entry.name));
tmpl = tmpl.replace(/%type%/g, t('circles', nav.escapeHtml(entry.type_string)));
tmpl = tmpl.replace(/%owner%/g, nav.escapeHtml(entry.owner.display_name));
tmpl = tmpl.replace(/%status%/g, t('circles', nav.escapeHtml(entry.user.status)));
tmpl = tmpl.replace(/%level_string%/g, t('circles', nav.escapeHtml(entry.user.level_string)));
tmpl = tmpl.replace(/%creation%/g, nav.escapeHtml(entry.creation));

return tmpl;
},
Expand All @@ -446,9 +447,9 @@ var elements = {
generateTmplMember: function(entry) {
var tmpl = $('#tmpl_member').html();

tmpl = tmpl.replace(/%username%/g, escapeHTML(entry.user_id));
tmpl = tmpl.replace(/%instance%/g, escapeHTML(entry.instance));
tmpl = tmpl.replace(/%type%/g, escapeHTML(entry.user_type));
tmpl = tmpl.replace(/%username%/g, nav.escapeHtml(entry.user_id));
tmpl = tmpl.replace(/%instance%/g, nav.escapeHtml(entry.instance));
tmpl = tmpl.replace(/%type%/g, nav.escapeHtml(entry.user_type));

let displayName = entry.display_name;
if (entry.cached_name !== '') {
Expand All @@ -458,11 +459,11 @@ var elements = {
displayName += ' (' + entry.instance + ')';
}

tmpl = tmpl.replace(/%displayname%/g, escapeHTML(displayName));
tmpl = tmpl.replace(/%level%/g, escapeHTML(entry.level));
tmpl = tmpl.replace(/%levelString%/g, escapeHTML(entry.level_string));
tmpl = tmpl.replace(/%status%/g, escapeHTML(entry.status));
tmpl = tmpl.replace(/%joined%/g, escapeHTML(entry.joined));
tmpl = tmpl.replace(/%displayname%/g, nav.escapeHtml(displayName));
tmpl = tmpl.replace(/%level%/g, nav.escapeHtml(entry.level));
tmpl = tmpl.replace(/%levelString%/g, nav.escapeHtml(entry.level_string));
tmpl = tmpl.replace(/%status%/g, nav.escapeHtml(entry.status));
tmpl = tmpl.replace(/%joined%/g, nav.escapeHtml(entry.joined));

return tmpl;
},
Expand All @@ -471,10 +472,10 @@ var elements = {
generateTmplGroup: function(entry) {
var tmpl = $('#tmpl_group').html();

tmpl = tmpl.replace(/%groupid%/g, escapeHTML(entry.user_id));
tmpl = tmpl.replace(/%level%/g, escapeHTML(entry.level));
tmpl = tmpl.replace(/%levelString%/g, escapeHTML(entry.level_string));
// tmpl = tmpl.replace(/%joined%/g, escapeHTML(entry.joined));
tmpl = tmpl.replace(/%groupid%/g, nav.escapeHtml(entry.user_id));
tmpl = tmpl.replace(/%level%/g, nav.escapeHtml(entry.level));
tmpl = tmpl.replace(/%levelString%/g, nav.escapeHtml(entry.level_string));
// tmpl = tmpl.replace(/%joined%/g, nav.escapeHtml(entry.joined));

return tmpl;
},
Expand All @@ -483,11 +484,11 @@ var elements = {
generateTmplLink: function(entry) {
var tmpl = $('#tmpl_link').html();

tmpl = tmpl.replace(/%id%/g, escapeHTML(entry.unique_id));
tmpl = tmpl.replace(/%token%/g, escapeHTML(entry.token));
tmpl = tmpl.replace(/%address%/g, escapeHTML(entry.address));
tmpl = tmpl.replace(/%status%/g, escapeHTML(entry.status));
tmpl = tmpl.replace(/%joined%/g, escapeHTML(entry.creation));
tmpl = tmpl.replace(/%id%/g, nav.escapeHtml(entry.unique_id));
tmpl = tmpl.replace(/%token%/g, nav.escapeHtml(entry.token));
tmpl = tmpl.replace(/%address%/g, nav.escapeHtml(entry.address));
tmpl = tmpl.replace(/%status%/g, nav.escapeHtml(entry.status));
tmpl = tmpl.replace(/%joined%/g, nav.escapeHtml(entry.creation));

return tmpl;
}
Expand Down
55 changes: 53 additions & 2 deletions js/circles.app.navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,58 @@
/** global: api */
/** global: define */



var nav = {

escapeHtml: function(string) {
var str = '' + string
var matchHtmlRegExp = /["'&<>]/
var match = matchHtmlRegExp.exec(str)

if (!match) {
return str
}

var escape
var html = ''
var index = 0
var lastIndex = 0

for (index = match.index; index < str.length; index++) {
switch (str.charCodeAt(index)) {
case 34: // "
escape = '&quot;'
break
case 38: // &
escape = '&amp;'
break
case 39: // '
escape = '&#39;'
break
case 60: // <
escape = '&lt;'
break
case 62: // >
escape = '&gt;'
break
default:
continue
}

if (lastIndex !== index) {
html += str.substring(lastIndex, index)
}

lastIndex = index + 1
html += escape
}

return lastIndex !== index
? html + str.substring(lastIndex, index)
: html
},

initNavigation: function() {
this.initElementsAddMemberNavigation();
this.initElementsLinkCircleNavigation();
Expand Down Expand Up @@ -93,7 +143,8 @@ var nav = {
t('circles', 'Please confirm'),
function(e) {
if (e === true) {
api.addMember(curr.circle, elements.addMember.val(), define.typeGroup, '',
api.addMember(curr.circle, elements.addMember.val(), define.typeGroup,
'',
resultMembers.addMemberResult);
}
});
Expand Down Expand Up @@ -611,7 +662,7 @@ var nav = {
elements.circleDetails.children('#type').text(t('circles', details.type_long_string));
if (details.description !== '') {
elements.circleDesc.html(
escapeHTML(details.description).replace(/\n/g, '&nbsp;<br />')).show(
nav.escapeHtml(details.description).replace(/\n/g, '&nbsp;<br />')).show(
define.animationSpeed);
} else {
elements.circleDesc.text('').hide(define.animationSpeed);
Expand Down
Loading

0 comments on commit d938bbc

Please sign in to comment.