Skip to content

Commit 26de449

Browse files
committed
Set notes to null when assigning allocation; ref pterodactyl#2553
1 parent 1f5e0c0 commit 26de449

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/Services/Servers/BuildModificationService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function processAllocations(Server $server, array &$data)
115115
// one to reset the default allocation to.
116116
$freshlyAllocated = $query->pluck('id')->first();
117117

118-
$query->update(['server_id' => $server->id]);
118+
$query->update(['server_id' => $server->id, 'notes' => null]);
119119
}
120120

121121
if (! empty($data['remove_allocations'])) {

tests/Integration/Services/Servers/BuildModificationServiceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testAllocationsCanBeModifiedForTheServer()
3939
$server2 = $this->createServerModel();
4040

4141
/** @var \Pterodactyl\Models\Allocation[] $allocations */
42-
$allocations = factory(Allocation::class)->times(4)->create(['node_id' => $server->node_id]);
42+
$allocations = factory(Allocation::class)->times(4)->create(['node_id' => $server->node_id, 'notes' => 'Random notes']);
4343

4444
$initialAllocationId = $server->allocation_id;
4545
$allocations[0]->update(['server_id' => $server->id, 'notes' => 'Test notes']);
@@ -66,6 +66,7 @@ public function testAllocationsCanBeModifiedForTheServer()
6666
// Only one allocation should exist for this server now.
6767
$this->assertCount(1, $response->allocations);
6868
$this->assertSame($allocations[1]->id, $response->allocation_id);
69+
$this->assertNull($response->allocation->notes);
6970

7071
// These two allocations should not have been touched.
7172
$this->assertDatabaseHas('allocations', ['id' => $allocations[2]->id, 'server_id' => $server2->id]);

0 commit comments

Comments
 (0)