From 2ce7a1e185eeda9cb0b87064febb0e228e65264b Mon Sep 17 00:00:00 2001
From: augier <christophe@c-henry.fr>
Date: Thu, 27 Aug 2015 19:13:35 +0200
Subject: [PATCH] Mobile subdomain

closes #6354
---
 Changelog.md                       | 1 +
 app/controllers/home_controller.rb | 6 ++++++
 config/routes.rb                   | 1 +
 features/mobile/home.feature       | 7 +++++++
 features/support/paths.rb          | 2 ++
 5 files changed, 17 insertions(+)

diff --git a/Changelog.md b/Changelog.md
index 934b29edc6..5f41e795b3 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -27,6 +27,7 @@
 * Display original author on reshares of NSFW posts [#6270](https://github.com/diaspora/diaspora/pull/6270)
 * Use avatars in hovercards as links to the profile [#6297](https://github.com/diaspora/diaspora/pull/6297)
 * Remove avatars of ignored users from stream faces [#6320](https://github.com/diaspora/diaspora/pull/6320)
+* New /m route to force the mobile view [#6354](https://github.com/diaspora/diaspora/pull/6354)
 
 # 0.5.2.0
 
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index d013c72f22..ee0b7102e9 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -30,4 +30,10 @@ class HomeController < ApplicationController
 
     redirect_to :back
   end
+
+  def force_mobile
+    session[:mobile_view] = true
+
+    redirect_to stream_path
+  end
 end
diff --git a/config/routes.rb b/config/routes.rb
index c892924677..775cf0092a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -224,6 +224,7 @@ Diaspora::Application.routes.draw do
   # Mobile site
 
   get 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile'
+  get "/m", to: "home#force_mobile", as: "force_mobile"
 
   # Help
   get 'help' => 'help#faq', :as => 'help'
diff --git a/features/mobile/home.feature b/features/mobile/home.feature
index 43e9c16bca..2b678a1934 100644
--- a/features/mobile/home.feature
+++ b/features/mobile/home.feature
@@ -10,3 +10,10 @@ Feature: Visit the landing page of the pod
     When I toggle the mobile view
     And I go to the root page
     Then I should see "Welcome, friend"
+
+    When I am on the root page
+    Then I should see "Welcome, friend"
+    When I go to the mobile path
+    Then I should see "LOG IN"
+    When I go to the mobile path
+    Then I should see "LOG IN"
diff --git a/features/support/paths.rb b/features/support/paths.rb
index d1b923091a..90743f5e16 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -5,6 +5,8 @@ module NavigationHelpers
          person_photos_path(@me.person)
       when /^the home(?: )?page$/
         stream_path
+      when /^the mobile path$/
+        force_mobile_path
       when /^step (\d)$/
         if $1.to_i == 1
           getting_started_path
-- 
GitLab