Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contacts menu #3233

Merged
merged 15 commits into from
Apr 25, 2017
Merged

Contacts menu #3233

merged 15 commits into from
Apr 25, 2017

Conversation

ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Jan 24, 2017

Rough todo list:

  • client-side
    • display actions listed by the API
    • lazy loading not necessary if number of elements is limited to 25.
    • link to contacts app
    • search
      • show input
      • query and show results from server
  • server-side

implements #207


Current screenshot:
bildschirmfoto von 2017-03-06 15-46-58

@ChristophWurst
Copy link
Member Author

Dang it. I've lost my most recent changes due to a rebase+force push of an outdated version of the branch 😠

@ChristophWurst
Copy link
Member Author

Dang it. I've lost my most recent changes due to a rebase+force push of an outdated version of the branch 😠

Got them back from my other PC 💪 😌

'message' => "Could not load contacts menu action provider $class",
'app' => 'core',
]);
throw new \Exception("Could not load contacts menu action provider $class");
Copy link
Member

Choose a reason for hiding this comment

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

Don't throw $class to avoid input injection. You log the class, that's fine enough

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense!

@@ -163,5 +170,14 @@
<?php print_unescaped($_['content']); ?>
</div>
</div>

<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
Copy link
Member

Choose a reason for hiding this comment

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

Doing this here has some security implications as a XSS in $_['content'] may be able to extract this by using an <img> tag etc.

Can we move that to a dedicated script of before the content? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure we can. I just wanted to do it inline for performance reasons as we'd save one request per page load.

Copy link
Member

Choose a reason for hiding this comment

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

IMHO better solved by making sure we concatenate all JS files that we deliver anyways on nearly every page load :)

@ChristophWurst
Copy link
Member Author

1) Tests\Contacts\ContactsMenu\EntryTest::testAddAndSortAction
usort(): Array was modified by the user comparison function
/drone/src/github.com/nextcloud/server/lib/private/Contacts/ContactsMenu/Entry.php:105
/drone/src/github.com/nextcloud/server/lib/private/Contacts/ContactsMenu/Entry.php:87
/drone/src/github.com/nextcloud/server/tests/lib/Contacts/ContactsMenu/EntryTest.php:112

php5.6+usort+phpunit mocks = 💩

@ChristophWurst
Copy link
Member Author

Alright, this has already gotten bigger than I wanted it to be for the first PR. Let's do the more advanced stuff in follow-up PRs:

  • Avatar from the contacts app
  • App action provider plugin system
  • Last interaction

@ChristophWurst
Copy link
Member Author

@nextcloud/designers I need some help with styling the different elements:
bildschirmfoto von 2017-02-20 22-04-21

Should the inner popover menu overlap the scrollbar or should it only be visible inside the menu?

@skjnldsv do you know if I have to/should tweak the css to get the popover menu positioned right or are there any server classes I have to use or guidelines I have to follow? :-)

@skjnldsv
Copy link
Member

@ChristophWurst #2798

@ChristophWurst ChristophWurst mentioned this pull request Feb 21, 2017
1 task
@skjnldsv
Copy link
Member

Just want to say that it looks damn good! 🦀

@skjnldsv
Copy link
Member

skjnldsv commented Feb 21, 2017

By the way the other menu on the header don't use a popovermenu.
The yours looks a bit out of place compared to the others :)

@skjnldsv
Copy link
Member

try to comply with the css guidelines

😂
I will try to help on this after my work :)

@jancborchardt
Copy link
Member

jancborchardt commented Feb 21, 2017

Heya, answering some of your questions @ChristophWurst

Should the inner popover menu overlap the scrollbar or should it only be visible inside the menu?

  • It’s fine to overlap the scrollbar, it’s a level over the inner menu. It should also be above the scrollable area because when you open the menu on an entry down at the end it should show properly and not expand inside the scrollable area. If it’s too difficult then for the first iteration we could have it show inside. But we should have some smooth autoscrolling going on maybe which scrolls the menu in view. Not perfect though so it’s preferable to show the menu outside of the container.

