2fast2fourier / something.apk

It's pretty bad.
MIT License
15 stars 12 forks source link

Ignored posts fail to parse with missing data-idx field. #11

Open 2fast2fourier opened 9 years ago

2fast2fourier commented 9 years ago

It looks like the forums don't include 'data-idx' in ignored posts, and the parser fails at that point.

<table class="post ignored" id="post443956886">...</table>

Should have been:

<table class="post " id="post443956036" data-idx="31208">...</table>

The affected line is https://github.com/2fast2fourier/something.apk/blob/master/Something/src/main/java/net/fastfourier/something/request/ThreadPageRequest.java#L194 It's used further down that page to generate the lastReadId to allow the user to mark last read position.

We can use fallback value in the lastread button itself, but this button is not always there. It won't appear if the user turns the option off in the forum settings. The last read id is the index query param in the last-read button:

<a class="lastseen_icon" href="/showthread.php?action=setseen&threadid=3647096&index=31209" title="..">...</a>

So we still have a potential situation where both data-idx and index are missing.

MasterOdin commented 9 years ago

I suspect the only real solution is to not allow the "Set Last Read" option on ignored posts if the secondary index is not available as there's no way to get that index otherwise (as viewing the single post of an ignored user doesn't give us a data-idx, and would just cause increased data usage/load times).

Of course, need to make sure there is a way to view posts of an ignored user in the app (gives a link you can click to view the single post, keeping the previous screen on the stack).

MasterOdin commented 9 years ago

It's actually https://github.com/2fast2fourier/something.apk/blob/master/Something/src/main/java/net/fastfourier/something/request/ThreadPageRequest.java#L202 that's the issue as this element doesn't appear on ignored users. However, I changed this since you couldn't filter by user using user_jump only as it doesn't contain the user-id once viewing the filter (it just contains postid). This causes an exception to be thrown. However, profilelinks is empty if you're ignoring a user (even if you're filtering by user), meaning this is causing an exception to be thrown.

MasterOdin commented 9 years ago

Looking at this, I think the best possible course of action would be:

  1. Check "userinfo" class to see if it contains a user-id.
  2. If fail, check for profilelinks for user id

From some poking around, (1) will only fail if (a) you're in BYOB and (b) you're viewing an unignored user, which (2) should always succeed there. If you're viewing BYOB and it's an ignored user, (1) will work (as suddenly there's user-id. Yeah for terrible forum code.) so you can filter the thread by anyone which is weird for ignored users, but maintains consistency and no "special cases".