Skip to content

Commit b3ca785

Browse files
author
Bradley Weston
committed
Updated logic, without re-creating slug on return statement.
1 parent cc792ec commit b3ca785

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/Lio/Forum/Threads/Thread.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ private function generateNewSlug()
7171
{
7272
$i = 0;
7373

74-
while ($this->getCountBySlug($this->generateSlugByIncrementer($i)) > 0) {
75-
$i++;
76-
}
74+
do {
75+
$slug = $this->generateSlugByIncrementer($i++);
76+
} while ($this->getCountBySlug($slug) > 0);
7777

78-
return $this->generateSlugByIncrementer($i);
78+
return $slug;
7979
}
8080

8181
private function getCountBySlug($slug)

0 commit comments

Comments
 (0)