Move privacyPreference to utils
This commit is contained in:
		
							parent
							
								
									78811a547c
								
							
						
					
					
						commit
						694b9c5b54
					
				
					 2 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
					@ -35,6 +35,7 @@ import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
 | 
				
			||||||
import { REDRAFT } from 'flavours/glitch/actions/statuses';
 | 
					import { REDRAFT } from 'flavours/glitch/actions/statuses';
 | 
				
			||||||
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
 | 
					import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
 | 
				
			||||||
import uuid from 'flavours/glitch/util/uuid';
 | 
					import uuid from 'flavours/glitch/util/uuid';
 | 
				
			||||||
 | 
					import { privacyPreference } from 'flavours/glitch/util/privacy_preference';
 | 
				
			||||||
import { me } from 'flavours/glitch/util/initial_state';
 | 
					import { me } from 'flavours/glitch/util/initial_state';
 | 
				
			||||||
import { overwrite } from 'flavours/glitch/util/js_helpers';
 | 
					import { overwrite } from 'flavours/glitch/util/js_helpers';
 | 
				
			||||||
import { unescapeHTML } from 'flavours/glitch/util/html';
 | 
					import { unescapeHTML } from 'flavours/glitch/util/html';
 | 
				
			||||||
| 
						 | 
					@ -206,11 +207,6 @@ const insertEmoji = (state, position, emojiData) => {
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const privacyPreference = (a, b) => {
 | 
					 | 
				
			||||||
  const order = ['public', 'unlisted', 'private', 'direct'];
 | 
					 | 
				
			||||||
  return order[Math.max(order.indexOf(a), order.indexOf(b), 0)];
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const hydrate = (state, hydratedState) => {
 | 
					const hydrate = (state, hydratedState) => {
 | 
				
			||||||
  state = clearAll(state.merge(hydratedState));
 | 
					  state = clearAll(state.merge(hydratedState));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					export const order = ['public', 'unlisted', 'private', 'direct'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function privacyPreference (a, b) {
 | 
				
			||||||
 | 
					  return order[Math.max(order.indexOf(a), order.indexOf(b), 0)];
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
		Loading…
	
		Reference in a new issue