Timeline Fix: Attachment in post did not work
This commit is contained in:
parent
3985a00c6f
commit
a897e201ba
@ -8,6 +8,8 @@ import bson
|
|||||||
import pymongo
|
import pymongo
|
||||||
from flask import Blueprint, current_app, request, url_for
|
from flask import Blueprint, current_app, request, url_for
|
||||||
|
|
||||||
|
import pillar
|
||||||
|
from pillar import shortcodes
|
||||||
from pillar.api.utils import jsonify, pretty_duration, str2id
|
from pillar.api.utils import jsonify, pretty_duration, str2id
|
||||||
from pillar.web.utils import pretty_date
|
from pillar.web.utils import pretty_date
|
||||||
|
|
||||||
@ -211,6 +213,10 @@ class TimeLineBuilder:
|
|||||||
duration_seconds = node['properties'].get('duration_seconds')
|
duration_seconds = node['properties'].get('duration_seconds')
|
||||||
if duration_seconds is not None:
|
if duration_seconds is not None:
|
||||||
node['properties']['duration'] = pretty_duration(duration_seconds)
|
node['properties']['duration'] = pretty_duration(duration_seconds)
|
||||||
|
if node['node_type'] == 'post':
|
||||||
|
html = _get_markdowned_html(node['properties'], 'content')
|
||||||
|
html = shortcodes.render_commented(html, context=node['properties'])
|
||||||
|
node['properties']['pretty_content'] = html
|
||||||
return node
|
return node
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -240,6 +246,15 @@ def _public_project_ids() -> typing.List[bson.ObjectId]:
|
|||||||
return [p['_id'] for p in result]
|
return [p['_id'] for p in result]
|
||||||
|
|
||||||
|
|
||||||
|
def _get_markdowned_html(document: dict, field_name: str) -> str:
|
||||||
|
cache_field_name = pillar.markdown.cache_field_name(field_name)
|
||||||
|
html = document.get(cache_field_name)
|
||||||
|
if html is None:
|
||||||
|
markdown_src = document.get(field_name) or ''
|
||||||
|
html = pillar.markdown.markdown(markdown_src)
|
||||||
|
return html
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/', methods=['GET'])
|
@blueprint.route('/', methods=['GET'])
|
||||||
def global_timeline():
|
def global_timeline():
|
||||||
continue_from_str = request.args.get('from')
|
continue_from_str = request.args.get('from')
|
||||||
|
@ -14,7 +14,7 @@ class Posts extends NodesFactoryInterface {
|
|||||||
content,
|
content,
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.addClass('node-details-description mx-auto')
|
.addClass('node-details-description mx-auto')
|
||||||
.html(post['properties']['_content_html'])
|
.html(post['properties']['pretty_content'])
|
||||||
);
|
);
|
||||||
|
|
||||||
return $post;
|
return $post;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user