Skip to content

Commit 0aed3ec

Browse files
authored
Merge pull request #26724 from nextcloud/backport/25417/stable21
2 parents 606b5fe + 43a9879 commit 0aed3ec

12 files changed

Lines changed: 740 additions & 82 deletions

File tree

.drone.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,31 @@ trigger:
11641164
- pull_request
11651165
- push
11661166

1167+
---
1168+
kind: pipeline
1169+
name: integration-contacts-menu
1170+
1171+
steps:
1172+
- name: submodules
1173+
image: docker:git
1174+
commands:
1175+
- git submodule update --init
1176+
- name: integration-contacts-menu
1177+
image: nextcloudci/integration-php7.3:integration-php7.3-2
1178+
commands:
1179+
- bash tests/drone-run-integration-tests.sh || exit 0
1180+
- ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int
1181+
- cd build/integration
1182+
- ./run.sh features/contacts-menu.feature
1183+
1184+
trigger:
1185+
branch:
1186+
- master
1187+
- stable*
1188+
event:
1189+
- pull_request
1190+
- push
1191+
11671192
---
11681193
kind: pipeline
11691194
name: integration-favorites

apps/settings/css/settings.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,16 @@ select {
425425
font-weight: bold;
426426
}
427427
}
428+
429+
&.disabled {
430+
opacity: .5;
431+
432+
cursor: default;
433+
434+
* {
435+
cursor: default;
436+
}
437+
}
428438
}
429439
}
430440
}

apps/settings/js/federationscopemenu.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
className: 'federationScopeMenu popovermenu bubble menu menu-center',
2424
field: undefined,
2525
_scopes: undefined,
26+
_excludedScopes: [],
2627

2728
initialize: function(options) {
2829
this.field = options.field;
@@ -58,9 +59,7 @@
5859
];
5960

6061
if (options.excludedScopes && options.excludedScopes.length) {
61-
this._scopes = this._scopes.filter(function(scopeEntry) {
62-
return options.excludedScopes.indexOf(scopeEntry.name) === -1;
63-
})
62+
this._excludedScopes = options.excludedScopes
6463
}
6564
},
6665

@@ -122,6 +121,17 @@
122121
} else {
123122
this._scopes[i].active = false;
124123
}
124+
125+
var isExcludedScope = this._excludedScopes.includes(this._scopes[i].name)
126+
if (isExcludedScope && !this._scopes[i].active) {
127+
this._scopes[i].hidden = true
128+
} else if (isExcludedScope && this._scopes[i].active) {
129+
this._scopes[i].hidden = false
130+
this._scopes[i].disabled = true
131+
} else {
132+
this._scopes[i].hidden = false
133+
this._scopes[i].disabled = false
134+
}
125135
}
126136

127137
this.render();

apps/settings/js/templates.js

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,65 @@
11
(function() {
22
var template = Handlebars.template, templates = OC.Settings.Templates = OC.Settings.Templates || {};
33
templates['federationscopemenu'] = template({"1":function(container,depth0,helpers,partials,data) {
4+
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
5+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
6+
return parent[propertyName];
7+
}
8+
return undefined
9+
};
10+
11+
return ((stack1 = lookupProperty(helpers,"unless").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"hidden") : depth0),{"name":"unless","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":2},"end":{"line":25,"column":13}}})) != null ? stack1 : "");
12+
},"2":function(container,depth0,helpers,partials,data) {
413
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
514
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
615
return parent[propertyName];
716
}
817
return undefined
918
};
1019

