Skip to content

Commit

Permalink
Model Edits 2025-01-09
Browse files Browse the repository at this point in the history
  • Loading branch information
invisig0th committed Jan 9, 2025
1 parent 42eccab commit 6fa0484
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
3 changes: 3 additions & 0 deletions synapse/models/inet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3785,6 +3785,9 @@ def getModelDefs(self):
('replyto', ('inet:service:message', {}), {
'doc': 'The message that this message was sent in reply to. Used for message threading.'}),

('repost', ('inet:service:message', {}), {
'doc': 'The message which this message contains as a repost.'}),

('links', ('array', {'type': 'inet:service:message:link', 'uniq': True, 'sorted': True}), {
'doc': 'An array of links contained within the message.'}),

Expand Down
10 changes: 8 additions & 2 deletions synapse/models/infotech.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,10 +857,12 @@ def getModelDefs(self):
}),

('it:os:ios:idfa', ('it:adid', {}), {
'doc': 'An iOS advertising identification string.'}),
'deprecated': True,
'doc': 'Deprecated. Please use it:adid.'}),

('it:os:android:aaid', ('it:adid', {}), {
'doc': 'An android advertising identification string.'}),
'deprecated': True,
'doc': 'Deprecated. Please use it:adid.'}),

('it:os:android:perm', ('str', {}), {
'doc': 'An android permission string.'}),
Expand Down Expand Up @@ -2094,6 +2096,10 @@ def getModelDefs(self):
)),
('it:prod:soft:taxonomy', {}, ()),
('it:prod:soft', {}, (

('id', ('str', {'strip': True}), {
'doc': 'An ID for the software.'}),

('name', ('it:prod:softname', {}), {
'doc': 'Name of the software.',
}),
Expand Down
11 changes: 7 additions & 4 deletions synapse/models/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,14 @@ def getModelDefs(self):
'doc': 'The most recent known vitals for the contact.',
}),
('name', ('ps:name', {}), {
'doc': 'The person name listed for the contact.',
}),
'doc': 'The person name listed for the contact.'}),

('bio', ('str', {}), {
'doc': 'A brief bio provided for the contact.'}),

('desc', ('str', {}), {
'doc': 'A description of this contact.',
}),
'doc': 'A description of this contact.'}),

('title', ('ou:jobtitle', {}), {
'doc': 'The job/org title listed for this contact.'}),

Expand Down
10 changes: 8 additions & 2 deletions synapse/models/telco.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,14 @@ def getModelDefs(self):

# host specific data
('adid', ('it:adid', {}), {}),
('aaid', ('it:os:android:aaid', {}), {}),
('idfa', ('it:os:ios:idfa', {}), {}),

('aaid', ('it:os:android:aaid', {}), {
'deprecated': True,
'doc': 'Deprecated. Please use :adid.'}),

('idfa', ('it:os:ios:idfa', {}), {
'deprecated': True,
'doc': 'Deprecated. Please use :adid.'}),

# User related data
('name', ('ps:name', {}), {}),
Expand Down
3 changes: 3 additions & 0 deletions synapse/tests/test_model_inet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3242,6 +3242,7 @@ async def test_model_inet_service(self):
:type=chat.group
:group=$devsiden
:public=$lib.false
:repost=*
)
(inet:service:message=(blackout, visi, 1715856900000, vertex, slack)
Expand Down Expand Up @@ -3291,6 +3292,7 @@ async def test_model_inet_service(self):
self.nn(node.get('place'))
self.eq(node.get('place:name'), 'nyc')

self.nn(nodes[0].get('repost'))
self.eq(nodes[0].get('group'), devsgrp.ndef[1])
self.false(nodes[0].get('public'))
self.eq(nodes[0].get('type'), 'chat.group.')
Expand Down Expand Up @@ -3320,6 +3322,7 @@ async def test_model_inet_service(self):
nodes = await core.nodes('inet:service:message:type:taxonomy=chat.channel -> inet:service:message')
self.len(1, nodes)
self.eq(nodes[0].ndef, ('inet:service:message', 'c0d64c559e2f42d57b37b558458c068b'))
self.len(1, await core.nodes('inet:service:message:repost :repost -> inet:service:message'))

q = '''
[ inet:service:resource=(web, api, vertex, slack)
Expand Down
3 changes: 2 additions & 1 deletion synapse/tests/test_model_infotech.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,15 @@ async def test_it_forms_prodsoft(self):
'techniques': teqs,
'url': url0,
}
q = '''[(it:prod:soft=$valu :name=$p.name :type=$p.type :names=$p.names
q = '''[(it:prod:soft=$valu :id="Foo " :name=$p.name :type=$p.type :names=$p.names
:desc=$p.desc :desc:short=$p."desc:short" :author:org=$p."author:org" :author:email=$p."author:email"
:author:acct=$p."author:acct" :author:person=$p."author:person"
:techniques=$p.techniques :url=$p.url )]'''
nodes = await core.nodes(q, opts={'vars': {'valu': prod0, 'p': props}})
self.len(1, nodes)
node = nodes[0]
self.eq(node.ndef, ('it:prod:soft', prod0))
self.eq(node.get('id'), 'Foo')
self.eq(node.get('name'), 'balloon maker')
self.eq(node.get('desc'), "Pennywise's patented balloon blower upper")
self.eq(node.get('desc:short'), 'balloon blower')
Expand Down
2 changes: 2 additions & 0 deletions synapse/tests/test_model_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ async def test_ps_simple(self):
}
opts = {'vars': {'valu': con0, 'p': props}}
q = '''[(ps:contact=$valu
:bio="I am ironman."
:org=$p.org :asof=$p.asof :person=$p.person
:place=$p.place :place:name=$p."place:name" :name=$p.name
:title=$p.title :orgname=$p.orgname :user=$p.user
Expand Down Expand Up @@ -178,6 +179,7 @@ async def test_ps_simple(self):
self.eq(node.get('place'), place)
self.eq(node.get('place:name'), 'the shire')
self.eq(node.get('name'), 'tony stark')
self.eq(node.get('bio'), 'I am ironman.')
self.eq(node.get('title'), 'ceo')
self.eq(node.get('titles'), ('haha', 'hehe'))
self.eq(node.get('orgname'), 'stark industries, inc')
Expand Down

0 comments on commit 6fa0484

Please sign in to comment.