From 01f2cc7d350efc0c03d5b04eda1610816ad1985f Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Sun, 27 Jan 2019 22:16:15 -0500 Subject: [PATCH] Fix more ID format issues with Pleroma Paging is still not working. --- .../migrations/0020_auto_20190127_2159.py | 18 ++++++++++++++++++ brutaldon/models.py | 2 +- brutaldon/views.py | 6 +++--- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 brutaldon/migrations/0020_auto_20190127_2159.py diff --git a/brutaldon/migrations/0020_auto_20190127_2159.py b/brutaldon/migrations/0020_auto_20190127_2159.py new file mode 100644 index 0000000..53846bb --- /dev/null +++ b/brutaldon/migrations/0020_auto_20190127_2159.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-01-28 02:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('brutaldon', '0019_auto_20190124_0813'), + ] + + operations = [ + migrations.AlterField( + model_name='account', + name='note_seen', + field=models.CharField(blank=True, max_length=128, null=True), + ), + ] diff --git a/brutaldon/models.py b/brutaldon/models.py index 9ccc06d..82d6dab 100644 --- a/brutaldon/models.py +++ b/brutaldon/models.py @@ -51,5 +51,5 @@ class Account(models.Model): access_token = models.CharField(null=True, blank=True, max_length=2048) client= models.ForeignKey(Client, models.SET_NULL, null=True) preferences = models.ForeignKey(Preference, models.SET_NULL, null=True) - note_seen = models.IntegerField(null=True) + note_seen = models.CharField(null=True, blank=True, max_length=128) diff --git a/brutaldon/views.py b/brutaldon/views.py index ceb451a..aa48194 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -47,7 +47,7 @@ def _notes_count(account, mastodon): notes = [ note for note in notes if note.type == 'mention' or note.type == 'follow'] for index, item in enumerate(notes): if account.note_seen is None: - account.note_seen = 0 + account.note_seen = "0" account.save() if item.id <= account.note_seen: break @@ -121,7 +121,7 @@ def user_search_inner(request, query): def timeline(request, timeline='home', timeline_name='Home', max_id=None, since_id=None): account, mastodon = get_usercontext(request) - data = mastodon.timeline(timeline, limit=100, max_id=max_id, since_id=since_id) + data = mastodon.timeline(timeline, limit=40, max_id=max_id, since_id=since_id) form = PostForm(initial={'visibility': request.session['user'].source.privacy}) try: prev = data[0]._pagination_prev @@ -349,7 +349,7 @@ def note(request, next=None, prev=None): account.note_seen = last_seen.id account.save() - notes = mastodon.notifications(limit=100, max_id=next, since_id=prev) + notes = mastodon.notifications(limit=40, max_id=next, since_id=prev) if account.preferences.filter_notifications: notes = [ note for note in notes if note.type == 'mention' or note.type == 'follow'] try: