Release 0.1.45: member phone locations and people-first family navigation

This commit is contained in:
Codex
2026-10-18 21:26:12 +08:00
parent 3b2c046060
commit fdb239b3ed
47 changed files with 914 additions and 287 deletions
+36
View File
@@ -55,6 +55,42 @@ class MemberTests(unittest.TestCase):
app.ACCOUNTS.save(dict(account, password='attempt-change'), actor)
self.assertEqual(error.exception.status, 403)
def test_people_directory_needs_no_hardware_and_links_historical_experience(self):
member = app.MEMBERS.save(self.owner, dict(name='无账号长辈'))
app.MEMBERS.save(self.owner, dict(member, status='historical'))
with app.DB:
for table in ('cameras', 'assets', 'recorders', 'devices', 'sites'):
app.DB.execute('DELETE FROM ' + table)
tree = app.MEMBERS.directory(self.owner)['trees'][0]
person = tree['branches'][0]['people'][0]
self.assertEqual(tree['familyId'], self.aid)
self.assertEqual(person['id'], member['personId'])
self.assertFalse(person['self'])
self.assertEqual(person['homes'], [])
self.assertEqual([h['id'] for h in person['journalHomes']], [self.aid])
self.assertFalse(app.MEMBERS.snapshot(self.owner)['items'][0]['hasAccount'])
def test_directory_profile_context_requires_genealogy_access_and_marks_self(self):
member = app.MEMBERS.save(self.owner, dict(name='跨家庭亲人'))
app.MEMBERS.share_genealogy(self.root, dict(targetFamilyId=self.bid, confirm=True))
app.MEMBERS.save(self.other, dict(personId=member['personId']))
account = app.ACCOUNTS.save(dict(self.members[self.aid], personId=member['personId'], familyAccess='none'), self.root)
app.ACCOUNTS.grant_household(self.root, dict(userId=account['id'], familyId=self.bid, role='member', familyAccess='read'))
actor = app.get_object('users', account['id'])
tree = app.MEMBERS.directory(actor)['trees'][0]
self.assertEqual(tree['familyId'], self.bid)
person = tree['branches'][0]['people'][0]
self.assertTrue(person['self'])
self.assertEqual({h['id'] for h in person['journalHomes']}, {self.aid, self.bid})
self.assertFalse(app.MEMBERS.snapshot(actor)['canViewGenealogy'])
self.assertTrue(app.MEMBERS.snapshot(app.HOUSEHOLDS.context(actor, self.bid))['canViewGenealogy'])
# Removing the other grant hides its name and all of its history entry points.
app.ACCOUNTS.grant_household(self.root, dict(userId=account['id'], familyId=self.bid, role='none'))
app.ACCOUNTS.save(dict(app.get_object('users', account['id']), familyAccess='read'), self.root)
tree = app.MEMBERS.directory(app.get_object('users', account['id']))['trees'][0]
self.assertEqual(tree['familyId'], self.aid)
self.assertEqual([h['id'] for h in tree['branches'][0]['people'][0]['journalHomes']], [self.aid])
def test_additional_household_leader_promotion_does_not_promote_primary_home(self):
account = self.members[self.aid]
app.ACCOUNTS.grant_household(self.root, dict(userId=account['id'], familyId=self.bid, role='member'))