Page MenuHomePhabricator

[sqlite] implement c++ code to get communities
ClosedPublic

Authored by ginsu on Feb 23 2024, 12:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 1:31 AM
Unknown Object (File)
Mon, Apr 15, 12:23 PM
Unknown Object (File)
Fri, Apr 12, 6:28 AM
Unknown Object (File)
Wed, Apr 10, 9:20 PM
Unknown Object (File)
Wed, Apr 10, 8:39 AM
Unknown Object (File)
Wed, Apr 10, 5:00 AM
Unknown Object (File)
Apr 8 2024, 8:28 PM
Unknown Object (File)
Apr 8 2024, 4:51 AM
Subscribers

Details

Summary

Introduced all the necessary code for native ops for getting communities from the community store

Linear task: https://linear.app/comm/issue/ENG-6533/implement-c-code-to-get-communities

Depends on D11152

Test Plan

In a subsequent diff I will introduce logic to read communities from sqlite on app start and I was able to see that using the c++ code introduced in this diff I was able to get the communities into my redux store

Screenshot 2024-02-23 at 3.25.08 AM.png (1×3 px, 1 MB)

Screenshot 2024-02-23 at 3.25.00 AM.png (1×1 px, 648 KB)

Also called the following code:

const TEST_COMMUNITY_1: CommunityInfo = {
  enabledApps: {
    calendar: false,
    wiki: false,
    tasks: true,
    files: true,
  },
};

const TEST_COMMUNITY_2: CommunityInfo = {
  enabledApps: {
    calendar: true,
    wiki: false,
    tasks: false,
    files: false,
  },
};

let data = await commCoreModule.getClientDBStore();
console.log(data.communities);

await commCoreModule.processCommunityStoreOperations([
  {
    type: 'replace_community',
    payload: {
      id: '1',
      communityInfo: TEST_COMMUNITY_1,
    },
  },
  {
    type: 'replace_community',
    payload: {
      id: '2',
      communityInfo: TEST_COMMUNITY_2,
    },
  },
]);

data = await commCoreModule.getClientDBStore();
console.log(data.communities);

const community2Updated: CommunityInfo = {
  enabledApps: {
    calendar: true,
    wiki: true,
    tasks: true,
    files: true,
  },
};

await commCoreModule.processCommunityStoreOperations([
  {
    type: 'replace_community',
    payload: {
      id: '2',
      communityInfo: community2Updated,
    },
  },
]);

data = await commCoreModule.getClientDBStore();
console.log(data.communities);

await commCoreModule.processCommunityStoreOperations([
  {
    type: 'remove_communities',
    payload: {
      ids: ['1'],
    },
  },
]);

data = await commCoreModule.getClientDBStore();
console.log(data.communities);

await commCoreModule.processCommunityStoreOperations([
  {
    type: 'remove_all_communities',
  },
]);

data = await commCoreModule.getClientDBStore();
console.log(data.communities);

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 23 2024, 12:42 AM
Harbormaster failed remote builds in B27089: Diff 37481!

will make sure ci passes before landing

Same as D11152 - it will be nice to make the testing process more transparent

This revision is now accepted and ready to land.Feb 23 2024, 6:30 AM

it will be nice to make the testing process more transparent

updated test plan

This revision was landed with ongoing or failed builds.Feb 27 2024, 8:02 PM
This revision was automatically updated to reflect the committed changes.