I looked through the code, making sure it batches the Cassandra commits and updates the cached query get_hidden_links. (That code was already in class LinkHidesByAccount.)
Then executes Link._something or _unsomething to add a SaveHide relation with name='hide' for each link.
That part has a _commit() per Link, but I assume that's fine since that's how it's done in e.g. Inbox.set_unread()
batch hide and unhide API
I'd love to see this feature get in, but I'm not sure if reddit would suffer performance wise from having much bigger quantities of hidden posts...
a very, very common RES feature request is a bulk hide option, but I won't implement it due to the number of API hits required... this would make that a much more reasonable feature request, but I'm wondering if maybe the reason Reddit hasn't allowed a hide-many via the API is for performance reasons.
to be clear: I have no idea how it would affect performance. I'm not deeply familiar with the internals.
I'm curious, what do people need batch hides/unhides for?
@honestbleeps I think it'll have a similar performance impact to the "don't show links after I've liked/disliked them" option, since likes, dislikes, and hidden seem to be stored the same way in the backend, at least from my superficial understanding.
@spladug It's nice for batch-hide in clients. E.g., a Hide All button for a page of posts.
@spladug I don't do this, but a use case for a lot of people is: view a page of content... hide all.. refresh... they want new content, and pagination isn't their bag for whatever reason... maybe because pages shuffle so much that they see lots of dupe content when they go through pages? I dunno. I just know it's an oft-requested feature... like REALLY often.
I'll have to say that this used to be my moderation method. Go through the first 100 submissions in /new, hide-all, repeat (until there's nothing left).
Thanks for the pull request. After further consideration, I think I'd rather not merge this functionality and encourage such behaviour. The reason for this is that if a user has a lot of hidden links, the builder (which takes a list of links in the subreddit and determines which ones should be visible and which hidden) has to do an increasing number of backend lookups rather than getting everything it needs in one go. This would mean that users going crazy with batch hides would see their listing requests slow down the more they do so.
@spladug All right, thanks for the explanation.