@@ -584,7 +584,7 @@ def create_thread(request, course_id, commentable_id):
584
584
585
585
if follow :
586
586
cc_user = cc .User .from_django_user (user )
587
- cc_user .follow (thread )
587
+ cc_user .follow (thread , course_id )
588
588
thread_followed .send (sender = None , user = user , post = thread )
589
589
590
590
data = thread .to_dict ()
@@ -673,7 +673,7 @@ def _create_comment(request, course_key, thread_id=None, parent_id=None):
673
673
parent_id = parent_id ,
674
674
body = sanitize_body (post ["body" ]),
675
675
)
676
- comment .save ()
676
+ comment .save (params = { "course_id" : str ( course_key )} )
677
677
678
678
comment_created .send (sender = None , user = user , post = comment )
679
679
@@ -715,7 +715,7 @@ def delete_thread(request, course_id, thread_id):
715
715
course_key = CourseKey .from_string (course_id )
716
716
course = get_course_with_access (request .user , 'load' , course_key )
717
717
thread = cc .Thread .find (thread_id )
718
- thread .delete ()
718
+ thread .delete (course_id = course_id )
719
719
thread_deleted .send (sender = None , user = request .user , post = thread )
720
720
721
721
track_thread_deleted_event (request , course , thread )
@@ -736,7 +736,7 @@ def update_comment(request, course_id, comment_id):
736
736
if 'body' not in request .POST or not request .POST ['body' ].strip ():
737
737
return JsonError (_ ("Body can't be empty" ))
738
738
comment .body = sanitize_body (request .POST ["body" ])
739
- comment .save ()
739
+ comment .save (params = { "course_id" : course_id } )
740
740
741
741
comment_edited .send (sender = None , user = request .user , post = comment )
742
742
@@ -762,7 +762,7 @@ def endorse_comment(request, course_id, comment_id):
762
762
endorsed = request .POST .get ('endorsed' , 'false' ).lower () == 'true'
763
763
comment .endorsed = endorsed
764
764
comment .endorsement_user_id = user .id
765
- comment .save ()
765
+ comment .save (params = { "course_id" : course_id } )
766
766
comment_endorsed .send (sender = None , user = user , post = comment )
767
767
track_forum_response_mark_event (request , course , comment , endorsed )
768
768
return JsonResponse (prepare_content (comment .to_dict (), course_key ))
@@ -781,7 +781,7 @@ def openclose_thread(request, course_id, thread_id):
781
781
thread = cc .Thread .find (thread_id )
782
782
close_thread = request .POST .get ('closed' , 'false' ).lower () == 'true'
783
783
thread .closed = close_thread
784
- thread .save ()
784
+ thread .save (params = { "course_id" : course_id } )
785
785
786
786
track_thread_lock_unlock_event (request , course , thread , None , close_thread )
787
787
return JsonResponse ({
@@ -814,7 +814,7 @@ def delete_comment(request, course_id, comment_id):
814
814
course_key = CourseKey .from_string (course_id )
815
815
course = get_course_with_access (request .user , 'load' , course_key )
816
816
comment = cc .Comment .find (comment_id )
817
- comment .delete ()
817
+ comment .delete (course_id = course_id )
818
818
comment_deleted .send (sender = None , user = request .user , post = comment )
819
819
track_comment_deleted_event (request , course , comment )
820
820
return JsonResponse (prepare_content (comment .to_dict (), course_key ))
@@ -828,12 +828,12 @@ def _vote_or_unvote(request, course_id, obj, value='up', undo_vote=False):
828
828
course = get_course_with_access (request .user , 'load' , course_key )
829
829
user = cc .User .from_django_user (request .user )
830
830
if undo_vote :
831
- user .unvote (obj )
831
+ user .unvote (obj , course_id )
832
832
# TODO(smarnach): Determine the value of the vote that is undone. Currently, you can
833
833
# only cast upvotes in the user interface, so it is assumed that the vote value is 'up'.
834
834
# (People could theoretically downvote by handcrafting AJAX requests.)
835
835
else :
836
- user .vote (obj , value )
836
+ user .vote (obj , value , course_id )
837
837
thread_voted .send (sender = None , user = request .user , post = obj )
838
838
track_voted_event (request , course , obj , value , undo_vote )
839
839
return JsonResponse (prepare_content (obj .to_dict (), course_key ))
@@ -899,7 +899,7 @@ def flag_abuse_for_thread(request, course_id, thread_id):
899
899
user = cc .User .from_django_user (request .user )
900
900
course = get_course_by_id (course_key )
901
901
thread = cc .Thread .find (thread_id )
902
- thread .flagAbuse (user , thread )
902
+ thread .flagAbuse (user , thread , course_id )
903
903
track_discussion_reported_event (request , course , thread )
904
904
thread_flagged .send (sender = 'flag_abuse_for_thread' , user = request .user , post = thread )
905
905
return JsonResponse (prepare_content (thread .to_dict (), course_key ))
@@ -921,7 +921,7 @@ def un_flag_abuse_for_thread(request, course_id, thread_id):
921
921
has_permission (request .user , 'openclose_thread' , course_key ) or
922
922
has_access (request .user , 'staff' , course )
923
923
)
924
- thread .unFlagAbuse (user , thread , remove_all )
924
+ thread .unFlagAbuse (user , thread , remove_all , course_id )
925
925
track_discussion_unreported_event (request , course , thread )
926
926
return JsonResponse (prepare_content (thread .to_dict (), course_key ))
927
927
@@ -938,7 +938,7 @@ def flag_abuse_for_comment(request, course_id, comment_id):
938
938
user = cc .User .from_django_user (request .user )
939
939
course = get_course_by_id (course_key )
940
940
comment = cc .Comment .find (comment_id )
941
- comment .flagAbuse (user , comment )
941
+ comment .flagAbuse (user , comment , course_id )
942
942
track_discussion_reported_event (request , course , comment )
943
943
comment_flagged .send (sender = 'flag_abuse_for_comment' , user = request .user , post = comment )
944
944
return JsonResponse (prepare_content (comment .to_dict (), course_key ))
@@ -960,7 +960,7 @@ def un_flag_abuse_for_comment(request, course_id, comment_id):
960
960
has_access (request .user , 'staff' , course )
961
961
)
962
962
comment = cc .Comment .find (comment_id )
963
- comment .unFlagAbuse (user , comment , remove_all )
963
+ comment .unFlagAbuse (user , comment , remove_all , course_id )
964
964
track_discussion_unreported_event (request , course , comment )
965
965
return JsonResponse (prepare_content (comment .to_dict (), course_key ))
966
966
@@ -976,7 +976,7 @@ def pin_thread(request, course_id, thread_id):
976
976
course_key = CourseKey .from_string (course_id )
977
977
user = cc .User .from_django_user (request .user )
978
978
thread = cc .Thread .find (thread_id )
979
- thread .pin (user , thread_id )
979
+ thread .pin (user , thread_id , course_id )
980
980
981
981
return JsonResponse (prepare_content (thread .to_dict (), course_key ))
982
982
@@ -992,7 +992,7 @@ def un_pin_thread(request, course_id, thread_id):
992
992
course_key = CourseKey .from_string (course_id )
993
993
user = cc .User .from_django_user (request .user )
994
994
thread = cc .Thread .find (thread_id )
995
- thread .un_pin (user , thread_id )
995
+ thread .un_pin (user , thread_id , course_id )
996
996
997
997
return JsonResponse (prepare_content (thread .to_dict (), course_key ))
998
998
@@ -1005,7 +1005,7 @@ def follow_thread(request, course_id, thread_id): # lint-amnesty, pylint: disab
1005
1005
course_key = CourseKey .from_string (course_id )
1006
1006
course = get_course_by_id (course_key )
1007
1007
thread = cc .Thread .find (thread_id )
1008
- user .follow (thread )
1008
+ user .follow (thread , course_id = course_id )
1009
1009
thread_followed .send (sender = None , user = request .user , post = thread )
1010
1010
track_thread_followed_event (request , course , thread , True )
1011
1011
return JsonResponse ({})
@@ -1021,7 +1021,7 @@ def follow_commentable(request, course_id, commentable_id): # lint-amnesty, pyl
1021
1021
"""
1022
1022
user = cc .User .from_django_user (request .user )
1023
1023
commentable = cc .Commentable .find (commentable_id )
1024
- user .follow (commentable )
1024
+ user .follow (commentable , course_id = course_id )
1025
1025
return JsonResponse ({})
1026
1026
1027
1027
@@ -1037,7 +1037,7 @@ def unfollow_thread(request, course_id, thread_id): # lint-amnesty, pylint: dis
1037
1037
course = get_course_by_id (course_key )
1038
1038
user = cc .User .from_django_user (request .user )
1039
1039
thread = cc .Thread .find (thread_id )
1040
- user .unfollow (thread )
1040
+ user .unfollow (thread , course_id = course_id )
1041
1041
thread_unfollowed .send (sender = None , user = request .user , post = thread )
1042
1042
track_thread_followed_event (request , course , thread , False )
1043
1043
return JsonResponse ({})
@@ -1053,7 +1053,7 @@ def unfollow_commentable(request, course_id, commentable_id): # lint-amnesty, p
1053
1053
"""
1054
1054
user = cc .User .from_django_user (request .user )
1055
1055
commentable = cc .Commentable .find (commentable_id )
1056
- user .unfollow (commentable )
1056
+ user .unfollow (commentable , course_id = course_id )
1057
1057
return JsonResponse ({})
1058
1058
1059
1059
0 commit comments