Ticket #5578: 0001-Add-datetime_format-config-option.patch

File 0001-Add-datetime_format-config-option.patch, 7.6 KB (added by Olivier Mehani, 5 years ago)
  • mediagoblin/config_spec.ini

    From c014693c5b67004bb0e968078fec8aedffdd2ea0 Mon Sep 17 00:00:00 2001
    From: Olivier Mehani <shtrom+mediagoblin@ssji.net>
    Date: Sun, 3 Mar 2019 22:17:27 +1100
    Subject: [PATCH] Add datetime_format config option
    
    Signed-off-by: Olivier Mehani <shtrom+mediagoblin@ssji.net>
    ---
     mediagoblin/config_spec.ini                                 | 3 +++
     .../mediagoblin/fragments/header_notifications.html         | 2 +-
     mediagoblin/templates/mediagoblin/media_displays/image.html | 2 +-
     mediagoblin/templates/mediagoblin/moderation/report.html    | 6 +++---
     .../templates/mediagoblin/user_pages/blog_media.html        | 4 ++--
     mediagoblin/templates/mediagoblin/user_pages/media.html     | 4 ++--
     mediagoblin/templates/mediagoblin/user_pages/report.html    | 2 +-
     7 files changed, 13 insertions(+), 10 deletions(-)
    
    diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
    index c696c327..8901cefa 100644
    a b no_referrer = boolean(default=True)  
    9292# Push stuff
    9393push_urls = string_list(default=list())
    9494
     95# Python strftime's format [0]
     96# https://docs.python.org/library/datetime.html#strftime-strptime-behavior
     97datetime_format = string(default="%I:%M%p %Y-%m-%d")
    9598exif_visible = boolean(default=False)
    9699original_date_visible = boolean(default=False)
    97100
  • mediagoblin/templates/mediagoblin/fragments/header_notifications.html

    diff --git a/mediagoblin/templates/mediagoblin/fragments/header_notifications.html b/mediagoblin/templates/mediagoblin/fragments/header_notifications.html
    index 58960e7a..1e1683a0 100644
    a b  
    2121                            user=comment_target.get_actor.username,
    2222                            media=comment_target.slug_or_id) }}#comment"
    2323                    class="comment_whenlink">
    24                     <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     24                    <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'>
    2525                    {%- trans formatted_time=timesince(comment_object.created) -%}
    2626                        {{ formatted_time }} ago
    2727                    {%- endtrans -%}
  • mediagoblin/templates/mediagoblin/media_displays/image.html

    diff --git a/mediagoblin/templates/mediagoblin/media_displays/image.html b/mediagoblin/templates/mediagoblin/media_displays/image.html
    index d0050f50..93bd72a0 100644
    a b  
    3535    {% if original_date %}
    3636      <h3>{% trans %}Created{% endtrans %}</h3>
    3737
    38       <p><span title="{{ original_date.strftime("%I:%M%p %Y-%m-%d") }}">
     38      <p><span title="{{ original_date.strftime(app_config['datetime_format']) }}">
    3939        {%- trans formatted_time=timesince(original_date) -%}
    4040          {{ formatted_time }} ago
    4141        {%- endtrans -%}
  • mediagoblin/templates/mediagoblin/moderation/report.html

    diff --git a/mediagoblin/templates/mediagoblin/moderation/report.html b/mediagoblin/templates/mediagoblin/moderation/report.html
    index abbd4a0c..efd1adae 100644
    a b  
    5454                        user=target.get_actor.username,
    5555                        media=target.slug_or_id) }}#comment"
    5656           class="comment_whenlink">
    57           <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     57          <span title='{{- comment.created.strftime(app_config['datetime_format']) -}}'>
    5858            {%- trans formatted_time=timesince(comment.created) -%}
    5959              {{ formatted_time }} ago
    6060            {%- endtrans -%}
     
    117117        <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
    118118                        report_id=report.id) }}"
    119119           class="report_whenlink">
    120           <span title='{{- report.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     120          <span title='{{- report.created.strftime(app_config['datetime_format']) -}}'>
    121121            {%- trans formatted_time=timesince(report.created) -%}
    122122              {{ formatted_time }} ago
    123123            {%- endtrans -%}
     
    150150          {% trans %}Status{% endtrans %}:
    151151    </h2>
    152152    <b>{% trans %}RESOLVED{% endtrans %}</b>
    153     {{ report.resolved.strftime("%I:%M%p %Y-%m-%d") }}
     153    {{ report.resolved.strftime(app_config['datetime_format']) }}
    154154    <pre>
    155155      <p>{{ report.result }}</p>
    156156    </pre>
  • mediagoblin/templates/mediagoblin/user_pages/blog_media.html

    diff --git a/mediagoblin/templates/mediagoblin/user_pages/blog_media.html b/mediagoblin/templates/mediagoblin/user_pages/blog_media.html
    index 24328725..322770f4 100644
    a b  
    128128                            user=media.get_actor.username,
    129129                            media=media.slug_or_id) }}#comment"
    130130               class="comment_whenlink">
    131               <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     131              <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'>
    132132                {%- trans formatted_time=timesince(comment_object.created) -%}
    133133                  {{ formatted_time }} ago
    134134                {%- endtrans -%}
     
    148148  </div>
    149149  <div class="media_sidebar">
    150150    <h3>{% trans %}Added{% endtrans %}</h3>
    151     <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
     151    <p><span title="{{ media.created.strftime(app_config['datetime_format']) }}">
    152152        {%- trans formatted_time=timesince(media.created) -%}
    153153          {{ formatted_time }} ago
    154154        {%- endtrans -%}
  • mediagoblin/templates/mediagoblin/user_pages/media.html

    diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
    index b93da06e..39a09d45 100644
    a b  
    148148                            user=media.get_actor.username,
    149149                            media=media.slug_or_id) }}#comment"
    150150               class="comment_whenlink">
    151               <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     151              <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'>
    152152                {%- trans formatted_time=timesince(comment_object.created) -%}
    153153                  {{ formatted_time }} ago
    154154                {%- endtrans -%}
     
    183183
    184184  <div class="five columns media_sidebar">
    185185    <h3>{% trans %}Added{% endtrans %}</h3>
    186     <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
     186    <p><span title="{{ media.created.strftime(app_config['datetime_format']) }}">
    187187        {%- trans formatted_time=timesince(media.created) -%}
    188188          {{ formatted_time }} ago
    189189        {%- endtrans -%}
  • mediagoblin/templates/mediagoblin/user_pages/report.html

    diff --git a/mediagoblin/templates/mediagoblin/user_pages/report.html b/mediagoblin/templates/mediagoblin/user_pages/report.html
    index 4a88f4b7..78bcc62a 100644
    a b  
    3838                            user=media.get_actor.username,
    3939                            media=media.slug_or_id) }}#comment"
    4040               class="comment_whenlink">
    41               <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
     41              <span title='{{- comment_object.created.strftime(app_config['datetime_format']) -}}'>
    4242                {%- trans formatted_time=timesince(comment_object.created) -%}
    4343                  {{ formatted_time }} ago
    4444                {%- endtrans -%}