From f19cdfafad88e5195f6482510a2ef180e90de2c5 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 19 May 2024 11:30:41 +1200 Subject: [PATCH] poll - icon #181 --- app/community/routes.py | 3 ++- app/main/routes.py | 4 ++-- app/templates/post/_post_teaser.html | 5 +++-- app/user/routes.py | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/community/routes.py b/app/community/routes.py index 8e27d3d6..ed507ac8 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -264,7 +264,8 @@ def show_community(community: Community): return render_template('community/community.html', community=community, title=community.title, breadcrumbs=breadcrumbs, is_moderator=is_moderator, is_owner=is_owner, is_admin=is_admin, mods=mod_list, posts=posts, description=description, - og_image=og_image, POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_VIDEO=POST_TYPE_VIDEO, SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, + og_image=og_image, POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_LINK=POST_TYPE_LINK, + POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL, SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, etag=f"{community.id}{sort}{post_layout}_{hash(community.last_active)}", related_communities=related_communities, next_url=next_url, prev_url=prev_url, low_bandwidth=low_bandwidth, diff --git a/app/main/routes.py b/app/main/routes.py index 3ccd3e4e..3cc4f99d 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -13,7 +13,7 @@ from app.activitypub.util import make_image_sizes_async, refresh_user_profile, f refresh_community_profile_task, users_total, active_month, local_posts, local_communities, local_comments from app.activitypub.signature import default_context from app.constants import SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER, POST_TYPE_IMAGE, POST_TYPE_LINK, \ - SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR, POST_TYPE_VIDEO + SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR, POST_TYPE_VIDEO, POST_TYPE_POLL from app.email import send_email, send_welcome_email from app.inoculation import inoculation from app.main import bp @@ -154,7 +154,7 @@ def home_page(type, sort): recently_downvoted = [] return render_template('index.html', posts=posts, active_communities=active_communities, show_post_community=True, - POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_VIDEO=POST_TYPE_VIDEO, + POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL, low_bandwidth=low_bandwidth, recently_upvoted=recently_upvoted, recently_downvoted=recently_downvoted, SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, diff --git a/app/templates/post/_post_teaser.html b/app/templates/post/_post_teaser.html index 7d3c03af..afed896b 100644 --- a/app/templates/post/_post_teaser.html +++ b/app/templates/post/_post_teaser.html @@ -49,8 +49,9 @@ {% endif %} {% endif %}

{% if post.sticky %}{% endif %}{{ post.title }} - {% if post.type == POST_TYPE_IMAGE %}{% endif %} - {% if (post.type == POST_TYPE_LINK or post.type == POST_TYPE_VIDEO) and post.domain_id %} + {% if post.type == POST_TYPE_IMAGE %} + {% elif post.type == POST_TYPE_POLL %} + {% elif (post.type == POST_TYPE_LINK or post.type == POST_TYPE_VIDEO) and post.domain_id %} {% if post.url and (post.type == POST_TYPE_VIDEO or 'youtube.com' in post.url) %} {% elif post.url.endswith('.mp3') %} diff --git a/app/user/routes.py b/app/user/routes.py index 2cfb610b..4233e1b9 100644 --- a/app/user/routes.py +++ b/app/user/routes.py @@ -9,7 +9,8 @@ from app import db, cache, celery from app.activitypub.signature import post_request, default_context from app.activitypub.util import find_actor_or_create from app.community.util import save_icon_file, save_banner_file, retrieve_mods_and_backfill -from app.constants import SUBSCRIPTION_MEMBER, SUBSCRIPTION_PENDING, NOTIF_USER +from app.constants import SUBSCRIPTION_MEMBER, SUBSCRIPTION_PENDING, NOTIF_USER, POST_TYPE_VIDEO, POST_TYPE_LINK, \ + POST_TYPE_IMAGE, POST_TYPE_POLL from app.models import Post, Community, CommunityMember, User, PostReply, PostVote, Notification, utcnow, File, Site, \ Instance, Report, UserBlock, CommunityBan, CommunityJoinRequest, CommunityBlock, Filter, Domain, DomainBlock, \ InstanceBlock, NotificationSubscription @@ -83,6 +84,8 @@ def show_profile(user): return render_template('user/show_profile.html', user=user, posts=posts, post_replies=post_replies, moderates=moderates.all(), canonical=canonical, title=_('Posts by %(user_name)s', user_name=user.user_name), + POST_TYPE_IMAGE=POST_TYPE_IMAGE, POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_VIDEO=POST_TYPE_VIDEO, + POST_TYPE_POLL=POST_TYPE_POLL, description=description, subscribed=subscribed, upvoted=upvoted, post_next_url=post_next_url, post_prev_url=post_prev_url, replies_next_url=replies_next_url, replies_prev_url=replies_prev_url,