11-
return " <li>\n <a href=\"#\" class=\"menuitem action action-"
12-
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":4,"column":45},"end":{"line":4,"column":53}}}) : helper)))
13-
+ " permanent "
14-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"active") : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":64},"end":{"line":4,"column":91}}})) != null ? stack1 : "")
15-
+ "\" data-action=\""
16-
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":4,"column":106},"end":{"line":4,"column":114}}}) : helper)))
17-
+ "\">\n"
18-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"iconClass") : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data,"loc":{"start":{"line":5,"column":4},"end":{"line":9,"column":11}}})) != null ? stack1 : "")
20+
return " <li>\n"
21+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"disabled") : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.program(6, data, 0),"data":data,"loc":{"start":{"line":5,"column":3},"end":{"line":9,"column":10}}})) != null ? stack1 : "")
22+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"iconClass") : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.program(10, data, 0),"data":data,"loc":{"start":{"line":10,"column":4},"end":{"line":14,"column":11}}})) != null ? stack1 : "")
1923
+ " <p>\n <strong class=\"menuitem-text\">"
20-
+ alias4(((helper = (helper = lookupProperty(helpers,"displayName") || (depth0 != null ? lookupProperty(depth0,"displayName") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"displayName","hash":{},"data":data,"loc":{"start":{"line":11,"column":35},"end":{"line":11,"column":50}}}) : helper)))
24+
+ alias4(((helper = (helper = lookupProperty(helpers,"displayName") || (depth0 != null ? lookupProperty(depth0,"displayName") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"displayName","hash":{},"data":data,"loc":{"start":{"line":16,"column":35},"end":{"line":16,"column":50}}}) : helper)))
2125
+ "</strong><br>\n <span class=\"menuitem-text-detail\">"
22-
+ alias4(((helper = (helper = lookupProperty(helpers,"tooltip") || (depth0 != null ? lookupProperty(depth0,"tooltip") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"tooltip","hash":{},"data":data,"loc":{"start":{"line":12,"column":40},"end":{"line":12,"column":51}}}) : helper)))
23-
+ "</span>\n </p>\n </a>\n </li>\n";
24-
},"2":function(container,depth0,helpers,partials,data) {
25-
return "active";
26+
+ alias4(((helper = (helper = lookupProperty(helpers,"tooltip") || (depth0 != null ? lookupProperty(depth0,"tooltip") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"tooltip","hash":{},"data":data,"loc":{"start":{"line":17,"column":40},"end":{"line":17,"column":51}}}) : helper)))
27+
+ "</span>\n </p>\n"
28+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"disabled") : depth0),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.program(14, data, 0),"data":data,"loc":{"start":{"line":19,"column":3},"end":{"line":23,"column":10}}})) != null ? stack1 : "")
29+
+ " </li>\n";
30+
},"3":function(container,depth0,helpers,partials,data) {
31+
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
32+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
33+
return parent[propertyName];
34+
}
35+
return undefined
36+
};
37+
38+
return " <div class=\"menuitem action action-"
39+
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":6,"column":38},"end":{"line":6,"column":46}}}) : helper)))
40+
+ " permanent "
41+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"active") : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":6,"column":57},"end":{"line":6,"column":84}}})) != null ? stack1 : "")
42+
+ " disabled\" data-action=\""
43+
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":6,"column":108},"end":{"line":6,"column":116}}}) : helper)))
44+
+ "\">\n";
2645
},"4":function(container,depth0,helpers,partials,data) {
46+
return "active";
47+
},"6":function(container,depth0,helpers,partials,data) {
48+
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
49+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
50+
return parent[propertyName];
51+
}
52+
return undefined
53+
};
54+
55+
return " <a href=\"#\" class=\"menuitem action action-"
56+
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":8,"column":45},"end":{"line":8,"column":53}}}) : helper)))
57+
+ " permanent "
58+
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"active") : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":8,"column":64},"end":{"line":8,"column":91}}})) != null ? stack1 : "")
59+
+ "\" data-action=\""
60+
+ alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":8,"column":106},"end":{"line":8,"column":114}}}) : helper)))
61+
+ "\">\n";
62+
},"8":function(container,depth0,helpers,partials,data) {
2763
var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) {
2864
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
2965
return parent[propertyName];
@@ -32,10 +68,14 @@ templates['federationscopemenu'] = template({"1":function(container,depth0,helpe
3268
};
3369

3470
return " <span class=\"icon "
35-
+ container.escapeExpression(((helper = (helper = lookupProperty(helpers,"iconClass") || (depth0 != null ? lookupProperty(depth0,"iconClass") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"iconClass","hash":{},"data":data,"loc":{"start":{"line":6,"column":23},"end":{"line":6,"column":36}}}) : helper)))
71+
+ container.escapeExpression(((helper = (helper = lookupProperty(helpers,"iconClass") || (depth0 != null ? lookupProperty(depth0,"iconClass") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"iconClass","hash":{},"data":data,"loc":{"start":{"line":11,"column":23},"end":{"line":11,"column":36}}}) : helper)))
3672
+ "\"></span>\n";
37-
},"6":function(container,depth0,helpers,partials,data) {
73+
},"10":function(container,depth0,helpers,partials,data) {
3874
return " <span class=\"no-icon\"></span>\n";
75+
},"12":function(container,depth0,helpers,partials,data) {
76+
return " </div>\n";
77+
},"14":function(container,depth0,helpers,partials,data) {
78+
return " </a>\n";
3979
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
4080
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
4181
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -45,7 +85,7 @@ templates['federationscopemenu'] = template({"1":function(container,depth0,helpe
4585
};
4686

4787
return "<ul>\n"
48-
+ ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"items") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":1},"end":{"line":16,"column":10}}})) != null ? stack1 : "")
88+
+ ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"items") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":1},"end":{"line":26,"column":10}}})) != null ? stack1 : "")
4989
+ "</ul>\n";
5090
},"useData":true});
5191
})();

