kopia lustrzana https://github.com/snarfed/bridgy-fed
Activity => Object: drop /recent, tweak feed queries, update datastore indices
rodzic
2c3a693b4d
commit
9680f6f83e
31
index.yaml
31
index.yaml
|
@ -6,37 +6,20 @@ indexes:
|
||||||
# index.yaml file manually, remove the "# AUTOGENERATED" marker line above.
|
# index.yaml file manually, remove the "# AUTOGENERATED" marker line above.
|
||||||
# If you want to manage some indexes manually, move them above the marker line.
|
# If you want to manage some indexes manually, move them above the marker line.
|
||||||
|
|
||||||
- kind: Response
|
- kind: Object
|
||||||
properties:
|
properties:
|
||||||
- name: status
|
- name: domains
|
||||||
|
- name: labels
|
||||||
- name: updated
|
- name: updated
|
||||||
|
direction: asc
|
||||||
|
|
||||||
- kind: Response
|
- kind: Object
|
||||||
properties:
|
properties:
|
||||||
- name: status
|
- name: domains
|
||||||
|
- name: labels
|
||||||
- name: updated
|
- name: updated
|
||||||
direction: desc
|
direction: desc
|
||||||
|
|
||||||
- kind: Response
|
|
||||||
properties:
|
|
||||||
- name: domain
|
|
||||||
- name: status
|
|
||||||
- name: updated
|
|
||||||
|
|
||||||
- kind: Response
|
|
||||||
properties:
|
|
||||||
- name: domain
|
|
||||||
- name: status
|
|
||||||
- name: updated
|
|
||||||
direction: desc
|
|
||||||
|
|
||||||
- kind: Response
|
|
||||||
properties:
|
|
||||||
- name: direction
|
|
||||||
- name: domain
|
|
||||||
- name: created
|
|
||||||
direction: desc
|
|
||||||
|
|
||||||
- kind: Follower
|
- kind: Follower
|
||||||
properties:
|
properties:
|
||||||
- name: dest
|
- name: dest
|
||||||
|
|
|
@ -326,8 +326,8 @@ class Object(StringIdModel):
|
||||||
undelivered = ndb.StructuredProperty(Target, repeated=True)
|
undelivered = ndb.StructuredProperty(Target, repeated=True)
|
||||||
failed = ndb.StructuredProperty(Target, repeated=True)
|
failed = ndb.StructuredProperty(Target, repeated=True)
|
||||||
|
|
||||||
created = ndb.DateTimeProperty()#auto_now_add=True)
|
created = ndb.DateTimeProperty(auto_now_add=True)
|
||||||
updated = ndb.DateTimeProperty()#auto_now=True)
|
updated = ndb.DateTimeProperty(auto_now=True)
|
||||||
|
|
||||||
def proxy_url(self):
|
def proxy_url(self):
|
||||||
"""Returns the Bridgy Fed proxy URL to render this post as HTML."""
|
"""Returns the Bridgy Fed proxy URL to render this post as HTML."""
|
||||||
|
|
16
pages.py
16
pages.py
|
@ -79,8 +79,8 @@ def user(domain):
|
||||||
assert not user.use_instead
|
assert not user.use_instead
|
||||||
|
|
||||||
query = Object.query(
|
query = Object.query(
|
||||||
Object.status.IN(('new', 'in progress', 'complete')),
|
|
||||||
Object.domains == domain,
|
Object.domains == domain,
|
||||||
|
Object.labels == 'notification',
|
||||||
)
|
)
|
||||||
objects, before, after = fetch_objects(query)
|
objects, before, after = fetch_objects(query)
|
||||||
|
|
||||||
|
@ -158,20 +158,6 @@ def feed(domain):
|
||||||
return body, {'Content-Type': rss.CONTENT_TYPE}
|
return body, {'Content-Type': rss.CONTENT_TYPE}
|
||||||
|
|
||||||
|
|
||||||
@app.get('/recent')
|
|
||||||
def recent():
|
|
||||||
"""Renders recent objects, with links to logs."""
|
|
||||||
query = Object.query(Object.status.IN(('new', 'in progress', 'complete')))
|
|
||||||
objects, before, after = fetch_objects(query)
|
|
||||||
return render_template(
|
|
||||||
'recent.html',
|
|
||||||
show_domains=True,
|
|
||||||
logs=logs,
|
|
||||||
util=util,
|
|
||||||
**locals(),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_objects(query):
|
def fetch_objects(query):
|
||||||
"""Fetches a page of Object entities from a datastore query.
|
"""Fetches a page of Object entities from a datastore query.
|
||||||
|
|
||||||
|
|
|
@ -33,15 +33,15 @@ class PagesTest(testutil.TestCase):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_objects():
|
def add_objects():
|
||||||
# post
|
# post
|
||||||
Object(id='a', domains=['foo.com'], labels=['feed'],
|
Object(id='a', domains=['foo.com'], labels=['feed', 'notification'],
|
||||||
as1=json_dumps(NOTE)).put()
|
as1=json_dumps(NOTE)).put()
|
||||||
# different domain
|
# different domain
|
||||||
Object(id='b', domains=['bar.org'], labels=['feed'],
|
Object(id='b', domains=['bar.org'], labels=['feed', 'notification'],
|
||||||
as1=json_dumps(MENTION)).put()
|
as1=json_dumps(MENTION)).put()
|
||||||
# reply
|
# reply
|
||||||
Object(id='d', domains=['foo.com'], labels=['feed'],
|
Object(id='d', domains=['foo.com'], labels=['feed', 'notification'],
|
||||||
as1=json_dumps(COMMENT)).put()
|
as1=json_dumps(COMMENT)).put()
|
||||||
# not feed
|
# not feed/notif
|
||||||
Object(id='e', domains=['foo.com'], as1=json_dumps(NOTE)).put()
|
Object(id='e', domains=['foo.com'], as1=json_dumps(NOTE)).put()
|
||||||
|
|
||||||
def test_user(self):
|
def test_user(self):
|
||||||
|
|
Ładowanie…
Reference in New Issue