Skip to content

Commit 8f5f077

Browse files
committed
feat: only modify polls order for authorized users
1 parent 69b2121 commit 8f5f077

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

services/feed/feed.hooks.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from 'lodash';
22
import { HookContext } from '@feathersjs/feathers';
3-
3+
import { iff, combine } from 'feathers-hooks-common';
4+
import isAuthenticated from '../../hooks/isAuthenticated';
45

56
const raiseNewVerifedPolls = async (context: HookContext): Promise<HookContext> => {
67
// Raise unseen verified polls to the very top
@@ -22,7 +23,10 @@ const lowerOldPolls = async (context: HookContext): Promise<HookContext> => {
2223

2324
export default {
2425
after: {
25-
find: [raiseNewVerifedPolls, lowerOldPolls]
26+
find: [
27+
iff(isAuthenticated, raiseNewVerifedPolls),
28+
iff(isAuthenticated, lowerOldPolls),
29+
]
2630
}
2731
};
2832

0 commit comments

Comments
 (0)