apps/settings/js/templates/federationscopemenu.handlebars

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<ul>
22
{{#each items}}
3+
{{#unless hidden}}
34
<li>
5+
{{#if disabled}}
6+
<div class="menuitem action action-{{name}} permanent {{#if active}}active{{/if}} disabled" data-action="{{name}}">
7+
{{else}}
48
<a href="#" class="menuitem action action-{{name}} permanent {{#if active}}active{{/if}}" data-action="{{name}}">
9+
{{/if}}
510
{{#if iconClass}}
611
<span class="icon {{iconClass}}"></span>
712
{{else}}
@@ -11,7 +16,12 @@
1116
<strong class="menuitem-text">{{displayName}}</strong><br>
1217
<span class="menuitem-text-detail">{{tooltip}}</span>
1318
</p>
19+
{{#if disabled}}
20+
</div>
21+
{{else}}
1422
</a>
23+
{{/if}}
1524
</li>
25+
{{/unless}}
1626
{{/each}}
1727
</ul>

apps/settings/lib/Controller/UsersController.php

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function setUserSettings(?string $avatarScope = null,
380380
);
381381
}
382382

383-
$email = strtolower($email);
383+
$email = !is_null($email) ? strtolower($email) : $email;
384384
if (!empty($email) && !$this->mailer->validateMailAddress($email)) {
385385
return new DataResponse(
386386
[
@@ -395,15 +395,47 @@ public function setUserSettings(?string $avatarScope = null,
395395

396396
$data = $this->accountManager->getUser($user);
397397
$beforeData = $data;
398-
$data[IAccountManager::PROPERTY_AVATAR] = ['scope' => $avatarScope];
398+
if (!is_null($avatarScope)) {
399+
$data[IAccountManager::PROPERTY_AVATAR]['scope'] = $avatarScope;
400+
}
399401
if ($this->config->getSystemValue('allow_user_to_change_display_name', true) !== false) {
400-
$data[IAccountManager::PROPERTY_DISPLAYNAME] = ['value' => $displayname, 'scope' => $displaynameScope];
401-
$data[IAccountManager::PROPERTY_EMAIL] = ['value' => $email, 'scope' => $emailScope];
402+
if (!is_null($displayname)) {
403+
$data[IAccountManager::PROPERTY_DISPLAYNAME]['value'] = $displayname;
404+
}
405+
if (!is_null($displaynameScope)) {
406+
$data[IAccountManager::PROPERTY_DISPLAYNAME]['scope'] = $displaynameScope;
407+
}
408+
if (!is_null($email)) {
409+
$data[IAccountManager::PROPERTY_EMAIL]['value'] = $email;
410+
}
411+
if (!is_null($emailScope)) {
412+
$data[IAccountManager::PROPERTY_EMAIL]['scope'] = $emailScope;
413+
}
414+
}
415+
if (!is_null($website)) {
416+
$data[IAccountManager::PROPERTY_WEBSITE]['value'] = $website;
417+
}
418+
if (!is_null($websiteScope)) {
419+
$data[IAccountManager::PROPERTY_WEBSITE]['scope'] = $websiteScope;
420+
}
421+
if (!is_null($address)) {
422+
$data[IAccountManager::PROPERTY_ADDRESS]['value'] = $address;
423+
}
424+
if (!is_null($addressScope)) {
425+
$data[IAccountManager::PROPERTY_ADDRESS]['scope'] = $addressScope;
426+
}
427+
if (!is_null($phone)) {
428+
$data[IAccountManager::PROPERTY_PHONE]['value'] = $phone;
429+
}
430+
if (!is_null($phoneScope)) {
431+
$data[IAccountManager::PROPERTY_PHONE]['scope'] = $phoneScope;
432+
}
433+
if (!is_null($twitter)) {
434+
$data[IAccountManager::PROPERTY_TWITTER]['value'] = $twitter;
435+
}
436+
if (!is_null($twitterScope)) {
437+
$data[IAccountManager::PROPERTY_TWITTER]['scope'] = $twitterScope;
402438
}
403-
$data[IAccountManager::PROPERTY_WEBSITE] = ['value' => $website, 'scope' => $websiteScope];
404-
$data[IAccountManager::PROPERTY_ADDRESS] = ['value' => $address, 'scope' => $addressScope];
405-
$data[IAccountManager::PROPERTY_PHONE] = ['value' => $phone, 'scope' => $phoneScope];
406-
$data[IAccountManager::PROPERTY_TWITTER] = ['value' => $twitter, 'scope' => $twitterScope];
407439

408440
try {
409441
$data = $this->saveUserSettings($user, $data);
@@ -526,14 +558,14 @@ public function getVerificationCode(string $account, bool $onlyVerificationCode)
526558

527559
switch ($account) {
528560
case 'verify-twitter':
529-
$accountData[IAccountManager::PROPERTY_TWITTER]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS;
561+
$accountData[IAccountManager::PROPERTY_TWITTER]['verified'] = IAccountManager::VERIFICATION_IN_PROGRESS;
530562
$msg = $this->l10n->t('In order to verify your Twitter account, post the following tweet on Twitter (please make sure to post it without any line breaks):');
531563
$code = $codeMd5;
532564
$type = IAccountManager::PROPERTY_TWITTER;
533565
$accountData[IAccountManager::PROPERTY_TWITTER]['signature'] = $signature;
534566
break;
535567
case 'verify-website':
536-
$accountData[IAccountManager::PROPERTY_WEBSITE]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS;
568+
$accountData[IAccountManager::PROPERTY_WEBSITE]['verified'] = IAccountManager::VERIFICATION_IN_PROGRESS;
537569
$msg = $this->l10n->t('In order to verify your Website, store the following content in your web-root at \'.well-known/CloudIdVerificationCode.txt\' (please make sure that the complete text is in one line):');
538570
$type = IAccountManager::PROPERTY_WEBSITE;
539571
$accountData[IAccountManager::PROPERTY_WEBSITE]['signature'] = $signature;

apps/settings/templates/settings/personal/personal.info.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@
122122
<?php } ?>
123123
<span class="icon-checkmark hidden"></span>
124124
<span class="icon-error hidden" ></span>
125-
<?php if ($_['lookupServerUploadEnabled']) { ?>
126125
<input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
127-
<?php } ?>
128126
</form>
129127
</div>
130128
<div class="personal-settings-setting-box">
@@ -172,9 +170,7 @@
172170
<?php if ($_['displayNameChangeSupported']) { ?>
173171
<em><?php p($l->t('For password reset and notifications')); ?></em>
174172
<?php } ?>
175-
<?php if ($_['lookupServerUploadEnabled']) { ?>
176-
<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
177-
<?php } ?>
173+
<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
178174
</form>
179175
</div>
180176
<div class="personal-settings-setting-box">

0 commit comments

Comments
 (0)