mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
remove moment.js to decrease carbon usage
This commit is contained in:
parent
5a02eb9ba0
commit
9bad635805
26 changed files with 30 additions and 41 deletions
|
@ -10,7 +10,6 @@ from flask_migrate import Migrate
|
||||||
from flask_login import LoginManager
|
from flask_login import LoginManager
|
||||||
from flask_bootstrap import Bootstrap5
|
from flask_bootstrap import Bootstrap5
|
||||||
from flask_mail import Mail
|
from flask_mail import Mail
|
||||||
from flask_moment import Moment
|
|
||||||
from flask_babel import Babel, lazy_gettext as _l
|
from flask_babel import Babel, lazy_gettext as _l
|
||||||
from flask_caching import Cache
|
from flask_caching import Cache
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
|
@ -39,7 +38,6 @@ login.login_view = 'auth.login'
|
||||||
login.login_message = _l('Please log in to access this page.')
|
login.login_message = _l('Please log in to access this page.')
|
||||||
mail = Mail()
|
mail = Mail()
|
||||||
bootstrap = Bootstrap5()
|
bootstrap = Bootstrap5()
|
||||||
moment = Moment()
|
|
||||||
babel = Babel(locale_selector=get_locale)
|
babel = Babel(locale_selector=get_locale)
|
||||||
cache = Cache()
|
cache = Cache()
|
||||||
celery = Celery(__name__, broker=Config.CELERY_BROKER_URL)
|
celery = Celery(__name__, broker=Config.CELERY_BROKER_URL)
|
||||||
|
@ -61,7 +59,6 @@ def create_app(config_class=Config):
|
||||||
login.init_app(app)
|
login.init_app(app)
|
||||||
mail.init_app(app)
|
mail.init_app(app)
|
||||||
bootstrap.init_app(app)
|
bootstrap.init_app(app)
|
||||||
moment.init_app(app)
|
|
||||||
make_searchable(db.metadata)
|
make_searchable(db.metadata)
|
||||||
babel.init_app(app, locale_selector=get_locale)
|
babel.init_app(app, locale_selector=get_locale)
|
||||||
cache.init_app(app)
|
cache.init_app(app)
|
||||||
|
|
|
@ -3,7 +3,6 @@ from datetime import timedelta
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
from flask_caching import CachedResponse
|
|
||||||
from sqlalchemy.sql.operators import or_, and_
|
from sqlalchemy.sql.operators import or_, and_
|
||||||
|
|
||||||
from app import db, cache
|
from app import db, cache
|
||||||
|
@ -15,7 +14,6 @@ from app.email import send_email
|
||||||
from app.inoculation import inoculation
|
from app.inoculation import inoculation
|
||||||
from app.main import bp
|
from app.main import bp
|
||||||
from flask import g, session, flash, request, current_app, url_for, redirect, make_response, jsonify
|
from flask import g, session, flash, request, current_app, url_for, redirect, make_response, jsonify
|
||||||
from flask_moment import moment
|
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
from flask_babel import _, get_locale
|
from flask_babel import _, get_locale
|
||||||
from sqlalchemy import desc, text
|
from sqlalchemy import desc, text
|
||||||
|
|
|
@ -14,8 +14,6 @@ curl -o js/markdown/downarea.js -L https://codeberg.org/PieFed/downarea2/raw/bra
|
||||||
# https://htmx.org/ (Zero-Clause BSD)
|
# https://htmx.org/ (Zero-Clause BSD)
|
||||||
curl -o js/htmx.min.js -L https://unpkg.com/htmx.org@2.0.0
|
curl -o js/htmx.min.js -L https://unpkg.com/htmx.org@2.0.0
|
||||||
|
|
||||||
# https://momentjs.com/ (MIT license)
|
|
||||||
curl -o js/moment-with-locales.min.js -L https://momentjs.com/downloads/moment-with-locales.min.js
|
|
||||||
|
|
||||||
# ToDo: coolfieldset.js
|
# ToDo: coolfieldset.js
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% for activity in activities.items %}
|
{% for activity in activities.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ moment(activity.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(activity.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>{{ activity.direction }}</td>
|
<td>{{ activity.direction }}</td>
|
||||||
<td>{{ activity.activity_id }}</td>
|
<td>{{ activity.activity_id }}</td>
|
||||||
<td>{{ activity.activity_type if activity.activity_type else '' }}</td>
|
<td>{{ activity.activity_type if activity.activity_type else '' }}</td>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<td><a href="mailto:{{ registration.user.email }}">{{ registration.user.email }}</a></td>
|
<td><a href="mailto:{{ registration.user.email }}">{{ registration.user.email }}</a></td>
|
||||||
<td>{{ '<span class="green">✓</span>'|safe if registration.user.verified else '<span class="red">✗</span>'|safe }}</td>
|
<td>{{ '<span class="green">✓</span>'|safe if registration.user.verified else '<span class="red">✗</span>'|safe }}</td>
|
||||||
<td>{{ registration.answer }}</td>
|
<td>{{ registration.answer }}</td>
|
||||||
<td>{{ moment(registration.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(registration.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>{{ registration.user.ip_address if registration.user.ip_address }}<br />{{ registration.user.ip_address_country if registration.user.ip_address_country }}</td>
|
<td>{{ registration.user.ip_address if registration.user.ip_address }}<br />{{ registration.user.ip_address_country if registration.user.ip_address_country }}</td>
|
||||||
<td>{{ registration.user.referrer if registration.user.referrer }} </td>
|
<td>{{ registration.user.referrer if registration.user.referrer }} </td>
|
||||||
<td><a href="{{ url_for('admin.admin_approve_registrations_approve', user_id=registration.user.id) }}" class="btn btn-sm btn-primary">{{ _('Approve') }}</a>
|
<td><a href="{{ url_for('admin.admin_approve_registrations_approve', user_id=registration.user.id) }}" class="btn btn-sm btn-primary">{{ _('Approve') }}</a>
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
<td><a href="mailto:{{ registration.user.email }}">{{ registration.user.email }}</a></td>
|
<td><a href="mailto:{{ registration.user.email }}">{{ registration.user.email }}</a></td>
|
||||||
<td>{{ '<span class="green">✓</span>'|safe if registration.user.verified else '<span class="red">✗</span>'|safe }}</td>
|
<td>{{ '<span class="green">✓</span>'|safe if registration.user.verified else '<span class="red">✗</span>'|safe }}</td>
|
||||||
<td>{{ registration.answer }}</td>
|
<td>{{ registration.answer }}</td>
|
||||||
<td>{{ moment(registration.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(registration.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>{{ registration.user.ip_address if registration.user.ip_address }}<br />{{ registration.user.ip_address_country if registration.user.ip_address_country }}</td>
|
<td>{{ registration.user.ip_address if registration.user.ip_address }}<br />{{ registration.user.ip_address_country if registration.user.ip_address_country }}</td>
|
||||||
<td>{{ registration.user.referrer if registration.user.referrer }} </td>
|
<td>{{ registration.user.referrer if registration.user.referrer }} </td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<form method="post" enctype="multipart/form-data" id="add_local_user_form">
|
<form method="post" enctype="multipart/form-data" id="add_local_user_form">
|
||||||
{{ form.csrf_token() }}
|
{{ form.csrf_token() }}
|
||||||
{{ user.about_html|safe if user.about_html }}
|
{{ user.about_html|safe if user.about_html }}
|
||||||
<p>Created: {{ moment(user.created).format('MMMM Do YYYY, h:mm:ss a') }}</p>
|
<p>Created: {{ arrow.get(user.created).humanize(locale=locale) }}</p>
|
||||||
<p>Last active: {{ moment(user.last_seen).format('MMMM Do YYYY, h:mm:ss a') }}</p>
|
<p>Last active: {{ arrow.get(user.last_seen).humanize(locale=locale) }}</p>
|
||||||
<p>Email: <a href="mailto:{{ user.email }}">{{ user.email }}</a></p>
|
<p>Email: <a href="mailto:{{ user.email }}">{{ user.email }}</a></p>
|
||||||
<p>Matrix: {{ user.matrix_user_id if user.matrix_user_id }}</p>
|
<p>Matrix: {{ user.matrix_user_id if user.matrix_user_id }}</p>
|
||||||
{% if user.avatar_id %}
|
{% if user.avatar_id %}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<td>{{ report.reasons }}</td>
|
<td>{{ report.reasons }}</td>
|
||||||
<td>{{ report.description }}</td>
|
<td>{{ report.description }}</td>
|
||||||
<td>{{ report.type_text() }}</td>
|
<td>{{ report.type_text() }}</td>
|
||||||
<td>{{ moment(report.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(report.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if report.suspect_conversation_id %}
|
{% if report.suspect_conversation_id %}
|
||||||
<a href="/chat/{{ report.suspect_conversation_id }}#message">View</a>
|
<a href="/chat/{{ report.suspect_conversation_id }}#message">View</a>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
{{ user.display_name() }}</a></td>
|
{{ user.display_name() }}</a></td>
|
||||||
<td>{% if user.is_local() %}Local{% else %}<a href="{{ user.ap_profile_id }}">Remote</a>{% endif %}</td>
|
<td>{% if user.is_local() %}Local{% else %}<a href="{{ user.ap_profile_id }}">Remote</a>{% endif %}</td>
|
||||||
<td>{% if request.args.get('local_remote', '') == 'local' %}
|
<td>{% if request.args.get('local_remote', '') == 'local' %}
|
||||||
{{ moment(user.last_seen).fromNow() }}
|
{{ arrow.get(user.last_seen).humanize(locale=locale) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ user.last_seen }}
|
{{ user.last_seen }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
{{ user.display_name() }}</a></td>
|
{{ user.display_name() }}</a></td>
|
||||||
<td>{% if user.is_local() %}Local{% else %}<a href="{{ user.ap_profile_id }}">Remote</a>{% endif %}</td>
|
<td>{% if user.is_local() %}Local{% else %}<a href="{{ user.ap_profile_id }}">Remote</a>{% endif %}</td>
|
||||||
<td>{% if request.args.get('local_remote', '') == 'local' %}
|
<td>{% if request.args.get('local_remote', '') == 'local' %}
|
||||||
{{ moment(user.last_seen).fromNow() }}
|
{{ arrow.get(user.last_seen).humanize(locale=locale) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ user.last_seen }}
|
{{ user.last_seen }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -272,10 +272,6 @@
|
||||||
{% endblock -%}
|
{% endblock -%}
|
||||||
|
|
||||||
{% block scripts -%}
|
{% block scripts -%}
|
||||||
{% if not low_bandwidth -%}
|
|
||||||
{{ str(moment.include_moment(local_js='/static/js/moment-with-locales.min.js')).replace('<script>', '<script nonce="' + session['nonce'] + '">')|safe }}
|
|
||||||
{{ str(moment.lang(g.locale)).replace('<script>', '<script nonce="' + session['nonce'] + '">')|safe }}
|
|
||||||
{% endif -%}
|
|
||||||
{% endblock -%}
|
{% endblock -%}
|
||||||
{% if not low_bandwidth -%}
|
{% if not low_bandwidth -%}
|
||||||
{{ str(bootstrap.load_js()).replace('<script ', '<script nonce="' + session['nonce'] + '" ')|safe }}
|
{{ str(bootstrap.load_js()).replace('<script ', '<script nonce="' + session['nonce'] + '" ')|safe }}
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
{% for message in messages %}
|
{% for message in messages %}
|
||||||
<div id="message_{{ message.id }}" class="card message {{ 'from_other_party' if message.sender_id != current_user.id else 'from_me' }}">
|
<div id="message_{{ message.id }}" class="card message {{ 'from_other_party' if message.sender_id != current_user.id else 'from_me' }}">
|
||||||
<div class="message_body">
|
<div class="message_body">
|
||||||
<span class="message_created_at text-muted small">{{ moment(message.created_at).fromNow(refresh=True) }}</span>
|
<span class="message_created_at text-muted small">{{ arrow.get(message.created_at).humanize(locale=locale) }}</span>
|
||||||
<span class="message_sender"><a href="/u/{{ message.sender.link() }}">{{ message.sender.display_name() }}</a></span>: {{ message.body_html|safe }}
|
<span class="message_sender"><a href="/u/{{ message.sender.link() }}">{{ message.sender.display_name() }}</a></span>: {{ message.body_html|safe }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<td>{{ report.reasons }}</td>
|
<td>{{ report.reasons }}</td>
|
||||||
<td>{{ report.description }}</td>
|
<td>{{ report.description }}</td>
|
||||||
<td>{{ report.type_text() }}</td>
|
<td>{{ report.type_text() }}</td>
|
||||||
<td>{{ moment(report.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(report.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<a href="/u/{{ user.link() }}">{{ render_username(user) }}</a>
|
<a href="/u/{{ user.link() }}">{{ render_username(user) }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{% if user.is_local() %} Local {% else %} <a href="{{ user.ap_profile_id }}">{{ user.ap_domain }}</a>{% endif %}</td>
|
<td>{% if user.is_local() %} Local {% else %} <a href="{{ user.ap_profile_id }}">{{ user.ap_domain }}</a>{% endif %}</td>
|
||||||
<td>{{ moment(user.last_seen).fromNow() }} </td>
|
<td>{{ arrow.get(user.last_seen).humanize(locale=locale) }} </td>
|
||||||
<td>{{ user.ip_address if user.ip_address }} </td>
|
<td>{{ user.ip_address if user.ip_address }} </td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for modlog_entry in modlog_entries.items %}
|
{% for modlog_entry in modlog_entries.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ moment(modlog_entry.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(modlog_entry.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>{{ render_username(modlog_entry.author) }}</td>
|
<td>{{ render_username(modlog_entry.author) }}</td>
|
||||||
<td>{{ modlog_entry.action_to_str() }}
|
<td>{{ modlog_entry.action_to_str() }}
|
||||||
{% if modlog_entry.link and modlog_entry.link_text -%}
|
{% if modlog_entry.link and modlog_entry.link_text -%}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
{% for revision in revisions %}
|
{% for revision in revisions %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ render_username(revision.author) }}</td>
|
<td>{{ render_username(revision.author) }}</td>
|
||||||
<td>{{ moment(revision.edited_at).fromNow() }}</td>
|
<td>{{ arrow.get(revision.edited_at).humanize(locale=locale) }}</td>
|
||||||
<td class="text-right">{% if page.can_edit(current_user, community) %}
|
<td class="text-right">{% if page.can_edit(current_user, community) %}
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
<th scope="row" class="pl-0"><a href="/c/{{ community.link() }}" aria-label="{{ _('Browse %(name)s', name=community.display_name()) }}">{{ community.display_name() }}</a></th>
|
<th scope="row" class="pl-0"><a href="/c/{{ community.link() }}" aria-label="{{ _('Browse %(name)s', name=community.display_name()) }}">{{ community.display_name() }}</a></th>
|
||||||
<td>{{ community.post_count }}</td>
|
<td>{{ community.post_count }}</td>
|
||||||
<td>{{ community.post_reply_count }}</td>
|
<td>{{ community.post_reply_count }}</td>
|
||||||
<td>{{ moment(community.last_active).fromNow(refresh=True) }}</td>
|
<td>{{ arrow.get(community.last_active).humanize(locale=locale) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for modlog_entry in modlog_entries.items %}
|
{% for modlog_entry in modlog_entries.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ moment(modlog_entry.created_at).fromNow() }}</td>
|
<td>{{ arrow.get(modlog_entry.created_at).humanize(locale=locale) }}</td>
|
||||||
{% if can_see_names %}<td>{{ render_username(modlog_entry.author) }}</td>{% endif %}
|
{% if can_see_names %}<td>{{ render_username(modlog_entry.author) }}</td>{% endif %}
|
||||||
<td>{{ modlog_entry.action_to_str() }}
|
<td>{{ modlog_entry.action_to_str() }}
|
||||||
{% if modlog_entry.link and modlog_entry.link_text -%}
|
{% if modlog_entry.link and modlog_entry.link_text -%}
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
<p>{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) -%}
|
<p>{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) -%}
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}<small>submitted {{ moment(post.posted_at).fromNow() }} by {{ render_username(post.author) }}
|
{% endif -%}<small>submitted {{ arrow.get(post.posted_at).humanize(locale=locale) }} by {{ render_username(post.author) }}
|
||||||
{% if post.edited_at -%} edited {{ moment(post.edited_at).fromNow() }}{% endif -%}
|
{% if post.edited_at -%} edited {{ arrow.get(post.edited_at).humanize(locale=locale) }}{% endif -%}
|
||||||
</small></p>
|
</small></p>
|
||||||
<div class="post_image">
|
<div class="post_image">
|
||||||
{% if post.image_id -%}
|
{% if post.image_id -%}
|
||||||
|
@ -80,9 +80,9 @@
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
<p>{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) -%}
|
<p>{% if post.reports > 0 and current_user.is_authenticated and post.community.is_moderator(current_user) -%}
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check post for issues.') }}"></span>
|
||||||
{% endif -%}<small>submitted {{ moment(post.posted_at).fromNow() }} by
|
{% endif -%}<small>submitted {{ arrow.get(post.posted_at).humanize(locale=locale) }} by
|
||||||
{{ render_username(post.author) }}
|
{{ render_username(post.author) }}
|
||||||
{% if post.edited_at -%} edited {{ moment(post.edited_at).fromNow() }}{% endif -%}</small>
|
{% if post.edited_at -%} edited {{ arrow.get(post.edited_at).humanize(locale=locale) }}{% endif -%}</small>
|
||||||
</p>
|
</p>
|
||||||
{% if post.type == POST_TYPE_LINK -%}
|
{% if post.type == POST_TYPE_LINK -%}
|
||||||
<p><a href="{{ post.url }}" rel="nofollow ugc" target="_blank" class="post_link" aria-label="Go to post url">{{ post.url|shorten_url }}
|
<p><a href="{{ post.url }}" rel="nofollow ugc" target="_blank" class="post_link" aria-label="Go to post url">{{ post.url|shorten_url }}
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
<p>{{ _('Total votes: %(total_votes)d.', total_votes=poll_total_votes) }}</p>
|
<p>{{ _('Total votes: %(total_votes)d.', total_votes=poll_total_votes) }}</p>
|
||||||
<p>{{ _('Poll closes') }} {{ moment(poll_data.end_poll).fromNow(refresh=True) }}.</p>
|
<p>{{ _('Poll closes') }} {{ arrow.get(poll_data.end_poll).humanize(locale=locale) }}.</p>
|
||||||
{% elif poll_form -%}
|
{% elif poll_form -%}
|
||||||
{% if current_user.is_authenticated -%}
|
{% if current_user.is_authenticated -%}
|
||||||
<form action='/poll/{{ post.id }}/vote' method="post">
|
<form action='/poll/{{ post.id }}/vote' method="post">
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto text-muted small">
|
<div class="col-auto text-muted small">
|
||||||
{{ moment(post_reply.posted_at).fromNow(refresh=True) }}
|
{{ arrow.get(post_reply.posted_at).humanize(locale=locale) }}
|
||||||
{% if post_reply.edited_at -%}, edited {{ moment(post_reply.edited_at).fromNow(refresh=True) }} {% endif -%}
|
{% if post_reply.edited_at -%}, edited {{ arrow.get(post_reply.edited_at).humanize(locale=locale) }} {% endif -%}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
{% if post_reply.reports and current_user.is_authenticated and post_reply.post.community.is_moderator(current_user) -%}
|
{% if post_reply.reports and current_user.is_authenticated and post_reply.post.community.is_moderator(current_user) -%}
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">c/{{ post.community.name }}</a>{% endif -%}
|
<span class="author small">{% if show_post_community -%}<a href="/c/{{ post.community.link() }}" aria-label="{{ _('Go to community %(name)s', name=post.community.name) }}">c/{{ post.community.name }}</a>{% endif -%}
|
||||||
by {{ render_username(post.author) }} {{ moment(post.last_active if sort == 'active' else post.posted_at).fromNow() }}</span>
|
by {{ render_username(post.author) }} {{ arrow.get(post.last_active if sort == 'active' else post.posted_at).humanize(locale=locale) }}</span>
|
||||||
<div class="post_utilities">
|
<div class="post_utilities">
|
||||||
<a href="{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" aria-label="{{ _('View comments') }}"><span class="fe fe-reply"></span> <span aria-label="{{ _('Number of comments:') }}">{{ post.reply_count }}</span></a>
|
<a href="{{ url_for('activitypub.post_ap', post_id=post.id, sort='new' if sort == 'active' else None, _anchor='post_replies') }}" aria-label="{{ _('View comments') }}"><span class="fe fe-reply"></span> <span aria-label="{{ _('Number of comments:') }}">{{ post.reply_count }}</span></a>
|
||||||
{% if post.type == POST_TYPE_IMAGE -%}
|
{% if post.type == POST_TYPE_IMAGE -%}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
{{ render_username(comment['comment'].author) }}
|
{{ render_username(comment['comment'].author) }}
|
||||||
{% endwith -%}
|
{% endwith -%}
|
||||||
{% if comment['comment'].author.id == post.author.id %}<span title="Submitter of original post" aria-label="submitter" class="small">[OP] </span>{% endif %}
|
{% if comment['comment'].author.id == post.author.id %}<span title="Submitter of original post" aria-label="submitter" class="small">[OP] </span>{% endif %}
|
||||||
<span class="text-muted small">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at %}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif %}</span>
|
<span class="text-muted small">{{ arrow.get(comment['comment'].posted_at).humanize(locale=locale) }}{% if comment['comment'].edited_at %}, edited {{ arrow.get(comment['comment'].edited_at).humanize(locale=locale) }} {% endif %}</span>
|
||||||
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
||||||
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
|
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check comment for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check comment for issues.') }}"></span>
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
{{ render_username(comment['comment'].author) }}
|
{{ render_username(comment['comment'].author) }}
|
||||||
{% endwith -%}
|
{% endwith -%}
|
||||||
{% if comment['comment'].author.id == post.author.id -%}<span title="Submitter of original post" aria-label="{{ _('Post creator') }}" class="small">[OP] </span>{% endif -%}
|
{% if comment['comment'].author.id == post.author.id -%}<span title="Submitter of original post" aria-label="{{ _('Post creator') }}" class="small">[OP] </span>{% endif -%}
|
||||||
<span class="text-muted small" aria_label="{{ _('When: ') }}">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at -%}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif -%}</span>
|
<span class="text-muted small" aria_label="{{ _('When: ') }}">{{ arrow.get(comment['comment'].posted_at).humanize(locale=locale) }}{% if comment['comment'].edited_at -%}, edited {{ arrow.get(comment['comment'].edited_at).humanize(locale=locale) }} {% endif -%}</span>
|
||||||
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
<a class="unhide" href="#"><span class="fe fe-expand"></span></a>
|
||||||
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
|
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
|
||||||
<span class="red fe fe-report" title="{{ _('Reported. Check comment for issues.') }}"></span>
|
<span class="red fe fe-report" title="{{ _('Reported. Check comment for issues.') }}"></span>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<a href="{{ url_for('user.notification_goto', notification_id=notification.id) }}">{{ notification.title }}</a>
|
<a href="{{ url_for('user.notification_goto', notification_id=notification.id) }}">{{ notification.title }}</a>
|
||||||
{% if not notification.read %}</strong>{% endif %}
|
{% if not notification.read %}</strong>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ moment(notification.created_at).fromNow(refresh=True) }}</td>
|
<td>{{ arrow.get(notification.created_at).humanize(locale=locale) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('user.notification_delete', notification_id=notification.id) }}" class="no-underline"><span class="fe fe-delete"></span> {{ _('Delete') }}</a>
|
<a href="{{ url_for('user.notification_delete', notification_id=notification.id) }}" class="no-underline"><span class="fe fe-delete"></span> {{ _('Delete') }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -89,8 +89,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p class="small">{{ _('Joined') }}: {{ moment(user.created).fromNow(refresh=True) }}<br />
|
<p class="small">{{ _('Joined') }}: {{ arrow.get(user.created).humanize(locale=locale) }}<br />
|
||||||
{% if current_user.is_authenticated and current_user.is_admin() and user.last_seen %}{{ _('Active') }}: {{ moment(user.last_seen).fromNow(refresh=True) }}<br />{% endif %}
|
{% if current_user.is_authenticated and current_user.is_admin() and user.last_seen %}{{ _('Active') }}: {{ arrow.get(user.last_seen).humanize(locale=locale) }}<br />{% endif %}
|
||||||
{% if user.bot %}
|
{% if user.bot %}
|
||||||
{{ _('Bot Account') }}<br />
|
{{ _('Bot Account') }}<br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -6,7 +6,7 @@ from flask_babel import get_locale
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from app import create_app, db, cli
|
from app import create_app, db, cli
|
||||||
import os, click
|
import os, arrow
|
||||||
from flask import session, g, json, request, current_app
|
from flask import session, g, json, request, current_app
|
||||||
from app.constants import POST_TYPE_LINK, POST_TYPE_IMAGE, POST_TYPE_ARTICLE, POST_TYPE_VIDEO, POST_TYPE_POLL, \
|
from app.constants import POST_TYPE_LINK, POST_TYPE_IMAGE, POST_TYPE_ARTICLE, POST_TYPE_VIDEO, POST_TYPE_POLL, \
|
||||||
SUBSCRIPTION_MODERATOR, SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER, SUBSCRIPTION_PENDING
|
SUBSCRIPTION_MODERATOR, SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER, SUBSCRIPTION_PENDING
|
||||||
|
@ -24,6 +24,7 @@ def app_context_processor():
|
||||||
def getmtime(filename):
|
def getmtime(filename):
|
||||||
return os.path.getmtime('app/static/' + filename)
|
return os.path.getmtime('app/static/' + filename)
|
||||||
return dict(getmtime=getmtime, instance_domain=current_app.config['SERVER_NAME'], debug_mode=current_app.debug,
|
return dict(getmtime=getmtime, instance_domain=current_app.config['SERVER_NAME'], debug_mode=current_app.debug,
|
||||||
|
arrow=arrow, locale=g.locale,
|
||||||
POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE,
|
POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE,
|
||||||
POST_TYPE_ARTICLE=POST_TYPE_ARTICLE, POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL,
|
POST_TYPE_ARTICLE=POST_TYPE_ARTICLE, POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL,
|
||||||
SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER,
|
SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER,
|
||||||
|
|
|
@ -7,7 +7,6 @@ flask-migrate==4.0.4
|
||||||
flask-login==0.6.2
|
flask-login==0.6.2
|
||||||
email-validator==2.0.0
|
email-validator==2.0.0
|
||||||
flask-mail==0.9.1
|
flask-mail==0.9.1
|
||||||
flask-moment==1.0.5
|
|
||||||
flask-babel==3.1.0
|
flask-babel==3.1.0
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue