( state: Collection[], id: number, newOwnerId: number, )
| 485 | } |
| 486 | |
| 487 | function 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 | |
| 505 | function moveScript( |
| 506 | state: Collection[], |
no test coverage detected