Skip to content

Commit

Permalink
Prevent adding one message multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
josaphatim committed Feb 12, 2025
1 parent 57b31e6 commit fbb70f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ trait Hm_List {
* @return void
*/
public static function add($string, $type = 'success') {
self::$msgs[] = ['type' => $type, 'text' => self::str($string, false)];
$string = self::str($string, false);
$texts = self::get();
if (! in_array($string, $texts, true)) {
self::$msgs[] = ['type' => $type, 'text' => $string];
}
}

/**
Expand Down

0 comments on commit fbb70f9

Please sign in to comment.