File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
src/notifications/screens Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -236,16 +236,17 @@ class Notifications extends Component {
236
236
}
237
237
238
238
getSortedRepos = ( ) => {
239
- const repositories = [
240
- ...new Set (
241
- this . notifications ( ) . map (
242
- notification => notification . repository . full_name
243
- )
244
- ) ,
245
- ] ;
246
-
247
- return repositories . sort ( ( a , b ) => {
248
- return a . toLowerCase ( ) > b . toLowerCase ( ) ? 1 : - 1 ;
239
+ const updateTimeMap = { } ;
240
+
241
+ this . notifications ( ) . forEach ( notification => {
242
+ const repoName = notification . repository . full_name ;
243
+
244
+ updateTimeMap [ repoName ] =
245
+ updateTimeMap [ repoName ] || notification . update_time ;
246
+ } ) ;
247
+
248
+ return Object . keys ( updateTimeMap ) . sort ( ( a , b ) => {
249
+ return new Date ( a ) - new Date ( b ) ;
249
250
} ) ;
250
251
} ;
251
252
You can’t perform that action at this time.
0 commit comments