Merge pull request #790 from mouse-reeve/status-ordering

Status ordering
This commit is contained in:
Mouse Reeve 2021-03-24 08:51:51 -07:00 committed by GitHub
commit a0793a15f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 1 deletions

View file

@ -23,6 +23,7 @@ POSTGRES_DB=fedireads
POSTGRES_HOST=db
# Redis activity stream manager
MAX_STREAM_LENGTH=200
REDIS_ACTIVITY_HOST=redis_activity
REDIS_ACTIVITY_PORT=6379

View file

@ -0,0 +1,17 @@
# Generated by Django 3.1.6 on 2021-03-24 15:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0057_user_discoverable"),
]
operations = [
migrations.AlterModelOptions(
name="status",
options={"ordering": ("-published_date",)},
),
]

View file

@ -58,6 +58,11 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
serialize_reverse_fields = [("attachments", "attachment", "id")]
deserialize_reverse_fields = [("attachments", "attachment")]
class Meta:
""" default sorting """
ordering = ("-published_date",)
def save(self, *args, **kwargs):
""" save and notify """
super().save(*args, **kwargs)

View file

@ -96,7 +96,7 @@ WSGI_APPLICATION = "bookwyrm.wsgi.application"
REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost")
REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379)
MAX_STREAM_LENGTH = env("MAX_STREAM_LENGTH", 200)
MAX_STREAM_LENGTH = int(env("MAX_STREAM_LENGTH", 200))
STREAMS = ["home", "local", "federated"]
# Database