After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 642493 - Folks needs API for specifying a contact's organisation
Folks needs API for specifying a contact's organisation
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: libfolks
git master
Other Linux
: Normal normal
: folks-0.4.0
Assigned To: folks-maint
folks-maint
Depends on: 642513
Blocks:
 
 
Reported: 2011-02-16 19:07 UTC by Travis Reitter
Modified: 2011-03-03 00:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add RoleOwner interface (5.81 KB, patch)
2011-03-01 19:11 UTC, Raul Gutierrez Segales
needs-work Details | Review
list the implemented interfaces in alphabetical order for claritiy (813 bytes, patch)
2011-03-01 19:51 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review
Add RoleOwner interface (5.61 KB, patch)
2011-03-01 20:18 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review
Add RoleOwner interface (6.16 KB, patch)
2011-03-02 11:45 UTC, Raul Gutierrez Segales
none Details | Review
Add RoleOwner interface (6.44 KB, patch)
2011-03-02 14:05 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review
Add RoleOwner interface (6.44 KB, patch)
2011-03-02 17:09 UTC, Raul Gutierrez Segales
none Details | Review
Add RoleOwner interface (6.44 KB, patch)
2011-03-02 17:09 UTC, Raul Gutierrez Segales
none Details | Review

Description Travis Reitter 2011-02-16 19:07:42 UTC
We should probably start with a trivial interface like

namespace Folks
{
interface OrganisationOwner :
{
    public string name { get; set; }
}
}

and have Individual and each of the backends' Persona implementations implement it.

We'll add more fields later if necessary (following the YAGNI principle).
Comment 1 Raul Gutierrez Segales 2011-03-01 19:11:55 UTC
Created attachment 182201 [details] [review]
Add RoleOwner interface 

The RoleOwner interface allows each Individual to have various roles (coming from one or many personas) attached. 

Each Role is represented by the Role class that exposes the organisation's name (to which the role is associated) along with the name of the role.
Comment 2 Travis Reitter 2011-03-01 19:32:40 UTC
Review of attachment 182201 [details] [review]:

individual.vala
===================

-    Urlable
+    Urlable,
+    RoleOwner

This should be in alphabetical order instead


+                      var r2 = r.dup ();
+                      roles.add ((owned) r2);

We shouldn't need the dup() function. Since Role is an object, Vala will automatically ref and unref as needed (and we won't need to do expensive string copies).


role-owner.vala
===================

+ * @since 0.3.7

Change the instances of these to @since 0.3.UNRELEASED, and we'll update them all at once just before release.

+  /**
+   * Compare if 2 roles are equal
+   */
+  public static bool equal (Role a, Role b)
+    {
+      return a.role == b.role &&
+          a.organisation_name == b.organisation_name;
+    }

Use some () to make the grouping more obvious

+  /**
+   * The name of held.
+   */

Should be something like "Name of the position held".

+  public string role { get; set; }
+

This should probably be "title", just to be distinct from the name of the class.

+  public Role dup ()
+    {
+      var ret = new Role ();
+      ret.role = this.role;
+      ret.organisation_name = this.organisation_name;
+      return ret;
+    }

This is unnecessary and expensive, for the reasons explained above.
Comment 3 Raul Gutierrez Segales 2011-03-01 19:51:42 UTC
Created attachment 182207 [details] [review]
list the implemented interfaces in alphabetical order for claritiy

I am keeping this separately for clarity.
Comment 4 Raul Gutierrez Segales 2011-03-01 20:18:22 UTC
Created attachment 182208 [details] [review]
Add RoleOwner interface
Comment 5 Travis Reitter 2011-03-01 20:29:36 UTC
Review of attachment 182207 [details] [review]:

Looks good
Comment 6 Travis Reitter 2011-03-01 20:29:53 UTC
Review of attachment 182208 [details] [review]:

Looks good
Comment 7 Raul Gutierrez Segales 2011-03-02 11:45:14 UTC
Created attachment 182241 [details] [review]
Add RoleOwner interface

Added a default constructor to the Role class.
Comment 8 Raul Gutierrez Segales 2011-03-02 14:05:09 UTC
Created attachment 182254 [details] [review]
Add RoleOwner interface

Added the uid field that might be handy for some cases.
Comment 9 Travis Reitter 2011-03-02 15:24:18 UTC
Review of attachment 182254 [details] [review]:

Looks good. Please merge.
Comment 10 Raul Gutierrez Segales 2011-03-02 16:59:55 UTC
I have no credentials for the canonical repo.
Comment 11 Raul Gutierrez Segales 2011-03-02 17:09:18 UTC
Created attachment 182274 [details] [review]
Add RoleOwner interface

Corrected small typo in a comment.
Comment 12 Raul Gutierrez Segales 2011-03-02 17:09:39 UTC
Created attachment 182275 [details] [review]
Add RoleOwner interface
Comment 13 Travis Reitter 2011-03-03 00:11:05 UTC
Thanks! Merged:

commit 4c09f5839fd9f93400a7d03cd8a18e430395b7d8
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Wed Mar 2 16:10:27 2011 -0800

    Update NEWS for RoleOwner.

 NEWS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

commit a292acae512f76932e2ae95cd143df89e3e27ecd
Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
Date:   Tue Mar 1 19:09:14 2011 +0000

    Add RoleOwner interface for contacts that belong to an Organisation

 folks/Makefile.am     |    1 +
 folks/individual.vala |   47 ++++++++++++++++++++
 folks/role-owner.vala |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 0 deletions(-)

commit e23104201cc9a4d49a5198ae7a2b12953cb1055f
Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
Date:   Tue Mar 1 19:49:45 2011 +0000

    List the implemented interfaces in alphabetical order

 folks/individual.vala |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)