lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Incremental import of user settings

Open 8ullyMaguire opened this issue 10 months ago • 3 comments

Requirements

  • [X] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • [X] Did you check to see if this issue already exists?
  • [X] Is this only a feature request? Do not put multiple feature requests in one issue.
  • [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
  • [X] Do you agree to follow the rules in our Code of Conduct?

Is your proposal related to a problem?

Importing settings overwrites my existing settings. For example if I have some saved posts in an account and some others in another they get overwritten.

Describe the solution you'd like.

I want to merge settings for example have all saved posts or followed communities from both accounts in the one I'm importing into, without overwriting the existing data.

Describe alternatives you've considered.

I haven't considered any.

Additional context

No response

8ullyMaguire avatar Apr 27 '24 20:04 8ullyMaguire

The import doesnt remove any existing saved posts, it only adds new ones. Same for followed communities just above. Did you test this properly?

Nutomic avatar Apr 29 '24 10:04 Nutomic

I guess I didn't, my bad.

8ullyMaguire avatar Apr 29 '24 10:04 8ullyMaguire

seems like you can't import just a list of communities though

I was looking at this post https://feddit.uk/post/11434169

decided to build a little Javascript:

var links = document.querySelectorAll('#postContent a');
var coms = [];
links.forEach((i) => {
	var m = i.text.match(/!(.+)@(.+)/);
	if(m) {
		var c = 'https://' + m[2] + '/c/' + m[1];
		if(!coms.includes(c)) {
			coms.push(c);
		}
	}
});

var json = JSON.stringify( { "followed_communities": coms }, null, 2 );
console.log(json);

got this JSON:

{
  "followed_communities": [
    "https://lemmy.world/c/star_wars",
    "https://lemmy.world/c/starwars",
    "https://lemmy.ml/c/starwars",
    "https://lemmygrad.ml/c/starwars",
    "https://kbin.social/c/Starwars",
    "https://lemmy.dbzer0.com/c/starwars",
    "https://latte.isnot.coffee/c/starwars",
    "https://lemmy.world/c/starwarstelevision",
    "https://lemmy.world/c/starwarsfigures",
    "https://lemmy.world/c/starwarscollecting",
    "https://lemm.ee/c/legostarwars",
    "https://lemmy.ml/c/starwarseu",
    "https://sh.itjust.works/c/thehighrepublic",
    "https://lemmy.world/c/mawinstallation",
    "https://chirp.social/c/starwarscantina",
    "https://lemmy.world/c/starwarsmemes",
    "https://lemmy.ml/c/starwarsmemes",
    "https://lemmy.ml/c/otmemes",
    "https://lemmy.ml/c/prequelmemes",
    "https://lemmy.world/c/starwarsdadjokes",
    "https://lemmy.world/c/starwarsspeculation",
    "https://lemmy.world/c/themandalorian",
    "https://lemmy.world/c/themandaloriantv",
    "https://lemmy.world/c/starwarswhatif",
    "https://lemmy.world/c/swgalaxyofheroes",
    "https://lemmy.world/c/swgoh",
    "https://lemmy.world/c/swlegion",
    "https://lemmy.world/c/swrpg",
    "https://lemmy.world/c/swtor",
    "https://lemmy.world/c/starwarsarmada",
    "https://lemmy.ml/c/sw_unlimited",
    "https://lemmy.world/c/starwarsempireatwar",
    "https://lemmynsfw.com/c/starwarsnsfw"
  ]
}

and I got this error when trying to import:

{"error":"unknown","message":"There are no changes to save. This query cannot be built"}

Die4Ever avatar May 05 '24 08:05 Die4Ever