File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -110,18 +110,22 @@ protected function normalizeDatabaseData(array $data) {
110110 $ data ['children_count ' ] = (int )$ data ['children_count ' ];
111111 $ data ['reference_id ' ] = $ data ['reference_id ' ] ?? null ;
112112 if ($ this ->supportReactions ()) {
113- $ list = json_decode ($ data ['reactions ' ], true );
114- // Ordering does not work on the database with group concat and Oracle,
115- // So we simply sort on the output.
116- if (is_array ($ list )) {
117- uasort ($ list , static function ($ a , $ b ) {
118- if ($ a === $ b ) {
119- return 0 ;
120- }
121- return ($ a > $ b ) ? -1 : 1 ;
122- });
113+ if ($ data ['reactions ' ]) {
114+ $ list = json_decode ($ data ['reactions ' ], true );
115+ // Ordering does not work on the database with group concat and Oracle,
116+ // So we simply sort on the output.
117+ if (is_array ($ list )) {
118+ uasort ($ list , static function ($ a , $ b ) {
119+ if ($ a === $ b ) {
120+ return 0 ;
121+ }
122+ return ($ a > $ b ) ? -1 : 1 ;
123+ });
124+ }
125+ $ data ['reactions ' ] = $ list ;
126+ } else {
127+ $ data ['reactions ' ] = [];
123128 }
124- $ data ['reactions ' ] = $ list ;
125129 }
126130 return $ data ;
127131 }
You can’t perform that action at this time.
0 commit comments