SO-Close-Vote-Reviewers / UserScripts

Various user scripts that add features to the review queue or to the chat room
Other
56 stars 41 forks source link

URRS: undel-pls requests don't show number of undelete votes #210

Open blackgreen100 opened 2 years ago

blackgreen100 commented 2 years ago

Unlike other *-pls requests, undel-pls ones do not show the number of undelete votes on deleted posts, instead it only shows deleted. In case of undel-pls this display is not particularly helpful — although in case of a completed request, i.e. post successfully undeleted, the deleted suffix would presumably disappear.

See below screenshot:

img

Current available solution seems to scrape the page of the deleted post to obtain number of undelete votes. It would be available to 10k+ users only.

Possible display:

u:(2)

Possible display in case of users without necessary privilege level:

N.A.

makyen commented 1 year ago

The URRS uses the SE API to get data about posts. The SE API provides almost no information about deleted posts, so the URRS isn't able to obtain the number of undelete votes from the SE API. As mentioned in the original comment here, it would be necessary to get the data in another manner.

A better alternative to fetching multiple individual question pages would be to obtain the HTML for the posts from the SE-internal /posts/ajax-load-realtime/${list of semicolon delimited post IDs} endpoint, which allows getting the HTML for a substantial number of individual posts in a single AJAX call. As with the question pages, data for deleted posts is only returned from the realtime posts endpoint for users with the view deleted posts privilege. Both of these methods of getting data provide the HTML for the page or post, which would then need to be parsed to scrape the number of undelete votes.