Fixes replies, and hide them on the homepage
This commit is contained in:
parent
63b2d2870a
commit
a160a95e82
3 changed files with 16 additions and 4 deletions
|
@ -246,6 +246,9 @@ class BaseActivity(object):
|
|||
raise ValueError('Invalid actor')
|
||||
return actor['id']
|
||||
|
||||
def reset_object_cache(self) -> None:
|
||||
self.__obj = None
|
||||
|
||||
def get_object(self) -> 'BaseActivity':
|
||||
if self.__obj:
|
||||
return self.__obj
|
||||
|
@ -824,6 +827,7 @@ class Create(BaseActivity):
|
|||
def _set_id(self, uri: str, obj_id: str) -> None:
|
||||
self._data['object']['id'] = uri + '/activity'
|
||||
self._data['object']['url'] = ID + '/' + self.get_object().type.lower() + '/' + obj_id
|
||||
self.reset_object_cache()
|
||||
|
||||
def _init(self, **kwargs):
|
||||
obj = self.get_object()
|
||||
|
@ -857,6 +861,8 @@ class Create(BaseActivity):
|
|||
|
||||
threads = []
|
||||
reply = obj.get_local_reply()
|
||||
print(f'initial_reply={reply}')
|
||||
print(f'{obj}')
|
||||
logger.debug(f'initial_reply={reply}')
|
||||
reply_id = None
|
||||
direct_reply = 1
|
||||
|
@ -881,6 +887,8 @@ class Create(BaseActivity):
|
|||
reply = reply.get_local_reply()
|
||||
logger.debug(f'next_reply={reply}')
|
||||
threads.append(reply_id)
|
||||
# FIXME(tsileo): obj.id is None!!
|
||||
print(f'reply_id={reply_id} {obj.id} {obj._data} {self.id}')
|
||||
|
||||
if reply_id:
|
||||
if not DB.inbox.find_one_and_update({'activity.object.id': obj.id}, {
|
||||
|
|
7
app.py
7
app.py
|
@ -78,8 +78,12 @@ csrf = CSRFProtect(app)
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Hook up Flask logging with gunicorn
|
||||
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||
root_logger = logging.getLogger()
|
||||
if os.getenv('FLASK_DEBUG'):
|
||||
logger.setLevel(logging.DEBUG)
|
||||
root_logger.setLevel(logging.DEBUG)
|
||||
else:
|
||||
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||
root_logger.handlers = gunicorn_logger.handlers
|
||||
root_logger.setLevel(gunicorn_logger.level)
|
||||
|
||||
|
@ -378,6 +382,7 @@ def index():
|
|||
q = {
|
||||
'type': 'Create',
|
||||
'activity.object.type': 'Note',
|
||||
'activity.object.inReplyTo': None,
|
||||
'meta.deleted': False,
|
||||
}
|
||||
c = request.args.get('cursor')
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
{% block content %}
|
||||
<div id="container">
|
||||
{% include "header.html" %}
|
||||
{{ thread }}
|
||||
{{ utils.display_thread(thread) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue