Skip to content
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

[feature] Allow import of following and blocks via CSV #3150

Merged
merged 3 commits into from
Aug 2, 2024

Conversation

tsmethurst
Copy link
Contributor

@tsmethurst tsmethurst commented Jul 29, 2024

Description

If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.

If this is a documentation change, please briefly describe what you've changed and why.

Second part of (and depends on) #3140.

Adds data import functionality via Mastodon-formatted CSV files uploaded via the settings panel.

Just added following and blocks for now since they're probably the most useful ones, we can add the others later on (I wanted to keep the PR relatively small + reviewable).

Draft until #3140 is squerged, at which point I'll rebase this one and write some tests and all that jazz.

Closes #1048
Closes #896 (more or less).

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@tsmethurst tsmethurst force-pushed the data_import branch 2 times, most recently from 131e067 to 0c1fad2 Compare July 31, 2024 16:30
@tsmethurst tsmethurst marked this pull request as ready for review August 1, 2024 08:46
defer file.Close()

// Parse records out of the file.
records, err := csv.NewReader(file).ReadAll()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not something that needs changing now, but worth bearing in mind for the future, if we end up dealing with biiiiiiig CSVs on constrained instances with quite a few people, this code might end up churning quite a lot of memory. if that does become the case then batch-processing (if the csv file reader allows returning small record batches at a time) would probably work with minimal logic changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though i suppose this isn't the most common API endpoint...

just musing to myself here. and hoping that you also get to see this too :D

@NyaaaWhatsUpDoc
Copy link
Member

great work 😎

@NyaaaWhatsUpDoc NyaaaWhatsUpDoc merged commit 7b5917d into main Aug 2, 2024
3 checks passed
@NyaaaWhatsUpDoc NyaaaWhatsUpDoc deleted the data_import branch August 2, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Import followers/following using csv file [feature] Import from Mastodon
2 participants