( viewer: Viewer, policies: $ReadOnlyArray<PolicyType>, )
| 212 | } |
| 213 | |
| 214 | async function policiesValidator( |
| 215 | viewer: Viewer, |
| 216 | policies: $ReadOnlyArray<PolicyType>, |
| 217 | ) { |
| 218 | if (!policies.length || !viewer.loggedIn) { |
| 219 | return; |
| 220 | } |
| 221 | if (!hasMinCodeVersion(viewer.platformDetails, { native: 181 })) { |
| 222 | return; |
| 223 | } |
| 224 | |
| 225 | const notAcknowledgedPolicies = await fetchNotAcknowledgedPolicies( |
| 226 | viewer.id, |
| 227 | policies, |
| 228 | ); |
| 229 | |
| 230 | if (notAcknowledgedPolicies.length) { |
| 231 | throw new ServerError('policies_not_accepted', { |
| 232 | notAcknowledgedPolicies, |
| 233 | }); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | export { |
| 238 | validateInput, |
no test coverage detected