Re: Avoiding folks to link new personas



I think a few points need to be cleared up. Replies inline:

On Fri, 2014-02-07 at 18:25 -0200, Renato Filho wrote:
Hi guys,

I am working on ubuntu phone contact app, and we need a way to prevent
folks to auto link personas.
In the phone application the designers does not want that the contact
get merged automatically because the user can have added the same
e-mail by mistake or the personas are different but have the same
phone number.
And the auto merge can cause confusion for the user.

This problem was considered recently in gnome-contacts. At least for the
case of creating new personas, it’s quite simple to detect if they’ve
been implicitly linked: just connect to the Persona::notify::individual
signal for the new persona and check if there are other personas in the
Individual if it changes (and it’s guaranteed to change if the Persona
gets linked implicitly or explicitly).

Folks links things; it never merges them.

My idea is keep using folks, but turn off the autolink, this way I can
use folks to find the potential matches and link it if the user
explicitly request that.

The problem is that folks does not provide a way to do that today.

That’s because folks was designed explicitly around the concept of
linking personas by their common properties, so it could avoid having to
maintain a big database of contact linking information. Whether that was
the right design choice is a separate question, but fighting the basic
design of libfolks is probably unwise.

I have some ideas that I would like to share with you guys and if
possible I can implement it.

1) Create a property on persona store/backend/individual aggregator:
Create a bool property on the aggregator where you can set  if you
want the auto-link on or off.

The aggregator already has such functionality (controlled by the
FOLKS_DISABLE_LINKING environment variable). If you turn off linking
though, you turn off *all* linking of personas (implicit or explicit).

2) Create a anti link rule:
After create the persona set a anti link rule that block the persona
to get linked with any other.
Eg: Persona.change_anti_links(['*'])

As in my reply to your other e-mail, I think this is a workable
solution.

These are my ideas, I would like to know what do you think about that,
any other idea is welcome.

I really need this functionality, because workaround it doing anti
links after the persona get linked causes a lot of problem and complex
code.

Have you looked at the gnome-contacts code? As I said in my other
e-mail, they implemented this kind of behaviour recently. Although
looking at the git repository, it doesn’t seem to have been committed.
Erick was definitely talking to me about it though.

The basic idea is to connect to Persona::notify::individual just after
the Persona is created. You’ll then be notified if the persona is
implicitly (or explicitly) linked with any other personas, and can add
anti-links as appropriate. In pseudo-Vala, it should be something like:

   new_persona.notify['individual'].connect ((pspec) =>
     {
       var a = this as AntiLinkable;
       a.add_anti_links (this.individual.personas);
     });

    /* If the persona’s been implicitly linked already… */
    var new_a = new_persona as AntiLinkable;
    new_a.add_anti_links (new_persona.individual.personas);

You’d then disconnect this signal handler before explicitly linking the
persona.

Philip

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]