renamed p.embed_url to p.embed

master
Aevann 2023-02-18 18:33:19 +02:00
parent 13b5df569f
commit d4210c2710
7 changed files with 15 additions and 15 deletions

View File

@ -54,7 +54,7 @@ class Submission(Base):
body_html = Column(String)
flair = Column(String)
ban_reason = Column(String)
embed_url = Column(String)
embed = Column(String)
new = Column(Boolean)
notify = Column(Boolean)
@ -146,7 +146,7 @@ class Submission(Base):
@property
@lazy
def is_youtube(self):
return self.domain == "youtube.com" and self.embed_url and self.embed_url.startswith('<lite-youtube')
return self.domain == "youtube.com" and self.embed and self.embed.startswith('<lite-youtube')
@property
@lazy

View File

@ -63,7 +63,7 @@ def feeds_user(sort='hot', t='all'):
doc.stag("link", href=post.permalink)
image_url = post.thumb_url or post.embed_url or post.url
image_url = post.thumb_url or post.embed or post.url
doc.stag("media:thumbnail", url=image_url)

View File

@ -689,7 +689,7 @@ def submit_post(v:User, sub=None):
url=url,
body=body,
body_html=body_html,
embed_url=embed,
embed=embed,
title=title,
title_html=title_html,
sub=sub,

View File

@ -65,7 +65,7 @@
<div class="card border-0 mt-3 {% if p.stickied %}stickied{% endif %} {% if voted==1 %}upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div id="post-{{p.id}}" class="actual-post {% if p.ghost %}ghost-post{% endif %} {% if p.is_banned %}banned{% endif %} {% if p.deleted_utc %}deleted {% endif %} {% if p.award_count('tilt', v) %}p-3{% endif %} {% if p.award_count('glowie', v) %}glow{% endif %} d-flex flex-row-reverse flex-nowrap justify-content-end">
{% if not p.is_image and p.thumb_url and not p.embed_url %}
{% if not p.is_image and p.thumb_url and not p.embed %}
<div class="card-header bg-transparent border-0 d-none d-md-flex flex-row flex-nowrap pl-3 p-0">
<a rel="nofollow noopener" href="{{p.realurl(v)}}" style="height: fit-content"{% if not v or v.newtabexternal %}target="_blank"{% endif %}><img loading="lazy" src="{{p.thumb_url}}" class="post-img d-mob-none" alt="Unable to load image"></a>
</div>
@ -102,7 +102,7 @@
{% if not v_forbid_deleted %}
<div id="post-body" class="post-body mt-3">
{% if p.realurl(v) and not p.embed_url and not p.is_image and not p.is_video and not p.is_audio %}
{% if p.realurl(v) and not p.embed and not p.is_image and not p.is_video and not p.is_audio %}
<a rel="nofollow noopener" href="{{p.realurl(v)}}" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>
<div class="d-flex justify-content-between align-items-center border rounded p-2 mb-3">
<span>{{p.realurl(v)}}</span>
@ -110,16 +110,16 @@
</div>
</a>
{% endif %}
{% if p.embed_url %}
{% if p.embed %}
{% if p.domain == "twitter.com" %}
{{p.embed_url | safe}}
{{p.embed | safe}}
{% if v and v.theme.split("_")[0] in ["light", "coffee", "4chan"] %}
<script defer src="{{'js/vendor/twitterlight.js' | asset}}"></script>
{% else %}
<script defer src="{{'js/vendor/twitter.js' | asset}}"></script>
{% endif %}
{% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith('<lite-youtube') %}
{{p.embed_url | safe}}
{% elif p.domain in ['youtu.be','youtube.com'] and p.embed and p.embed.startswith('<lite-youtube') %}
{{p.embed | safe}}
{% endif %}
{% endif %}
@ -190,12 +190,12 @@
<div id="post-edit-{{p.id}}" class="preview mb-3 mt-5"></div>
</div>
{% endif %}
{% if p.embed_url and "http" not in p.embed_url and "<" not in p.embed_url %}
{% if p.embed and "http" not in p.embed and "<" not in p.embed %}
<div id="crosspost-embed" class="mb-3">
<div class="row no-gutters">
<div id="frontpage" class="col-12 pt-0">
<div class="posts" id="posts">
{{p.embed_url | post_embed(v) | safe}}
{{p.embed | post_embed(v) | safe}}
</div>
</div>
</div>

View File

@ -240,7 +240,7 @@
</div>
{% elif p.is_youtube %}
<div id="video-{{p.id}}" class="{% if p.over_18 or not ((v and v.cardview)) %}d-none{% endif %} mt-3 mb-4 youtube_embed">
{{p.embed_url | safe}}
{{p.embed | safe}}
</div>
{% endif %}
{% endif %}

View File

@ -0,0 +1 @@
alter table submissions rename column embed_url to embed;

View File

@ -112,7 +112,7 @@ CREATE TABLE public.submissions (
url character varying(2083),
body character varying(20000),
body_html character varying(40000),
embed_url character varying(1500),
embed character varying(1500),
ban_reason character varying(25),
title_html character varying(1500) NOT NULL,
realupvotes integer,
@ -2806,4 +2806,3 @@ ALTER TABLE ONLY public.comments
--
-- PostgreSQL database dump complete
--