Просмотр исходного кода

Sort labels with locale-aware collation (#9023)

Labels (tags) were sorted by the database's raw byte/ASCII collation
via ORDER BY name, so accented or non-Latin label names sorted after
all ASCII names instead of near their base letter.

Apply the same FreshRSS_Context::localeCompare() sort used for
categories, feeds, and shares (#8985) to TagDAO::listTags(), fixing
the last remaining sub-item of this issue; the others were already
resolved by #6212.

Fixes #6211

Co-authored-by: Gerard Alvear <gerard.alvear@logiqd.me>
Gerard Alvear Porras 12 часов назад
Родитель
Сommit
e24ac6f21c
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      app/Models/TagDAO.php

+ 3 - 1
app/Models/TagDAO.php

@@ -233,7 +233,9 @@ class FreshRSS_TagDAO extends Minz_ModelPdo {
 		$res = $this->fetchAssoc($sql);
 		if ($res !== null) {
 			/** @var list<array{id:int,name:string,unreads:int}> $res */
-			return self::daoToTags($res);
+			$tags = self::daoToTags($res);
+			uasort($tags, static fn(FreshRSS_Tag $a, FreshRSS_Tag $b) => FreshRSS_Context::localeCompare($a->name(), $b->name()));
+			return $tags;
 		} else {
 			$info = $this->pdo->errorInfo();
 			Minz_Log::error('SQL error ' . __METHOD__ . json_encode($info));