-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expire only boosts #40
Comments
Do you want to add such a feature? I don’t think I will be adding this myself, though. Perhaps somebody else will volunteer.
|
@lapineige what exactly do you mean by boosted toots? Option A seems difficult to implement, but option B should be relatively easy. Essentially, you need a version with these lines removed: |
If you want to make a patch, you will need to add an option here: |
I mean option b :) I don't have the time right now, but I'll have a look. |
i need it, maybe i'll implement. |
Very cool, thanks!
|
Hello, any update on this ? :) |
I’m not working on it, if that’s what you mean… Sorry!
|
I'm actually wondering if it expires boost right now… I've searched my old post, and the classic toots seems to be deleted, while boosts are still there. |
I think it does! But perhaps there’s a bug?
|
How can I check this ? |
Another person reported to me that her boost were not expired.
|
What happens when you run |
It's just expiring toots… normal output, Loading archive then expiring. Note that there is an issue when expiring favorites:
|
I’m interested in seeing whether you specify the collection – if it’s expiring toots it is not expecting favorites and vice verse.
|
Hi!
No more statuses on my account (when connected on the web ui of my instance), but only the 3K+ boosts reported here. If I understand it clearly, your program doesn't erase all my stuff with the same command, need to run it with appropriate command (not a bad thing). So : Basically all that you kindly suggest in your example setup : https://github.com/kensanata/mastodon-backup#example-setup extra-step : 6- Still have all the boosts! ^_^! (statuses from other people that i boosted) Sorry, I'm not a programmer and I just don't understand what BartG95 suggested to do earlier :/ Besides that, thanks for your program and your help, have a good day ^_^ |
Well I specify |
Hm. Let's see… This is the code that does the deleting. Apparently you need to specify the def delete(mastodon, collection, status):
"""
Delete toot, unfavour favourite, or dismiss notification and mark
it as deleted. The "record not found" error is handled elsewhere.
"""
if collection == 'statuses':
if status["reblog"]:
mastodon.status_unreblog(status["id"])
else:
mastodon.status_delete(status["id"])
elif collection == 'favourites':
mastodon.status_unfavourite(status["id"])
elif collection == 'mentions':
mastodon.notifications_dismiss(status["id"])
status["deleted"] = True So, either the status isn't marked as "reblog" on the archive, or the code isn't finding it, or the status isn't in the archive in the first place. So, looking for a status in the JSON file with I'm opening my text editor, loading the JSON file, and looking for this string… Finding this one: {
"id": 100148697908936006,
"created_at": "2018-06-04T21:30:56.281000+00:00",
...
"url": "https://octodon.social/@kensanata/100148697908936006",
...
"reblogged": false,
...
"reblog": {
"id": 100148655205233270,
"created_at": "2018-06-04T21:19:55+00:00",
...
"url": "https://trunk.mad-scientist.club/@algernon/100148654631327735",
...
"reblogged": true,
... Let's check! I'm searching for So, it seems to be working. I think I'd need this kind of investigation from one of you. For example:
|
Hello and thanks for your reply ^_^
So even if i visit this particular toot alone, it appears as boosted. |
I'm not sure that's how you read it. I read it like this: you did
That is of course always possible but not a very satisfying answer. I
The code also says the following: def matches(status):
created = datetime.strptime(status["created_at"][0:10], "%Y-%m-%d")
deleted = "deleted" in status and status["deleted"] == True
pinned = "pinned" in status and status["pinned"] == True
return created < cutoff and not deleted and not pinned
statuses = list(filter(matches, data[collection])) That is, we're not doing anything to statuses that are marked as {
"id": 100148697908936006,
...
"reblog": {
"id": 100148655205233270,
...
"reblogged": true,
...
"account": {
"id": 23975,
"username": "algernon",
...
},
...
},
"application": null,
"account": {
"id": 12540,
"username": "kensanata",
...
"deleted": true
}, That is, my own "reblogging action" (id 100148697908936006) is marked as I wonder, however. Perhaps my code is confusing the two ids? What def delete(mastodon, collection, status):
"""
Delete toot, unfavour favourite, or dismiss notification and mark
it as deleted. The "record not found" error is handled elsewhere.
"""
if collection == 'statuses':
if status["reblog"]:
mastodon.status_unreblog(status["id"])
else:
mastodon.status_delete(status["id"])
elif collection == 'favourites':
mastodon.status_unfavourite(status["id"])
elif collection == 'mentions':
mastodon.notifications_dismiss(status["id"])
status["deleted"] = True As you can see, the delete code then checks whether the status contains So now I'm wondering: perhaps the code should be changed to the def delete(mastodon, collection, status):
"""
Delete toot, unfavour favourite, or dismiss notification and mark
it as deleted. The "record not found" error is handled elsewhere.
"""
if collection == 'statuses':
if status["reblog"]:
mastodon.status_unreblog(status["reblog"]["id"]) # ← THIS!
else:
mastodon.status_delete(status["id"])
elif collection == 'favourites':
mastodon.status_unfavourite(status["id"])
elif collection == 'mentions':
mastodon.notifications_dismiss(status["id"])
status["deleted"] = True Can you make this change to your copy and give it a try? (Sadly, I will be leaving for a trip, soon, and won't be able to get |
Hello, |
I'm back from my trip. Did it work as intended, @Mellerin? |
Hello and wb o/ I hope everything's going well for you during these troubled times. Well, it worked i suppose, it just lets some boosted toots and the very end of my own timeline. I didn't investigate yet exactly why except that the (few) statuses that remain go to a "the page you are looking for isn't here" on the mastodon web interface, maybe deleted statuses but looks like it's not a problem with mastodon-archive ^_^
I detailed all the things i've done, not sure all the steps are necessary neither the right ones to do ^_^! Little edit : btw I'm not sure it answers exactly what @lapineige asked at the very beginning ? |
Add ["reblog"] status type to the unreblog function because just ["id"] let some boosted statuses and does not unreblog them. See kensanata#40
If this is good enough for you, @lapineige, please close this issue. Otherwise I'm going to assume that you still want an option to expire only boosts without expiring your own toots. |
Sorry I read the whole conversation but had no time to react/test it myself. If I understand well the changes, now I need to make my archive again (to create the "reblog" category) and then remove toots just like before and it will include all reblogs ? Well an option would be cool, but maybe I can make the PR myself :) |
No change is required for you; from now on it should simply unboost the correct id because it uses the id of the boosted status to unboost instead of the irrelevant id of your boost action.
|
Ok thanks. I guess I need to wait for the next release ? |
Depends on how comfortable you are with simply installing from source. 😀
I just use the advice given here: https://github.com/kensanata/mastodon-backup/blob/master/README.md#development
Check it out using git; run pip3 install --upgrade --editable .
|
Finally I don't think I'll try a non-release version. |
I made a release 1.3.1. |
Yeah 🎉 Thanks a lot ! So I tried it… I was planning to delete old boosts, on data that was already "deleted" (but not the boosts). Could it be that it tried to delete them, marked them as "deleted", and then it won't try again because it is supposed to already be removed ? |
Hm, could be. What do you think we should do, now? Perhaps we could write a command that goes through all the boosts and marks them as not deleted? |
That's a possibility indeed 🤔 |
I am super confused when I read through this thread. 😅 I wrote a new subcommand,
If you don't confirm, it prints how many changes it would have made, and twenty examples. To verify, you need to paste these URLs into the search box of your Mastodon account so that you can see whether they are still boosted. This is important: if you just click on the links and look at them in your browser, they will always look unboosted. Let me know if that fixes it for your? I would like to avoid making a release for this. I'd love for you to test it from the git repository:
That should get you commit bc891f7. Once you do confirm (make a copy of your archive first, just in case!) it makes the changes and then the next time you run |
Coming back to this issue after a while… I am a bit lost 😅 I will give it a try 🙂. |
This has been integrated into mastodon-archive for a long time time, now. Two years ago was the last commit referring to fix-boosts. |
Ok sorry I didn't catch that change. Thank you :) |
So the fix-boosts command does give a list of still boosted toots. Great ! But how can I expire them ? Thank you |
Ok I think I figured out : I need to run the fix-boosts command (with --confirmed option) to mark them as non expired, then run the expire command. But that means I can't expire only boosts. |
Hm, indeed, there currently is no option to delete just boosts. I think you are right. In def delete(mastodon, collection, status):
"""
Delete toot or unfavour favourite and mark it as deleted. The
"record not found" error is handled elsewhere. Mentions cannot be
dismissed because mastodon.notifications_dismiss requires a
notification id, not a status id.
"""
if collection == 'statuses':
if status["reblog"]:
mastodon.status_unreblog(status["reblog"]["id"])
status["deleted"] = True
else:
mastodon.status_delete(status["id"])
status["deleted"] = True
elif collection == 'favourites':
mastodon.status_unfavourite(status["id"])
status["deleted"] = True
elif collection == 'boosts' and status["reblog"]:
mastodon.status_unreblog(status["reblog"]["id"])
status["deleted"] = True This assumes we don't want to change the existing functionality for the "statuses" collection. I'm not sure what would be best, here. For the command line option in parser_content.add_argument("--collection", dest='collection',
choices=['statuses', 'favourites', 'mentions', 'boosts'],
default='statuses',
help='delete statuses, unfavour favourites, clear mention notifications, or only boosts') Now there's still a problem: boosts are stored as statuses "containing" the boosted status in the "reblog" attribute. If we use "--collection=boosts" then the code in Something needs to change in statuses = list(filter(matches, data[if collection == "boosts" then "statuses" else collection])) All of the code examples untested. 😢 I'm leaving on a trip for the next few days so there's going to be no answer for a while. Give it a try, perhaps with a test account. 😅 We could of course just add a different option, |
Wow that's great ! I think I'll try some dry-run first :D |
Hello,
Is it possible to add an option to expire only our boosted toots, instead of expiring all statuses ?
Thanks
The text was updated successfully, but these errors were encountered: