Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3489892
D5822.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5822.diff
View Options
diff --git a/keyserver/src/fetchers/policy-acknowledgment-fetchers.js b/keyserver/src/fetchers/policy-acknowledgment-fetchers.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/fetchers/policy-acknowledgment-fetchers.js
@@ -0,0 +1,23 @@
+// @flow
+
+import type { PolicyType } from 'lib/facts/policies.js';
+import { type UserPolicyConfirmationType } from 'lib/types/policy-types.js';
+
+import { dbQuery, SQL } from '../database/database.js';
+import { Viewer } from '../session/viewer.js';
+
+async function fetchPolicyAcknowledgments(
+ viewer: Viewer,
+ policies: $ReadOnlyArray<PolicyType>,
+): Promise<$ReadOnlyArray<UserPolicyConfirmationType>> {
+ const query = SQL`
+ SELECT policy, confirmed
+ FROM policy_acknowledgments
+ WHERE user=${viewer.id}
+ AND policy IN (${policies})
+ `;
+ const [data] = await dbQuery(query);
+ return data;
+}
+
+export { fetchPolicyAcknowledgments };
diff --git a/lib/types/policy-types.js b/lib/types/policy-types.js
new file mode 100644
--- /dev/null
+++ b/lib/types/policy-types.js
@@ -0,0 +1,8 @@
+// @flow
+
+import type { PolicyType } from '../facts/policies.js';
+
+export type UserPolicyConfirmationType = {
+ +policy: PolicyType,
+ +confirmed: boolean,
+};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 2:04 PM (21 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677628
Default Alt Text
D5822.diff (1 KB)
Attached To
Mode
D5822: [keyserver] add viewer acknowledgment fetcher
Attached
Detach File
Event Timeline
Log In to Comment