File tree Expand file tree Collapse file tree
app/(main)/questions/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -350,6 +350,13 @@ export function getFilterSectionParticipation({
350350 active : ! ! params . get ( POST_UPVOTED_BY_FILTER ) ,
351351 isPersisted : true ,
352352 } ,
353+ {
354+ id : POST_COMMENTED_BY_FILTER ,
355+ label : t ( "commented" ) ,
356+ value : user . id . toString ( ) ,
357+ active : ! ! params . get ( POST_COMMENTED_BY_FILTER ) ,
358+ isPersisted : true ,
359+ } ,
353360 ] ,
354361 } ;
355362}
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414} from "@/components/popover_filter/types" ;
1515import PostsFilters from "@/components/posts_filters" ;
1616import {
17+ POST_COMMENTED_BY_FILTER ,
1718 POST_FOLLOWING_FILTER ,
1819 POST_FORECASTER_ID_FILTER ,
1920 POST_NOT_FORECASTER_ID_FILTER ,
@@ -225,6 +226,12 @@ function getTournamentPostsFilters({
225226 value : "true" ,
226227 active : ! ! params . get ( POST_FOLLOWING_FILTER ) ,
227228 } ,
229+ {
230+ id : POST_COMMENTED_BY_FILTER ,
231+ label : t ( "commented" ) ,
232+ value : user . id . toString ( ) ,
233+ active : ! ! params . get ( POST_COMMENTED_BY_FILTER ) ,
234+ } ,
228235 ] ,
229236 } ) ;
230237 }
Original file line number Diff line number Diff line change @@ -226,6 +226,7 @@ class Access(models.TextChoices):
226226 not_forecaster_id = serializers .IntegerField (required = False , allow_null = True )
227227 similar_to_post_id = serializers .IntegerField (required = False , allow_null = True )
228228 upvoted_by = serializers .IntegerField (required = False , allow_null = True )
229+ commented_by = serializers .IntegerField (required = False , allow_null = True )
229230
230231 search = serializers .CharField (required = False , allow_null = True )
231232 for_main_feed = serializers .BooleanField (required = False , allow_null = True )
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ def get_posts_feed(
4848 show_on_homepage : bool = None ,
4949 following : bool = None ,
5050 upvoted_by : int = None ,
51+ commented_by : int = None ,
5152 ** kwargs ,
5253) -> Post .objects :
5354 """
@@ -217,6 +218,9 @@ def get_posts_feed(
217218 votes__direction = Vote .VoteDirection .UP ,
218219 )
219220
221+ if commented_by :
222+ qs = qs .filter (comments__author_id = commented_by ).distinct ()
223+
220224 # Followed posts
221225 if user and user .is_authenticated and following :
222226 qs = qs .annotate_user_is_following (user = user ).filter (user_is_following = True )
You can’t perform that action at this time.
0 commit comments