MCPcopy Create free account
hub / github.com/EsperoTech/yaade / changeScriptOwner

Function changeScriptOwner

client/src/state/collections.tsx:487–503  ·  view source on GitHub ↗
(
  state: Collection[],
  id: number,
  newOwnerId: number,
)

Source from the content-addressed store, hash-verified

485}
486
487function changeScriptOwner(
488 state: Collection[],
489 id: number,
490 newOwnerId: number,
491): Collection[] {
492 const oldScript = findScript(state, id);
493 if (!oldScript) return state;
494 return modifyCollection(state, oldScript.collectionId, (c) => {
495 if (!c.scripts) return;
496 for (const script of c.scripts) {
497 if (script.id === id) {
498 script.ownerId = newOwnerId;
499 return;
500 }
501 }
502 });
503}
504
505function moveScript(
506 state: Collection[],

Callers 1

collectionsReducerFunction · 0.85

Calls 2

findScriptFunction · 0.85
modifyCollectionFunction · 0.85

Tested by

no test coverage detected