Skip to content

Full implement group display names - #8255

Merged
blizzz merged 17 commits into
masterfrom
bugfix/noid/group-display-name
Mar 15, 2018
Merged

Full implement group display names#8255
blizzz merged 17 commits into
masterfrom
bugfix/noid/group-display-name

Conversation

@nickvergessen

@nickvergessennickvergessen commented Feb 8, 2018

Copy link
Copy Markdown
Member
  • Personal settings show group id instead of display names in list
  • Activities use group id instead of display names
  • Select2 in the WorkflowEngine shows the id on load, dropdown and selecting new values works
  • Select2 in the OC.Settings.setupGroupsSelect shows the id on load, dropdown and selecting new values works
  • User management: user group and subadmin selection is messed up
  • Tests

Need someone with better JS/select2 skills to solve this.

Good patch for testing

diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php
index 6795f0e2f5..24e8a7ad00 100644
--- a/lib/private/Group/Group.php+++ b/lib/private/Group/Group.php@@ -87,9 +87,9 @@ class Group implements IGroup {
public function getDisplayName() {
if (is_null($this->displayName)) {
- return $this->gid;+ return 'DisplayName{' . $this->gid . '}';
}
- return $this->displayName;+ return 'DisplayName{' . $this->displayName . '}';
}
/**

Fixes#742

@nickvergessen

Copy link
Copy Markdown
MemberAuthor

@nextcloud/javascript who could help?

@MorrisJobke

Copy link
Copy Markdown
Member

@nextcloud/javascript who could help?

maybe @danxuliu or @skjnldsv

@skjnldsvskjnldsv self-assigned this Mar 2, 2018
@codecov

codecovBot commented Mar 2, 2018

Copy link
Copy Markdown

Codecov Report

Merging #8255 into master will decrease coverage by 16.87%.
The diff coverage is 4.91%.

@@ Coverage Diff @@## master #8255 +/- ##
=============================================
- Coverage 51.87% 34.99% -16.88% + Complexity 25422 25376 -46 
=============================================
Files 1609 1607 -2 Lines 95343 95159 -184 Branches 1378 1378 =============================================
- Hits 49455 33297 -16158 - Misses 45888 61862 +15974
Impacted FilesCoverage ΔComplexity Δ
settings/templates/users/part.grouplist.php0% <ø> (ø)0 <0> (ø)⬇️
apps/dav/lib/CalDAV/Activity/Provider/Base.php0% <0%> (-76.79%)19 <7> (+3)
apps/dav/lib/CalDAV/Activity/Provider/Calendar.php0% <0%> (ø)65 <1> (ø)⬇️
settings/templates/users/main.php0% <0%> (ø)0 <0> (ø)⬇️
lib/private/Group/MetaData.php0% <0%> (-77.03%)19 <0> (ø)
apps/dav/lib/CalDAV/Activity/Provider/Event.php0% <0%> (ø)25 <1> (ø)⬇️
lib/private/SubAdmin.php21.31% <0%> (-74.49%)27 <1> (+1)
settings/Controller/GroupsController.php10% <0%> (-54.62%)9 <0> (ø)
lib/private/Settings/Personal/PersonalInfo.php0% <0%> (ø)30 <0> (ø)⬇️
...ps/files_sharing/lib/Activity/Providers/Groups.php0% <0%> (ø)22 <5> (+5)⬆️
... and 559 more

@skjnldsv

Copy link
Copy Markdown
Member

Select2 issue is a big one!
Basically, since we store only the value of the select (aka groupid) and considering the fact that we only retrieve the groups data onclick on the select, the default text can't be anything else than the group id.
One solution would be to create the select as html with all of its options and apply select2 directly on it. I didn't test it, but it should work

@skjnldsv

Copy link
Copy Markdown
Member

I'll change my view! I tried a different approach where I fetch the groups on page load only (no need to fetch them on each select2 click).
So I added on handlebar Views an ajax requests that get all the groups and cache them.
Then re-render the full select2. It works perfectly! :)

It quickly displays the id for a short moment, the time to requests the groups, then update itself with the proper displayName!

@skjnldsv
skjnldsvforce-pushed the bugfix/noid/group-display-name branch from a76d28e to 2be5980CompareMarch 2, 2018 17:21
@skjnldsv

skjnldsv commented Mar 3, 2018

Copy link
Copy Markdown
Member

I could use a hand on tests fixing for the last tests please @nickvergessen :)

All tests fixed

@skjnldsv

Copy link
Copy Markdown
Member

Test passes, failure unrelated :)

Please review

@skjnldsvskjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 5, 2018
Comment threadapps/workflowengine/js/admin.js Outdated
}).done(function(response) {
// add admin groups
$.each(response.data.adminGroups, function(id, group) {
self.groups.push({ id: group.id, displayname: group.name+'FIXME' });

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still broken

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, here it works, just need to remove the FIXME

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahaha oups! 🙈

Comment threadapps/workflowengine/js/admin.js Outdated
});
// add groups
$.each(response.data.groups, function(id, group) {
self.groups.push({ id: group.id, displayname: group.name+'FIXME' });

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still broken

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, here it works, just need to remove the FIXME

Comment threadsettings/js/settings.js Outdated
id: groupName,
displayname: groupName
id: groupId,
displayname: groupId + 'FIXME' // FIXME

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still broken (test with "exclude group from sharing")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In file access control or workflow?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AH okay, I see. I did not see it was there :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in admin> sharing>

bildschirmfoto von 2018-03-05 13-07-20

@nickvergessen

nickvergessen commented Mar 5, 2018

Copy link
Copy Markdown
MemberAuthor
  • Creating a new user and also adding them to a group (while creating the user) is broken, send data for groups is corrupted...
email | groups[ug-test][displayName] | DisplayName{ug-test}
password | 12346
username | test2e3e

Fixed with 3a9297e

),
Http::STATUS_CREATED
);
$group = $this->groupManager->createGroup($id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's not method to set the group name? not needed?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No not needed atm

if (groupId && groups.length > 0) {
callback({
id: groupId,
displayname: groups.find(group =>group.id === groupId).displayname

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, this is ES6, I'm not sure IE11 supports it 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not do this yet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@skjnldsv

skjnldsv commented Mar 5, 2018

Copy link
Copy Markdown
Member
  • search not working anymore

@oparozoparoz removed the high label Mar 6, 2018
@MorrisJobkeMorrisJobke mentioned this pull request Mar 6, 2018
@rullzer

Copy link
Copy Markdown
Member

@skjnldsv#8255 (comment)

So I added on handlebar Views an ajax requests that get all the groups and cache them.

does this scale? Like even when you are on ldap and there are a few thousand groups?

@skjnldsv

Copy link
Copy Markdown
Member

@rullzer I have no idea! The request was made anyway, I just did it before loading the select2 instead of after initialising it :)

@skjnldsv

skjnldsv commented Mar 8, 2018

Copy link
Copy Markdown
Member

Failure related:

Scenario: Getting subadmin groups # /drone/src/github.com/nextcloud/server/build/integration/features/provisioning-v1.feature:252
Given As an "admin" # FeatureContext::asAn()
[Wed Mar 7 09:44:38 2018] 127.0.0.1:53098 [200]: /ocs/v2.php/cloud/users/brand-new-user
[Wed Mar 7 09:44:38 2018] 127.0.0.1:53108 [200]: /ocs/v2.php/cloud/users/brand-new-user
And user "brand-new-user" exists # FeatureContext::assureUserExists()
[Wed Mar 7 09:44:38 2018] 127.0.0.1:53110 [200]: /ocs/v2.php/cloud/groups/new-group
[Wed Mar 7 09:44:38 2018] 127.0.0.1:53114 [200]: /ocs/v2.php/cloud/groups/new-group
And group "new-group" exists # FeatureContext::assureGroupExists()
[Wed Mar 7 09:44:38 2018] 127.0.0.1:53122 [200]: /ocs/v1.php/cloud/users/brand-new-user/subadmins
When sending "GET" to "/cloud/users/brand-new-user/subadmins" # FeatureContext::sendingTo()
Then subadmin groups returned are # FeatureContext::theSubadminGroupsShouldBe()
| new-group |
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
- 0 => 'new-group'
)

EDIT: FIXED! 🚀

@skjnldsvskjnldsv added 3. to review Waiting for reviews and removed 3. to review Waiting for reviews 2. developing Work in progress labels Mar 8, 2018
nickvergessenand others added 17 commits March 8, 2018 17:13
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv
skjnldsvforce-pushed the bugfix/noid/group-display-name branch from 4a2818b to 23a1553CompareMarch 8, 2018 16:13
@skjnldsv

Copy link
Copy Markdown
Member

Failure unrelated: swift

@nickvergessen

Copy link
Copy Markdown
MemberAuthor

Backported the user facing stuff in #8779

@blizzzblizzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

External storages shows group id, i'm okay if this gets adjusted in a follow up PR though.

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do this and fix other occurences when we find them

@blizzz
blizzz merged commit 208e38e into masterMar 15, 2018
@blizzz
blizzz deleted the bugfix/noid/group-display-name branch March 15, 2018 11:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@nickvergessen@MorrisJobke@skjnldsv@rullzer@blizzz@oparoz