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

Make ContactsStore a public API #6637

Merged
merged 3 commits into from
Dec 11, 2017
Merged

Make ContactsStore a public API #6637

merged 3 commits into from
Dec 11, 2017

Conversation

LEDfan
Copy link
Member

@LEDfan LEDfan commented Sep 25, 2017

This makes the ContactsStore a public API which can be used by apps. As I described here: #5585 (comment) this is needed for e.g. the Chat app to know which users are allowed to Chat with other users.

@LEDfan LEDfan added the 3. to review Waiting for reviews label Sep 25, 2017
@mention-bot
Copy link

@LEDfan, thanks for your PR! By analyzing the history of the files in this pull request, we identified @LukasReschke, @icewind1991 and @rullzer to be potential reviewers.

@@ -52,5 +52,7 @@ function(GenericEvent $event) use ($app) {
$user = \OC::$server->getUserSession()->getUser();
if (!is_null($user)) {
$app->setupContactsProvider($cm, $user->getUID());
} else {
$app->setupSystemContactsProvider($cm);
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is needed when there is no users, e.g on the CLI using the occ command.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Looks good so far, just some minor documentation/code style issues


use OCP\IUser;

interface IContactsStore {
Copy link
Member

Choose a reason for hiding this comment

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

missing @since annotations on both the interface and its methods

*/
public function findOne(IUser $user, $shareType, $shareWith);

}
Copy link
Member

Choose a reason for hiding this comment

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

new line missing

@rullzer rullzer added this to the Nextcloud 13 milestone Sep 27, 2017
@codecov
Copy link

codecov bot commented Oct 1, 2017

Codecov Report

Merging #6637 into master will decrease coverage by <.01%.
The diff coverage is 28.57%.

@@             Coverage Diff              @@
##             master    #6637      +/-   ##
============================================
- Coverage     51.09%   51.09%   -0.01%     
- Complexity    24865    24867       +2     
============================================
  Files          1596     1596              
  Lines         94608    94622      +14     
  Branches       1367     1367              
============================================
+ Hits          48340    48344       +4     
- Misses        46268    46278      +10
Impacted Files Coverage Δ Complexity Δ
...ib/private/Contacts/ContactsMenu/ContactsStore.php 86% <ø> (ø) 41 <0> (ø) ⬇️
apps/dav/lib/AppInfo/Application.php 18.36% <0%> (-0.79%) 15 <1> (+1)
apps/dav/appinfo/app.php 26.66% <0%> (-1.91%) 0 <0> (ø)
apps/dav/lib/CardDAV/ContactsManager.php 85% <100%> (+1.66%) 5 <1> (+1) ⬆️
lib/private/Server.php 81.5% <28.57%> (-0.43%) 133 <0> (ø)
apps/files_trashbin/lib/Trashbin.php 72.28% <0%> (-0.25%) 136% <0%> (ø)
apps/files_trashbin/lib/Expiration.php 91.93% <0%> (+1.61%) 29% <0%> (ø) ⬇️

@LEDfan
Copy link
Member Author

LEDfan commented Oct 1, 2017

@ChristophWurst done

@LEDfan
Copy link
Member Author

LEDfan commented Dec 3, 2017

This is still tagged for NC 13, does this mean it will be merged before 13? I forgot about the featue-freeze to bump this in time...
Thanks!

@MorrisJobke
Copy link
Member

This is still tagged for NC 13, does this mean it will be merged before 13? I forgot about the featue-freeze to bump this in time...
Thanks!

We plan to do the beta2 soon (at least middle of next week, looking at the other open PRs). I would like to have feedback from @rullzer or @ChristophWurst on this one here.

@MorrisJobke MorrisJobke requested a review from rullzer December 8, 2017 15:44
@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 8, 2017
@MorrisJobke
Copy link
Member

And please fix the conflicts ;)

@MorrisJobke MorrisJobke mentioned this pull request Dec 8, 2017
28 tasks
@LEDfan LEDfan force-pushed the contactsstore_public_api branch from 8dbc639 to 3b2e916 Compare December 9, 2017 08:45
@LEDfan
Copy link
Member Author

LEDfan commented Dec 9, 2017

@MorrisJobke I fixed the conflicts.

@LEDfan LEDfan added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 9, 2017
@MorrisJobke
Copy link
Member

@LEDfan Because you added a new PHP class could you dump the autoloader again:

The autoloaders are not up to date
Please run: bash build/autoloaderchecker.sh
And commit the result

@@ -1109,6 +1110,15 @@ public function __construct($webRoot, \OC\Config $config) {
$c->getConfig()
);
});

$this->registerService(\OCP\Contacts\ContactsMenu\IContactsStore::class, function(Server $c) {
Copy link
Member

Choose a reason for hiding this comment

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

Register it as alias with $this->registerAlias(\OCP\Contacts\ContactsMenu\IContactsStore::class, \OC\Contacts\ContactsMenu\ContactsStore); and the DI container will resolve the constructor args automatically. This also prevents the contacts store being instantiated twice.

@LEDfan
Copy link
Member Author

LEDfan commented Dec 10, 2017

@MorrisJobke @ChristophWurst thanks, I updated the PR 😄

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Changes look good

@blizzz
Copy link
Member

blizzz commented Dec 11, 2017

more conflicts @LEDfan

@MorrisJobke MorrisJobke force-pushed the contactsstore_public_api branch from 9bb7f5b to adf7d11 Compare December 11, 2017 16:19
@MorrisJobke
Copy link
Member

Fixed the conflicts in the server container. Nothing crucial.

@MorrisJobke MorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Dec 11, 2017
@MorrisJobke
Copy link
Member

Ah ... and conflicts again in the same file ... let me rebase a last time 🙈

Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
@MorrisJobke MorrisJobke force-pushed the contactsstore_public_api branch from adf7d11 to cecfc28 Compare December 11, 2017 17:19
@rullzer rullzer merged commit 179be8d into master Dec 11, 2017
@rullzer rullzer deleted the contactsstore_public_api branch December 11, 2017 19:04
@ChristophWurst ChristophWurst added 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
Labels
4. to release Ready to be released and/or waiting for tests to finish pending documentation This pull request needs an associated documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants