-
Notifications
You must be signed in to change notification settings - Fork 121
feat: unified view logging – count article views on post open #4026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3408,16 +3408,14 @@ export const resolvers: IResolvers<unknown, BaseContext> = { | |
| ): Promise<GQLEmptyResponse> => { | ||
| const post = await ctx.con.getRepository(Post).findOneByOrFail({ id }); | ||
| await ensureSourcePermissions(ctx, post.sourceId); | ||
| if (post.type !== PostType.Article) { | ||
| await notifyView( | ||
| ctx.log, | ||
| post.id, | ||
| ctx.userId, | ||
| ctx.req.headers['referer'], | ||
| new Date(), | ||
| post.tagsStr?.split?.(',') ?? [], | ||
| ); | ||
| } | ||
| await notifyView( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removed guard existed to avoid double-counting articles: their view was historically produced by the Removing it is safe because dedup already happens downstream, not here: the views worker drops duplicate Also worth noting for review: |
||
| ctx.log, | ||
| post.id, | ||
| ctx.userId, | ||
| ctx.req.headers['referer'], | ||
| new Date(), | ||
| post.tagsStr?.split?.(',') ?? [], | ||
| ); | ||
| return { _: true }; | ||
| }, | ||
| dismissPostFeedback: async ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the intentional behavior flip (was
should should not submit view event for articlesasserting 0 calls). The auth/permission tests for the mutation are untouched — only the article-exclusion assertion changed.