@@ -76,23 +76,23 @@ const alerts = (state = defaultState, action) => {
7676
7777 case 'RECEIVED_RTD_ALERTS' :
7878 const entityList = [ ]
79- alerts = action . rtdAlerts
80- for ( let i = 0 ; i < alerts . length ; i ++ ) {
81- const action = alerts [ i ]
79+ // For MTC, filter out all alerts that were created with the TRAMS tool,
80+ // as indicated by EditedBy=TRAMS
81+ const alerts = action . rtdAlerts . filter ( alert => alert . EditedBy !== 'TRAMS' )
82+ alerts . forEach ( action => {
8283 if ( typeof action !== 'undefined' && action . ServiceAlertEntities && action . ServiceAlertEntities . length > 0 ) {
8384 for ( var j = 0 ; j < action . ServiceAlertEntities . length ; j ++ ) {
84- const ent = action . ServiceAlertEntities [ j ]
85- if ( ent . StopId !== null ) {
86- entityList . push ( { type : 'stop' , entity : ent , gtfs : { } } )
85+ const entity = action . ServiceAlertEntities [ j ]
86+ if ( entity . StopId !== null ) {
87+ entityList . push ( { type : 'stop' , entity, gtfs : { } } )
8788 }
88- if ( ent . RouteId !== null ) {
89- entityList . push ( { type : 'route' , entity : ent , gtfs : { } } )
89+ if ( entity . RouteId !== null ) {
90+ entityList . push ( { type : 'route' , entity, gtfs : { } } )
9091 }
9192 }
9293 }
93- }
94- const allAlerts = action . rtdAlerts ? action . rtdAlerts
95- . filter ( rtdAlert => rtdAlert . EditedBy !== 'TRAMS' )
94+ } )
95+ const allAlerts = alerts ? alerts
9696 . map ( rtdAlert => {
9797 // let activeIndex = action.projects.findIndex(p => p.id == config.activeProjectId)
9898 const { activeProject : project } = action
@@ -105,7 +105,9 @@ const alerts = (state = defaultState, action) => {
105105 title : rtdAlert . HeaderText || '' ,
106106 // RTD server sends back two-char new lines, which can mess up character limit counts
107107 // Here, we replace any of those occurrences with a single new line char.
108- description : rtdAlert . DescriptionText ? rtdAlert . DescriptionText . replace ( / ( \r \n ) / g, '\n' ) : '' ,
108+ description : rtdAlert . DescriptionText
109+ ? rtdAlert . DescriptionText . replace ( / ( \r \n ) / g, '\n' )
110+ : '' ,
109111 cause : rtdAlert . Cause ,
110112 effect : rtdAlert . Effect ,
111113 editedBy : rtdAlert . EditedBy ,
0 commit comments