app/controllers/socials_controller.rb
# Un-block friends action.
#
# === Params:
#     id: the id of the swimming buddy (user) to be unblocked by the current user
#
# === GET:
#     Renderes the landing page with the confirmation form.
#
# === PUT:
#     Updates friendship row clearing the blocked status (w/o news feed article).
Un-block friends action.
Params:
id: the id of the swimming buddy (user) to be unblocked by the current user

Renderes the landing page with the confirmation form.

Updates friendship row clearing the blocked status (w/o news feed article).
Un - block friends action . Params : id : the id of the swimming buddy ( user ) to be unblocked by the current user Renderes the landing page with the confirmation form . Updates friendship row clearing the blocked status ( w / o news feed article ) .
def unblock
    @title = I18n.t('social.unblock_title')
    @swimming_buddy = User.find_by_id( params[:id] )
    if request.post?                                
      if current_user.unblock( @swimming_buddy )
        flash[:info] = I18n.t('social.unblock_successful')
      else
        flash[:error] = I18n.t('social.unblock_error')
      end
      redirect_to( swimmer_radio_path(id: @swimming_buddy.swimmer_id) ) and return
    else
      if SwimmerUserStrategy.new(@swimming_buddy.swimmer).is_unblockable_by( current_user )
        @submit_title = I18n.t('social.unblock_label').gsub( "{SWIMMER_NAME}", @swimming_buddy.name )
        @friendship = current_user.find_any_friendship_with(@swimming_buddy)
        @destination_path = social_unblock_path( id: @swimming_buddy.id )
      else
        flash[:warning] = I18n.t( 'social.warning_generic_not_a_valid_friendship' )
          .gsub( "{SWIMMER_NAME}", @swimming_buddy.name )
        redirect_back( fallback_location: root_path ) and return
      end
      render :ask_confirmation
    end
  end
def unblock @title = I18n . t ( 'social.unblock_title' ) @swimming_buddy = User . find_by_id ( params [ :id ] ) if request . post? if current_user . unblock ( @swimming_buddy ) flash [ :info ] = I18n . t ( 'social.unblock_successful' ) else flash [ :error ] = I18n . t ( 'social.unblock_error' ) end redirect_to ( swimmer_radio_path ( id : @swimming_buddy . swimmer_id ) ) and return else if SwimmerUserStrategy . new ( @swimming_buddy . swimmer ) . is_unblockable_by ( current_user ) @submit_title = I18n . t ( 'social.unblock_label' ) . gsub ( "{SWIMMER_NAME}" , @swimming_buddy . name ) @friendship = current_user . find_any_friendship_with ( @swimming_buddy ) @destination_path = social_unblock_path ( id : @swimming_buddy . id ) else flash [ :warning ] = I18n . t ( 'social.warning_generic_not_a_valid_friendship' ) . gsub ( "{SWIMMER_NAME}" , @swimming_buddy . name ) redirect_back ( fallback_location : root_path ) and return end render :ask_confirmation end end
Un-block friends action.
Un - block friends action .
# === POST: === # === GET: ===