add: outbox tab on profile

tab is only visible to profile owner and mods
This commit is contained in:
trisua 2025-06-01 19:26:55 -04:00
parent 5dec98d698
commit 7bda718082
12 changed files with 264 additions and 9 deletions

View file

@ -202,8 +202,9 @@
(text "{%- endif %} {%- endif %}"))
(text "{{ self::post_media(upload_ids=post.uploads) }} {% else %}")
(details
("class" "card tiny tertiary w-full")
(summary
("class" "card flex gap-2 flex-wrap items-center tertiary red w-full")
("class" "flex gap-2 flex-wrap items-center red w-full")
(text "{{ icon \"triangle-alert\" }}")
(b
(text "{{ post.context.content_warning }}")))
@ -541,7 +542,7 @@
(text "{%- endif %} {%- endmacro %} {% macro question(question, owner, show_community=true, secondary=false, profile=false) -%}")
(div
("class" "card{% if secondary -%} secondary{%- endif %} flex gap-2")
("class" "card {% if secondary -%}secondary{%- endif %} flex gap-2")
(text "{% if owner.id == 0 -%}")
(span
(text "{% if profile and profile.settings.anonymous_avatar_url -%}")
@ -558,7 +559,7 @@
(text "{{ self::avatar(username=owner.username, selector_type=\"username\", size=\"52px\") }}"))
(text "{%- endif %}")
(div
("class" "flex flex-col gap-1")
("class" "flex flex-col gap-1 w-full")
(div
("class" "flex items-center gap-2 flex-wrap")
(span
@ -606,6 +607,21 @@
("class" "no_p_margin")
("style" "font-weight: 500")
(text "{{ question.content|markdown|safe }}"))
; anonymous user ip thing
; this is only shown if the post author is anonymous AND we are a helper
(text "{% if is_helper and owner.id == 0 %}")
(details
("class" "card tiny tertiary w-full")
(summary
("class" "w-full flex gap-2 flex-wrap items-center")
(icon (text "shield"))
(span (text "View IP")))
(div
("class" "card secondary")
(pre (code (text "{{ question.ip }}")))))
(text "{% endif %}")
; ...
(div
("class" "flex gap-2 items-center justify-between"))))

View file

@ -211,5 +211,18 @@
(a
("href" "/@{{ profile.username }}/media")
("class" "{% if selected == 'media' -%}active{%- endif %}")
(str (text "auth:label.media"))))
(str (text "auth:label.media")))
(text "{% if is_self or is_helper %}")
(a
("href" "/@{{ profile.username }}/outbox")
("class" "{% if selected == 'outbox' -%}active{%- endif %}")
(str (text "auth:label.outbox")))
(text "{% endif %}")
(text "{% if is_helper %}")
(a
("href" "/requests?id={{ profile.id }}")
(str (text "requests:label.requests")))
(text "{% endif %}"))
(text "{%- endmacro %}")

View file

@ -5,6 +5,17 @@
(text "{% endblock %} {% block body %} {{ macros::nav(selected=\"requests\") }}")
(main
("class" "flex flex-col gap-2")
; viewing other user's requests warning
(text "{% if profile.id != user.id -%}")
(div
("class" "card w-full red flex gap-2 items-center")
(text "{{ icon \"skull\" }}")
(b
(text "Viewing other user's requests! Please be careful.")))
(text "{%- endif %}")
; ...
(div
("class" "card-nest")
(div
@ -14,12 +25,14 @@
(text "{{ icon \"inbox\" }}")
(span
(text "{{ text \"requests:label.requests\" }}")))
(text "{% if profile.id == user.id -%}")
(button
("onclick" "clear_requests()")
("class" "small red quaternary")
(text "{{ icon \"bomb\" }}")
(span
(text "{{ text \"notifs:action.clear\" }}"))))
(text "{{ text \"notifs:action.clear\" }}")))
(text "{% endif %}"))
(div
("class" "card tertiary flex flex-col gap-4")
(text "{% for request in requests %} {% if request.action_type == \"CommunityJoin\" %}")

View file

@ -0,0 +1,44 @@
(text "{% extends \"profile/base.html\" %} {% block content %} {% if profile.settings.enable_questions and (user or profile.settings.allow_anonymous_questions) %}")
(div
("style" "display: contents")
(text "{{ components::create_question_form(receiver=profile.id, header=profile.settings.motivational_header) }}"))
(text "{%- endif %} {{ macros::profile_nav(selected=\"outbox\") }}")
(div
("class" "card-nest")
(div
("class" "card small flex gap-2 justify-between items-center")
(div
("class" "flex gap-2 items-center")
(text "{{ icon \"send\" }}")
(span
(text "{{ text \"auth:label.outbox\" }}"))))
(div
("class" "card tertiary flex flex-col gap-4")
(text "{% for question in questions %}")
(div
("class" "card-nest")
; show the actual question
(text "{{ components::question(question=question[0], owner=question[1], profile=user, secondary=true) }}")
; options
(div
("class" "card small flex justify-between items-center gap-2")
; show the avatar of the person we sent the question to
(a
("class" "flex items-center gap-2 flush")
("href" "/api/v1/auth/user/find/{{ question[0].receiver }}")
(icon (text "send"))
(text "{{ components::avatar(username=question[0].receiver, selector_type='id') }}"))
; show button to delete question
(button
("class" "quaternary small red")
("onclick" "trigger('me::remove_question', ['{{ question[0].id }}'])")
(icon (text "trash"))
(str (text "general:action.delete")))))
(text "{% endfor %}")
(text "{{ components::pagination(page=page, items=questions|length) }}")))
(text "{% endblock %}")