mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 18:29:52 +01:00
Move About, ToS & Privacy Policy into AboutController
This commit is contained in:
parent
f3b58c1d33
commit
7abdac2d8a
9 changed files with 57 additions and 60 deletions
|
@ -2,4 +2,30 @@
|
||||||
|
|
||||||
class AboutController < ApplicationController
|
class AboutController < ApplicationController
|
||||||
def index; end
|
def index; end
|
||||||
|
|
||||||
|
def about
|
||||||
|
user_count = User
|
||||||
|
.where.not(confirmed_at: nil)
|
||||||
|
.where("answered_count > 0")
|
||||||
|
.count
|
||||||
|
|
||||||
|
current_ban_count = UserBan
|
||||||
|
.current
|
||||||
|
.joins(:user)
|
||||||
|
.where.not("users.confirmed_at": nil)
|
||||||
|
.where("users.answered_count > 0")
|
||||||
|
.count
|
||||||
|
|
||||||
|
@users = user_count - current_ban_count
|
||||||
|
@questions = Question.count
|
||||||
|
@answers = Answer.count
|
||||||
|
@comments = Comment.count
|
||||||
|
@smiles = Appendable::Reaction.count
|
||||||
|
end
|
||||||
|
|
||||||
|
def faq; end
|
||||||
|
|
||||||
|
def privacy_policy; end
|
||||||
|
|
||||||
|
def terms; end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,41 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class StaticController < ApplicationController
|
class StaticController < ApplicationController
|
||||||
def about
|
|
||||||
user_count = User
|
|
||||||
.where.not(confirmed_at: nil)
|
|
||||||
.where("answered_count > 0")
|
|
||||||
.count
|
|
||||||
|
|
||||||
current_ban_count = UserBan
|
|
||||||
.current
|
|
||||||
.joins(:user)
|
|
||||||
.where.not("users.confirmed_at": nil)
|
|
||||||
.where("users.answered_count > 0")
|
|
||||||
.count
|
|
||||||
|
|
||||||
@users = user_count - current_ban_count
|
|
||||||
@questions = Question.count
|
|
||||||
@answers = Answer.count
|
|
||||||
@comments = Comment.count
|
|
||||||
@smiles = Appendable::Reaction.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def linkfilter
|
def linkfilter
|
||||||
redirect_to root_path unless params[:url]
|
redirect_to root_path unless params[:url]
|
||||||
|
|
||||||
@link = params[:url]
|
@link = params[:url]
|
||||||
end
|
end
|
||||||
|
|
||||||
def faq
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def privacy_policy
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def terms
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,4 +3,3 @@
|
||||||
.card
|
.card
|
||||||
.card-body
|
.card-body
|
||||||
= raw_markdown_io 'service-docs/en/policy/privacy.md'
|
= raw_markdown_io 'service-docs/en/policy/privacy.md'
|
||||||
|
|
|
@ -3,4 +3,3 @@
|
||||||
.card
|
.card
|
||||||
.card-body
|
.card-body
|
||||||
= raw_markdown_io 'service-docs/en/policy/terms.md'
|
= raw_markdown_io 'service-docs/en/policy/terms.md'
|
||||||
|
|
|
@ -57,6 +57,13 @@ en:
|
||||||
prompt:
|
prompt:
|
||||||
header: "What are you waiting for?"
|
header: "What are you waiting for?"
|
||||||
body: "Registering takes less than 5 minutes!"
|
body: "Registering takes less than 5 minutes!"
|
||||||
|
about:
|
||||||
|
title: "About"
|
||||||
|
subtitle: "About our service, features and other information"
|
||||||
|
about_missing: "The site owner decided not to describe this Retrospring instance, how mysterious!"
|
||||||
|
statistics:
|
||||||
|
header: "Statistics"
|
||||||
|
body: "All-time statistics for %{app_name}, updated every time you refresh the page!"
|
||||||
auth:
|
auth:
|
||||||
two_factor_authentication:
|
two_factor_authentication:
|
||||||
heading: "Two-factor authentication"
|
heading: "Two-factor authentication"
|
||||||
|
@ -369,13 +376,6 @@ en:
|
||||||
terms: "Terms of Service"
|
terms: "Terms of Service"
|
||||||
privacy: "Privacy Policy"
|
privacy: "Privacy Policy"
|
||||||
static:
|
static:
|
||||||
about:
|
|
||||||
title: "About"
|
|
||||||
subtitle: "About our service, features and other information"
|
|
||||||
about_missing: "The site owner decided not to describe this Retrospring instance, how mysterious!"
|
|
||||||
statistics:
|
|
||||||
header: "Statistics"
|
|
||||||
body: "All-time statistics for %{app_name}, updated every time you refresh the page!"
|
|
||||||
linkfilter:
|
linkfilter:
|
||||||
heading: "You're leaving %{app_name}"
|
heading: "You're leaving %{app_name}"
|
||||||
subheading: "The link you are visiting is not trusted by %{app_name}"
|
subheading: "The link you are visiting is not trusted by %{app_name}"
|
||||||
|
|
|
@ -42,9 +42,9 @@ Rails.application.routes.draw do
|
||||||
root to: 'timeline#index', as: :timeline
|
root to: 'timeline#index', as: :timeline
|
||||||
end
|
end
|
||||||
|
|
||||||
match '/about', to: 'static#about', via: 'get'
|
match '/about', to: 'about#about', via: 'get'
|
||||||
match '/privacy', to: 'static#privacy_policy', via: 'get', as: :privacy_policy
|
match '/privacy', to: 'about#privacy_policy', via: 'get', as: :privacy_policy
|
||||||
match '/terms', to: 'static#terms', via: 'get', as: :terms
|
match '/terms', to: 'about#terms', via: 'get', as: :terms
|
||||||
match '/linkfilter', to: 'static#linkfilter', via: 'get', as: :linkfilter
|
match '/linkfilter', to: 'static#linkfilter', via: 'get', as: :linkfilter
|
||||||
match '/manifest.json', to: 'manifests#show', via: 'get', as: :webapp_manifest
|
match '/manifest.json', to: 'manifests#show', via: 'get', as: :webapp_manifest
|
||||||
|
|
||||||
|
|
21
spec/controllers/about_controller_spec.rb
Normal file
21
spec/controllers/about_controller_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe AboutController, type: :controller do
|
||||||
|
describe "#about" do
|
||||||
|
subject { get :about }
|
||||||
|
|
||||||
|
before(:each) {
|
||||||
|
FactoryBot.create(:user, { confirmed_at: Time.current, answered_count: 1 })
|
||||||
|
FactoryBot.create(:user, { confirmed_at: Time.current, answered_count: 1 }).ban
|
||||||
|
FactoryBot.create(:user, { confirmed_at: Time.current })
|
||||||
|
FactoryBot.create(:user, { confirmed_at: Time.current }).ban
|
||||||
|
}
|
||||||
|
|
||||||
|
it "shows the correct user count" do
|
||||||
|
subject
|
||||||
|
expect(assigns(:users)).to eq(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,22 +3,6 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe StaticController, type: :controller do
|
describe StaticController, type: :controller do
|
||||||
describe "#about" do
|
|
||||||
subject { get :about }
|
|
||||||
|
|
||||||
before(:each) {
|
|
||||||
FactoryBot.create(:user, { confirmed_at: Time.current, answered_count: 1 })
|
|
||||||
FactoryBot.create(:user, { confirmed_at: Time.current, answered_count: 1 }).ban
|
|
||||||
FactoryBot.create(:user, { confirmed_at: Time.current })
|
|
||||||
FactoryBot.create(:user, { confirmed_at: Time.current }).ban
|
|
||||||
}
|
|
||||||
|
|
||||||
it "shows the correct user count" do
|
|
||||||
subject
|
|
||||||
expect(assigns(:users)).to eq(1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#linkfilter" do
|
describe "#linkfilter" do
|
||||||
context "called without an url" do
|
context "called without an url" do
|
||||||
subject { get :linkfilter }
|
subject { get :linkfilter }
|
||||||
|
|
Loading…
Reference in a new issue