File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,11 +276,13 @@ def post
276276
277277 def post_follow
278278 @post = Post . find ( params [ :post_id ] )
279- if @post . followed_by? ( current_user )
280- ThreadFollower . where ( post : @post , user : current_user ) . destroy_all
281- else
282- ThreadFollower . create ( post : @post , user : current_user )
283- end
279+ ThreadFollower . create ( post : @post , user : current_user )
280+ redirect_to post_path ( @post )
281+ end
282+
283+ def post_unfollow
284+ @post = Post . find ( params [ :post_id ] )
285+ ThreadFollower . where ( post : @post , user : current_user ) . destroy_all
284286 redirect_to post_path ( @post )
285287 end
286288
Original file line number Diff line number Diff line change 66 ? @post_type : PostType of the post
77
88 Parameters:
9- ? params[:comment_id] : Comment ID to show even if it would be hidden otherwise
9+ ? params[:comment_id] : Comment ID to show even if it would be hidden otherwise
1010 ? params[:thread_id] : CommentThread ID to render expanded view for
1111 ? params[:sort] : sorting type for the post's children
1212
243243 < div class ="tools ">
244244 <%= render "shared/copy_link" , classes : [ "tools--item" ] ,
245245 desc : "Copy a permanent link to this post" ,
246- id : post . id ,
247- md : generic_share_link_md ( post ) ,
246+ id : post . id ,
247+ md : generic_share_link_md ( post ) ,
248248 raw : generic_share_link ( post ) %>
249249 <%= link_to post_history_path ( post ) , class : 'tools--item' , 'aria-label' : 'View history of this post' do %>
250250 < i class ="fa fa-history "> </ i >
533533 </ h4 >
534534 <% if user_signed_in? %>
535535 <% if post . followed_by? ( current_user ) %>
536- <%= link_to follow_post_comments_path ( post_id : post . id ) , method : :post ,
536+ <%= link_to unfollow_post_comments_path ( post_id : post . id ) , method : :post ,
537537 class : "button is-muted is-outlined is-small" ,
538538 title : 'Don\'t follow new comment threads on this post' ,
539539 role : 'button' ,
Original file line number Diff line number Diff line change 2424 mount LetterOpenerWeb ::Engine , at : "/letter_opener" if Rails . env . development?
2525 mount Rack ::Directory . new ( 'coverage/' ) , at : '/coverage' if Rails . env . development?
2626 mount MaintenanceTasks ::Engine , at : '/maintenance'
27-
27+
2828 scope 'admin' do
2929 root to : 'admin#index' , as : :admin
3030 get 'errors' , to : 'admin#error_reports' , as : :admin_error_reports
244244 get 'thread/:id/followers' , to : 'comments#thread_followers' , as : :comment_thread_followers
245245 get 'post/:post_id' , to : 'comments#post' , as : :post_comments
246246 post 'post/:post_id/follow' , to : 'comments#post_follow' , as : :follow_post_comments
247+ post 'post/:post_id/unfollow' , to : 'comments#post_unfollow' , as : :unfollow_post_comments
247248 get ':id' , to : 'comments#show' , as : :comment
248249 get 'thread/:id' , to : 'comments#thread' , as : :comment_thread
249250 get 'thread/:id/content' , to : 'comments#thread_content' , as : :comment_thread_content
You can’t perform that action at this time.
0 commit comments