mirror of https://gitlab.com/bashrc2/epicyon
Detect question rather than vote
parent
dde403b16e
commit
07345b97cd
4
posts.py
4
posts.py
|
@ -105,7 +105,7 @@ from maps import geocoords_from_map_link
|
||||||
from keys import get_person_key
|
from keys import get_person_key
|
||||||
from markdown import markdown_to_html
|
from markdown import markdown_to_html
|
||||||
from followerSync import update_followers_sync_cache
|
from followerSync import update_followers_sync_cache
|
||||||
from question import is_vote
|
from question import is_question
|
||||||
|
|
||||||
|
|
||||||
def convert_post_content_to_html(message_json: {}) -> None:
|
def convert_post_content_to_html(message_json: {}) -> None:
|
||||||
|
@ -5602,7 +5602,7 @@ def download_announce(session, base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
# if poll/vote/question is not to be shown
|
# if poll/vote/question is not to be shown
|
||||||
if not show_vote_posts:
|
if not show_vote_posts:
|
||||||
if is_vote(base_dir, nickname, domain, announced_json, debug):
|
if is_question(announced_json):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# set the id to the original status
|
# set the id to the original status
|
||||||
|
|
|
@ -192,6 +192,14 @@ def question_update_votes(base_dir: str, nickname: str, domain: str,
|
||||||
return question_json, question_post_filename
|
return question_json, question_post_filename
|
||||||
|
|
||||||
|
|
||||||
|
def is_html_question(html_str: str) -> bool:
|
||||||
|
""" is the given html string a Question?
|
||||||
|
"""
|
||||||
|
if 'input type="radio" name="answer"' in html_str:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def is_question(post_json_object: {}) -> bool:
|
def is_question(post_json_object: {}) -> bool:
|
||||||
""" is the given post a question?
|
""" is the given post a question?
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -39,7 +39,8 @@ from webapp_column_right import get_right_column_content
|
||||||
from webapp_headerbuttons import header_buttons_timeline
|
from webapp_headerbuttons import header_buttons_timeline
|
||||||
from posts import is_moderator
|
from posts import is_moderator
|
||||||
from announce import is_self_announce
|
from announce import is_self_announce
|
||||||
from question import is_vote
|
from question import is_html_question
|
||||||
|
from question import is_question
|
||||||
|
|
||||||
|
|
||||||
def _log_timeline_timing(enable_timing_log: bool, timeline_start_time,
|
def _log_timeline_timing(enable_timing_log: bool, timeline_start_time,
|
||||||
|
@ -988,9 +989,9 @@ def html_timeline(default_timeline: str,
|
||||||
continue
|
continue
|
||||||
if is_self_announce(item):
|
if is_self_announce(item):
|
||||||
continue
|
continue
|
||||||
# if this is a vote post then should it be shown?
|
# is this a poll/vote/question?
|
||||||
if not show_vote_posts:
|
if not show_vote_posts:
|
||||||
if is_vote(base_dir, nickname, domain, item, False):
|
if is_question(item):
|
||||||
continue
|
continue
|
||||||
# is the post in the memory cache of recent ones?
|
# is the post in the memory cache of recent ones?
|
||||||
curr_tl_str = None
|
curr_tl_str = None
|
||||||
|
@ -1054,6 +1055,10 @@ def html_timeline(default_timeline: str,
|
||||||
|
|
||||||
if curr_tl_str:
|
if curr_tl_str:
|
||||||
if curr_tl_str not in tl_items_str:
|
if curr_tl_str not in tl_items_str:
|
||||||
|
# is this a poll/vote/question?
|
||||||
|
if not show_vote_posts:
|
||||||
|
if is_html_question(curr_tl_str):
|
||||||
|
continue
|
||||||
last_item_str = text_mode_separator + curr_tl_str
|
last_item_str = text_mode_separator + curr_tl_str
|
||||||
last_post_id = \
|
last_post_id = \
|
||||||
remove_id_ending(item['id']).replace('/', '#')
|
remove_id_ending(item['id']).replace('/', '#')
|
||||||
|
|
Loading…
Reference in New Issue