From d4210c2710cb544fb3d15c0edc2c800d948ca1c1 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 18 Feb 2023 18:33:19 +0200 Subject: [PATCH] renamed p.embed_url to p.embed --- files/classes/submission.py | 4 ++-- files/routes/feeds.py | 2 +- files/routes/posts.py | 2 +- files/templates/submission.html | 16 ++++++++-------- files/templates/submission_listing.html | 2 +- .../20230218-rename-embed_url-to-embed.sql | 1 + schema.sql | 3 +-- 7 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 migrations/20230218-rename-embed_url-to-embed.sql diff --git a/files/classes/submission.py b/files/classes/submission.py index d866c461c..c4f1f00ab 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -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('
- {% 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 %}
Unable to load image
@@ -102,7 +102,7 @@ {% if not v_forbid_deleted %}
- {% 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 %}
{{p.realurl(v)}} @@ -110,16 +110,16 @@
{% 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"] %} {% else %} {% endif %} - {% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith('
{% 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 %}
- {{p.embed_url | post_embed(v) | safe}} + {{p.embed | post_embed(v) | safe}}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index e723f7b91..48713ec85 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -240,7 +240,7 @@
{% elif p.is_youtube %}
- {{p.embed_url | safe}} + {{p.embed | safe}}
{% endif %} {% endif %} diff --git a/migrations/20230218-rename-embed_url-to-embed.sql b/migrations/20230218-rename-embed_url-to-embed.sql new file mode 100644 index 000000000..af1e82ca3 --- /dev/null +++ b/migrations/20230218-rename-embed_url-to-embed.sql @@ -0,0 +1 @@ +alter table submissions rename column embed_url to embed; diff --git a/schema.sql b/schema.sql index a071e4610..323020d70 100644 --- a/schema.sql +++ b/schema.sql @@ -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 -- -