andrewbanchich / shreddit

Delete your Reddit data.
MIT License
247 stars 11 forks source link

Add ability to shred saved posts and comments #68

Closed StaticRocket closed 1 year ago

StaticRocket commented 1 year ago

Allow users to shred comments and posts through the OAuth API.

We can't really limit this in a reasonable manner though. They don't appear to track when a post is saved.

andrewbanchich commented 1 year ago

We can't really limit this in a reasonable manner though. They don't appear to track when a post is saved.

What do you mean?

StaticRocket commented 1 year ago

Hi! Thanks for the PR. Since save_comments module looks almost exactly like the save_posts, could you just change the existing module to be saved? and use it for both types?

Sure, but I don't have an account to test this on anymore.

We can't really limit this in a reasonable manner though. They don't appear to track when a post is saved.

What do you mean?

I was going to apply the filtering logic that user post's get and try to allow users to set a "after x" flag, but reddit doesn't seem to make that information available.

andrewbanchich commented 1 year ago

I'll can test it before merging.

Yeah, good point. Maybe if the saved thing doesn't have the data of when it was saved and if the time filter is set, just log a warn! and skip it.

StaticRocket commented 1 year ago

Hi! Thanks for the PR. Since save_comments module looks almost exactly like the save_posts, could you just change the existing module to be saved? and use it for both types?

Sure, but I don't have an account to test this on anymore.

Actually, wait. Why would you do that? There's only a few lines of reuse and it's technically only in the implementation of the shred trait. I can't think of a slick way to merge them without adding extra overhead.

Scratch that. I've got one last idea but it'll change the call pattern in main for api queries.

StaticRocket commented 1 year ago

Alright @andrewbanchich , first stab at rust's advanced traits. Let me know if this looks sane.

andrewbanchich commented 1 year ago

I didn't think you'd need generics / traits at all :smile: The two looks pretty much the same to me. They have the same JSON structure, etc right? What's the purpose of the generic?

andrewbanchich commented 1 year ago

If you'd like to revert to the previous commit where it's two files, I can merge the two if that's easier for you. Up to you!

StaticRocket commented 1 year ago

I didn't think you'd need generics / traits at all smile The two looks pretty much the same to me. They have the same JSON structure, etc right? What's the purpose of the generic?

They have the same json structure but the information you attach to them (FILENAME and TYPE_ID) are different. I was trying to keep that component the same so that if there are any checks on those traits anywhere else in the project then it's still fine. Maybe I'm still overthinking it...

andrewbanchich commented 1 year ago

That's a good point. Since they have different type IDs and different file names, I would prefer to keep them as complete separate types without using generics. Sorry for the confusion!

andrewbanchich commented 1 year ago

Great, thank you so much!