@skjnldsv: By the way the other menu on the header don't use a popovermenu.

  • Yup, we need to adjust the detail positioning here. No space between header and menu, and remove border-radius on the top corners. :)

  • The icon needs to be also available in white, depending on theme. cc @juliushaertl

  • The max-height of the popover should be exactly n+1/2 of an entry, so you see when there’s more. Maybe 4 1/2 is best?

  • On scrolling down, new contacts should be loaded automatically via lazy loading. For the future when you have chats with all these folks I think it’s fine to just have all of it in there without a shortlink to Contacts. You will be able to use search anyway.

Anything else? I guess lots is for a follow-up PR anyway. :)

@MorrisJobke
Copy link
Member

I fixed the icon color and it now looks a lot nicer:

bildschirmfoto 2017-02-21 um 18 15 33

@MariusBluem
Copy link
Member

@MorrisJobke Better, but should the item indicate about whether it is opened or not (a bit more grey or something...) 🤔 @jancborchardt

@codecov-io
Copy link

codecov-io commented Feb 22, 2017

Codecov Report

Merging #3233 into master will increase coverage by 0.13%.
The diff coverage is 90.85%.

@@             Coverage Diff              @@
##             master    #3233      +/-   ##
============================================
+ Coverage      54.1%   54.23%   +0.13%     
- Complexity    21716    21774      +58     
============================================
  Files          1334     1343       +9     
  Lines         83213    83528     +315     
  Branches       1315     1327      +12     
============================================
+ Hits          45025    45305     +280     
- Misses        38188    38223      +35
Impacted Files Coverage Δ Complexity Δ
core/routes.php 0% <0%> (ø) 0 <0> (ø) ⬇️
core/templates/layout.user.php 0% <0%> (ø) 0 <0> (ø) ⬇️
core/js/js.js 61.21% <100%> (-0.44%) 0 <0> (ø)
lib/private/legacy/template.php 30.82% <100%> (+0.47%) 36 <0> (ø) ⬇️
...ib/private/Contacts/ContactsMenu/ActionFactory.php 100% <100%> (ø) 2 <2> (?)
core/Controller/ContactsMenuController.php 100% <100%> (ø) 2 <2> (?)
lib/private/Server.php 93.32% <100%> (+0.01%) 120 <0> (ø) ⬇️
.../Contacts/ContactsMenu/Providers/EMailProvider.php 100% <100%> (ø) 3 <3> (?)
...vate/Contacts/ContactsMenu/ActionProviderStore.php 87.5% <87.5%> (ø) 9 <9> (?)
...ivate/Contacts/ContactsMenu/Actions/LinkAction.php 90% <90%> (ø) 8 <8> (?)
... and 18 more

@skjnldsv
Copy link
Member

Disagree @MariusBluem . We have the triangle indicator, that's enough I think :)

return [
'contacts' => $topEntries,
'contactsAppEnabled' => $contactsEnabled,
'contactsAppURL' => $contactsURL,
Copy link
Member

Choose a reason for hiding this comment

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

Will generate a URL without index.php for me which breaks. You should either link to the route directly, or always prepend /index.php/ or just use the JS OC.generateUrl('/apps/contacts'); which should take care of that.

In this scenario I'd probably vote for the JS approach.

ChristophWurst and others added 10 commits April 25, 2017 20:47
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
When we test wheter action menus in the contacts menu close
when clicking other ones, we have to provide test data
that actually causes the view to render the menu.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
We do not want to have sensitive information in the URL and
therefore also not in the access log. Thus the GET request is
replaced by a POST request.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
@ChristophWurst
Copy link
Member Author

Rebased. Thanks for testing, @jospoortvliet! :)

@jospoortvliet
Copy link
Member

jospoortvliet commented Apr 25, 2017

Tested your rebased version, works too.
spectacle w25913

Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
@jancborchardt
Copy link
Member

So I

  • fixed the test (which was failing due to a text change I made)
  • fixed merge conflicts in PHP files

I think it goes without saying this should be double-checked. 😂

Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
@ChristophWurst
Copy link
Member Author

@ChristophWurst please document the API in the dev manual

@ChristophWurst
Copy link
Member Author

@ChristophWurst please document the API in the dev manual

nextcloud/documentation#11222

@ChristophWurst ChristophWurst removed the pending documentation This pull request needs an associated documentation update label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.