Completely hide toots matched by “irreversible” filters even if they got to the client (#11113)
Fixes #11090
This commit is contained in:
		
					parent
					
						
							
								17747e2cd7
							
						
					
				
			
			
				commit
				
					
						c8fae508cf
					
				
			
		
					 2 changed files with 12 additions and 2 deletions
				
			
		|  | @ -48,9 +48,14 @@ export function updateNotifications(notification, intlMessages, intlLocale) { | ||||||
|     let filtered = false; |     let filtered = false; | ||||||
| 
 | 
 | ||||||
|     if (notification.type === 'mention') { |     if (notification.type === 'mention') { | ||||||
|  |       const dropRegex   = regexFromFilters(filters.filter(filter => filter.get('irreversible'))); | ||||||
|       const regex       = regexFromFilters(filters); |       const regex       = regexFromFilters(filters); | ||||||
|       const searchIndex = notification.status.spoiler_text + '\n' + unescapeHTML(notification.status.content); |       const searchIndex = notification.status.spoiler_text + '\n' + unescapeHTML(notification.status.content); | ||||||
| 
 | 
 | ||||||
|  |       if (dropRegex && dropRegex.test(searchIndex)) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       filtered = regex && regex.test(searchIndex); |       filtered = regex && regex.test(searchIndex); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -84,8 +84,13 @@ export const makeGetStatus = () => { | ||||||
|         statusReblog = null; |         statusReblog = null; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       const regex    = (accountReblog || accountBase).get('id') !== me && regexFromFilters(filters); |       const dropRegex = (accountReblog || accountBase).get('id') !== me && regexFromFilters(filters.filter(filter => filter.get('irreversible'))); | ||||||
|       const filtered = regex && regex.test(statusBase.get('reblog') ? statusReblog.get('search_index') : statusBase.get('search_index')); |       if (dropRegex && dropRegex.test(statusBase.get('reblog') ? statusReblog.get('search_index') : statusBase.get('search_index'))) { | ||||||
|  |         return null; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       const regex     = (accountReblog || accountBase).get('id') !== me && regexFromFilters(filters); | ||||||
|  |       const filtered  = regex && regex.test(statusBase.get('reblog') ? statusReblog.get('search_index') : statusBase.get('search_index')); | ||||||
| 
 | 
 | ||||||
|       return statusBase.withMutations(map => { |       return statusBase.withMutations(map => { | ||||||
|         map.set('reblog', statusReblog); |         map.set('reblog', statusReblog); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue