monal-im / Monal

Monal for XMPP (iOS and macOS)
https://monal-im.org
Other
503 stars 104 forks source link

Roster Group - Backend #1224

Closed matthewrfennell closed 3 weeks ago

matthewrfennell commented 4 weeks ago

Implement the backend changes for #121.

I did some verification during debugging on the DB and MLContact.

I think the DB logic is a little complex. I considered writing some automated tests for this part, maybe interacting maybe with a fake DB. But this would take some time to explore and might be overkill. If this is something you'd be interested in me looking into, let me know, I'd be happy to give it a go.

Testing

Receive stanza

RECV Stanza:
<iq id='FC2DF395-1F08-49C3-987C-7308387D292D' to='user1@continuous.nonprod.fennell.dev/Monal-iOS.236ee368' xmlns='jabber:client' type='result'>
  <query xmlns='jabber:iq:roster'>
    …
    <item name='' subscription='both' jid='user2@continuous.nonprod.fennell.dev'>
      <group>Sharks</group>
    </item>
  </query></iq>

DB State after persistence

select bl.buddy_name, bg.*, rg.*
from buddylist bl
join buddy_groups bg on bl.buddy_id = bg.buddy_id
join roster_groups rg on bg.roster_group_id = rg.roster_group_id
buddy_name buddy_id roster_group_id roster_group_id account_id group_name
user2@continuous.nonprod.fennell.dev 73 1 1 2 Sharks

Group added to MLContact

(see _rosterGroups field)

sharks-user