Skip to content
Extraits de code Groupes Projets
  • Benjamin Neff's avatar
    686310fb
    Simplify /podmin redirect · 686310fb
    Benjamin Neff a rédigé
    Some podmins were confuse how they can disable this redirect and I think
    the rule with two users can actually be a little confusing. I think the
    main goal of this page to give the podmin a little start and I think
    after they configured everything, the pod works and they found the link
    to the wiki to make themself an admin, it is OK to remove the redirect.
    
    Also it's bad for single-user pods where this page always stays active,
    even if they are an admin, but have only one user. It's more useful for
    single-user pods to have the login on the home page.
    
    closes #7783
    Simplify /podmin redirect
    Benjamin Neff a rédigé
    Some podmins were confuse how they can disable this redirect and I think
    the rule with two users can actually be a little confusing. I think the
    main goal of this page to give the podmin a little start and I think
    after they configured everything, the pod works and they found the link
    to the wiki to make themself an admin, it is OK to remove the redirect.
    
    Also it's bad for single-user pods where this page always stays active,
    even if they are an admin, but have only one user. It's more useful for
    single-user pods to have the login on the home page.
    
    closes #7783
home_controller.rb 1,18 Kio
# frozen_string_literal: true

#   Copyright (c) 2010-2012, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

class HomeController < ApplicationController
  def show
    partial_dir = Rails.root.join("app", "views", "home")
    if user_signed_in?
      redirect_to stream_path
    elsif request.format == :mobile
      if partial_dir.join("_show.mobile.haml").exist? ||
         partial_dir.join("_show.mobile.erb").exist? ||
         partial_dir.join("_show.haml").exist?
        render :show
      else
        redirect_to user_session_path
      end
    elsif partial_dir.join("_show.html.haml").exist? ||
          partial_dir.join("_show.html.erb").exist? ||
          partial_dir.join("_show.haml").exist?
      render :show
    elsif Role.admins.any?
      render :default
    else
      redirect_to podmin_path
    end
  end

  def podmin
    render :podmin
  end

  def toggle_mobile
    session[:mobile_view] = session[:mobile_view].nil? ? true : !session[:mobile_view]

    redirect_back fallback_location: root_path
  end

  def force_mobile
    session[:mobile_view] = true

    redirect_to stream_path
  end
end