-
Notifications
You must be signed in to change notification settings - Fork 173
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
allow for regular background updates of avatars from social networks #1722
allow for regular background updates of avatars from social networks #1722
Conversation
8cf1b21
to
64187bd
Compare
Codecov Report
@@ Coverage Diff @@
## master #1722 +/- ##
============================================
- Coverage 35.35% 30.76% -4.59%
- Complexity 101 128 +27
============================================
Files 15 17 +2
Lines 280 377 +97
============================================
+ Hits 99 116 +17
- Misses 181 261 +80
Continue to review full report at Codecov.
|
lib/Service/SocialApiService.php
Outdated
*/ | ||
protected function registerAddressbooks($user, IManager $manager) { | ||
$cm = new ContactsManager($this->davBackend, $this->l10n); | ||
$cm->setupContactsProvider($manager, $user, $this->urlGen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to limit this to active address books owned by a user? i. e. return address books which are
- not system address book
- not shared address book from other user
- not deactivated
Maybe we can enhance the IManager or IAddressBook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @georgehrke what do you think? Does it make sense to add filters to the IAddressBook interface?
lib/Service/SocialApiService.php
Outdated
|
||
// get contacts in that addressbook | ||
$contacts = $addressBook->search('', ['UID'], ['types' => true]); | ||
// TODO: filter for contacts with social profiles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be optimized with $addressBook->search('', ['X-SOCIALPROFILE'], ['types' => true]);
, if X-SOCIALPROFILE
was indexed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be optimized with
$addressBook->search('', ['X-SOCIALPROFILE'], ['types' => true]);
, ifX-SOCIALPROFILE
was indexed
Mind to add this? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's not indexed (for older version) does it still works? Is the searched value just ignored?
If so it's ok I guess :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I have included this and added a fallback for older server versions.
But concerning the indexer, I could not find out how to add the Edit: worked after running cron to update the index.X-SOCIALPROFILE
. Simply adding it to the linked array did not have any effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request created: nextcloud/server#22085
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out it was not cron, but me refreshing the profiles and triggering a re-index by that - it only works for new or modified contacts! We'll need a background job to re-index all contacts when a user activates this function. @skjnldsv or is there a better way / place to do that? We could, of course, also just ignore this and activate the optimization in a later release - hoping that contacts have been refreshed between the extension of the indexed fields and the moment we start to filter for that.
d64317c
to
efd993d
Compare
df55f34
to
73691e4
Compare
d6555f3
to
fdacb31
Compare
36b5abf
to
c87cfbc
Compare
required in order to optimize regular background updates of contact avatars from social networks (see nextcloud/contacts#1722 (comment))
f75d37b
to
4f3a2a3
Compare
4c32f71
to
e0bf1fc
Compare
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
e0bf1fc
to
973c288
Compare
Ups, I'm sorry. That was an accident. |
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
…ddressBook This allows to just UPDATE the card row instead of deleting it and reinsert it. It's very similar to #30120 for calendars. As we need the addressbookid exposed, this introduces OCA\DAV\CardDAV\Card that extends Sabre's. I chose specifically NOT to auto-inject LoggerInterface in Addressbook like in #30120 because the chain of DI is huge just for ONE simple call and it would break an existing dirty call (OCA\Contacts calling OCA\DAV) of ContactsManager in Contacts: nextcloud/contacts#1722 (in SocialApiService), but this is debatable. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
implements #1594