vyznev / soup

Stack Overflow Unofficial Patch
27 stars 6 forks source link

SOUP beta site detection is broken and should be replaced with a privileges API query #37

Open vyznev opened 6 years ago

vyznev commented 6 years ago

It appears that the CSS-sniffing hack used to set the SOUP.isBeta flag (which in turn is user to determine the rep threshold for various privileges) does not work (at least) on Chrome 67, causing the flag to always be false.

Fortunately, the only fix currently (as of SOUP v1.52) using this flag is mse115702. Thus, the only visible effect of this breakage is that delete links may not appear when they should when downvoting an answer to -1 on a beta site for users with at least 4k but less than 20k rep.

In any case, with the advent of design-independent graduation, the whole idea of this flag has become fundamentally misguided. The proper fix would be to replace it with an SE API user privileges query. The tricky part here is that we want to minimize the number of API queries made, which implies at least heavy caching of the results (e.g. in LocalStorage) and probably also on-demand fetching (with its attendant asynchronous complications).

The API query implementation from the Bounty Bar user script could presumably be used as a basis for this. It's rather bare-bones, but it seems to work well enough.