@ -21,6 +21,7 @@ import {
COMPOSE _SUGGESTIONS _CLEAR ,
COMPOSE _SUGGESTIONS _READY ,
COMPOSE _SUGGESTION _SELECT ,
COMPOSE _SUGGESTION _IGNORE ,
COMPOSE _SUGGESTION _TAGS _UPDATE ,
COMPOSE _TAG _HISTORY _UPDATE ,
COMPOSE _SENSITIVITY _CHANGE ,
@ -165,6 +166,17 @@ const insertSuggestion = (state, position, token, completion, path) => {
} ) ;
} ;
const ignoreSuggestion = ( state , position , token , completion , path ) => {
return state . withMutations ( map => {
map . updateIn ( path , oldText => ` ${ oldText . slice ( 0 , position + token . length ) } ${ oldText . slice ( position + token . length ) } ` ) ;
map . set ( 'suggestion_token' , null ) ;
map . set ( 'suggestions' , ImmutableList ( ) ) ;
map . set ( 'focusDate' , new Date ( ) ) ;
map . set ( 'caretPosition' , position + token . length + 1 ) ;
map . set ( 'idempotencyKey' , uuid ( ) ) ;
} ) ;
} ;
const sortHashtagsByUse = ( state , tags ) => {
const personalHistory = state . get ( 'tagHistory' ) ;
@ -398,6 +410,8 @@ export default function compose(state = initialState, action) {
return state . set ( 'suggestions' , ImmutableList ( normalizeSuggestions ( state , action ) ) ) . set ( 'suggestion_token' , action . token ) ;
case COMPOSE _SUGGESTION _SELECT :
return insertSuggestion ( state , action . position , action . token , action . completion , action . path ) ;
case COMPOSE _SUGGESTION _IGNORE :
return ignoreSuggestion ( state , action . position , action . token , action . completion , action . path ) ;
case COMPOSE _SUGGESTION _TAGS _UPDATE :
return updateSuggestionTags ( state , action . token ) ;
case COMPOSE _TAG _HISTORY _UPDATE :