feat/support show other accounts toots context
This commit is contained in:
parent
c8d863d86f
commit
76922be81b
2 changed files with 10 additions and 3 deletions
|
@ -80,9 +80,9 @@
|
||||||
{% if toot.is_myself %}
|
{% if toot.is_myself %}
|
||||||
<span><i class="fa-solid fa-satellite-dish"></i><a href="{{ url_for('grab', toot_id=toot.id) }}"
|
<span><i class="fa-solid fa-satellite-dish"></i><a href="{{ url_for('grab', toot_id=toot.id) }}"
|
||||||
target=" _blank">抓取回复</a></span>
|
target=" _blank">抓取回复</a></span>
|
||||||
|
{% endif %}
|
||||||
<span><i class="fa-solid fa-up-right-and-down-left-from-center"></i><a
|
<span><i class="fa-solid fa-up-right-and-down-left-from-center"></i><a
|
||||||
href="{{ url_for('context', toot_id=toot.id) }}" target=" _blank">上下文</a></span>
|
href="{{ url_for('context', toot_id=toot.id) }}" target=" _blank">上下文</a></span>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from flask import render_template, request, url_for, redirect, flash
|
from flask import render_template, request, url_for, redirect, flash, abort
|
||||||
from flask_sqlalchemy import Pagination
|
from flask_sqlalchemy import Pagination
|
||||||
from BDSM import app, db
|
from BDSM import app, db
|
||||||
from BDSM.models import Media, Settings, Toot, Emoji, Other
|
from BDSM.models import Media, Settings, Toot, Emoji, Other
|
||||||
|
@ -63,7 +63,14 @@ def context(toot_id):
|
||||||
return toots
|
return toots
|
||||||
|
|
||||||
toots = []
|
toots = []
|
||||||
toots.append(Toot.query.get_or_404(toot_id))
|
|
||||||
|
toot_ = Toot.query.get(toot_id)
|
||||||
|
if toot_ == None:
|
||||||
|
toot_ = Other.query.get(toot_id)
|
||||||
|
if toot_ == None:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
|
toots.append(toot_)
|
||||||
toots = process_toot(toots)
|
toots = process_toot(toots)
|
||||||
toots[0].reply = get_reply(toot_id)
|
toots[0].reply = get_reply(toot_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue