add user started threads view

This commit is contained in:
2026-04-29 19:14:05 +03:00
parent d5e627ed7f
commit 3870356ffa
7 changed files with 80 additions and 10 deletions

View File

@@ -113,7 +113,7 @@
{% macro full_post(
post, render_sig=true, is_latest=false,
show_toolbar=true, is_editing=false, thread=none,
show_reactions=true, show_thread=false
show_reactions=true, show_thread=false, allow_reacting=true
) -%}
{%- if is_logged_in() -%}
{%- set can_delete = post.user_id == get_active_user().id or is_mod() -%}
@@ -190,10 +190,10 @@
{% set reactors_str = reactors_str + '\n...and many others' %}
{% endif %}
{% set has_reacted = get_active_user() is not none and get_active_user().username in reactors %}
<button disabled title="{{reactors_str}}" class="minimal {{'alt' if has_reacted else ''}}"><img src="/static/emoji/{{reaction.reaction_text}}.png">{{reaction.c}}</button>
<button type="button" disabled title="{{reactors_str}}" class="minimal {{'alt' if has_reacted else ''}}"><img src="/static/emoji/{{reaction.reaction_text}}.png">{{reaction.c}}</button>
{%- endfor -%}
</span>
{%- if is_logged_in() -%}<button disabled title="This feature requires JavaScript to be enabled.">Add reaction</button>{%- endif -%}
{%- if is_logged_in() and allow_reacting -%}<button disabled title="This feature requires JavaScript to be enabled.">Add reaction</button>{%- endif -%}
{%- elif is_editing -%}
<input type="submit" value="Save">
<a href="{{get_post_url(post.id, _anchor=true)}}" class="linkbutton warn">Cancel</a>

View File

@@ -74,6 +74,14 @@
{{- pager(page, page_count) -}}
</fieldset>
</div>
<div id="new-post-toast" class="plank even contrast-bg hidden">
<span>New post in thread!</span>
<span class="notification-buttons">
<button>Dismiss</button>
<button>View post</button>
<button>Stop updates</button>
</span>
</div>
{%- if is_logged_in() and get_active_user().can_post_to_thread_or_topic(thread) -%}
<form action="{{url_for('threads.reply', thread_id=thread.id)}}" method="POST" class="plank post-edit-form">
<h2 class="info">Reply to "{{thread.title}}"</h2>

View File

@@ -4,19 +4,19 @@
{%- block title -%}{{ target_user.get_readable_name() }}'s posts{%- endblock -%}
{%- block content -%}
{%- set td -%}
<a href="{{url_for('users.user_page', username=target_user.username)}}">Back to profile</a>
<a href="{{url_for('users.user_page', username=target_user.username)}}">&larr; Back to profile</a>
{%- endset -%}
{%- call() subheader("%s's posts" % target_user.get_readable_name(), td) -%}
{%- if posts -%}
<fieldset class="plank even no-shadow minimal thread-actions">
<legend>Page</legend>
{{- pager(page, page_count) -}}
</fieldset>
{%- endif -%}
{%- endset -%}
{%- call() subheader("%s's posts" % target_user.get_readable_name(), td) -%}
{%- endcall -%}
{%- if posts -%}
{%- for post in posts -%}
<div class="post plank">{{full_post(post, show_toolbar=false, show_thread=true)}}</div>
<div class="post plank">{{full_post(post, show_toolbar=false, show_thread=true, allow_reacting=false)}}</div>
{%- endfor -%}
<div class="plank">
<fieldset class="plank even no-shadow minimal thread-actions">

View File

@@ -0,0 +1,33 @@
{%- from 'common/macros.html' import full_post with context -%}
{%- from 'common/macros.html' import subheader, pager -%}
{%- extends 'base.html' -%}
{%- block title -%}threads by {{ target_user.get_readable_name() }}{%- endblock -%}
{%- block content -%}
{%- set td -%}
<a href="{{url_for('users.user_page', username=target_user.username)}}">&larr; Back to profile</a>
{%- endset -%}
{%- call() subheader("%s's started threads" % target_user.get_readable_name(), td) -%}
{%- if threads -%}
<fieldset class="plank even no-shadow minimal thread-actions">
<legend>Page</legend>
{{- pager(page, page_count) -}}
</fieldset>
{%- endif -%}
{%- endcall -%}
{%- if threads -%}
{%- for post in threads -%}
<div class="plank">
<h2 class="info"><a href="{{url_for('threads.thread_by_id', thread_id=post.thread_id)}}">"{{post.thread_title}}"</a> in topic <a href="{{url_for('topics.topic_by_id', topic_id=post.topic_id)}}">{{post.topic_name}}</a></h2>
<div class="post">{{full_post(post, show_toolbar=false, allow_reacting=false)}}</div>
</div>
{%- endfor -%}
<div class="plank">
<fieldset class="plank even no-shadow minimal thread-actions">
<legend>Page</legend>
{{- pager(page, page_count) -}}
</fieldset>
</div>
{%- else -%}
<div class="plank">{{target_user.get_readable_name()}} has not started any threads.</div>
{%- endif -%}
{%- endblock -%}