Fix more ID format issues with Pleroma

Paging is still not working.
This commit is contained in:
Jason McBrayer 2019-01-27 22:16:15 -05:00
parent 705ea8917b
commit 01f2cc7d35
3 changed files with 22 additions and 4 deletions

View File

@ -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),
),
]

View File

@ -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)

View File

@ -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: