From 3c6503038ecad20f1b8fa0c9ea7e46087c6e3f22 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 14 Aug 2017 04:53:31 +0200 Subject: Add protocol handler. Handle follow intents (#4511) * Add protocol handler. Handle follow intents * Add share intent * Improve code in intents controller * Adjust share form CSS --- app/controllers/shares_controller.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 app/controllers/shares_controller.rb (limited to 'app/controllers/shares_controller.rb') diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb new file mode 100644 index 000000000..d70d66ff8 --- /dev/null +++ b/app/controllers/shares_controller.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class SharesController < ApplicationController + layout 'public' + + before_action :authenticate_user! + + def show + serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer) + @initial_state_json = serializable_resource.to_json + end + + private + + def initial_state_params + { + settings: Web::Setting.find_by(user: current_user)&.data || {}, + push_subscription: current_account.user.web_push_subscription(current_session), + current_account: current_account, + token: current_session.token, + admin: Account.find_local(Setting.site_contact_username), + text: params[:text], + } + end +end -- cgit From f814661fcaed99221bf0b250dbe14349cb702833 Mon Sep 17 00:00:00 2001 From: Clworld Date: Wed, 16 Aug 2017 23:48:44 +0900 Subject: Make share intent modal to make "signed in as" shown. (#4611) * Make share intent modal to make "signed in as" shown. * fix glitch on mobile. --- app/controllers/shares_controller.rb | 7 ++++++- app/javascript/styles/containers.scss | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app/controllers/shares_controller.rb') diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb index d70d66ff8..994742c3d 100644 --- a/app/controllers/shares_controller.rb +++ b/app/controllers/shares_controller.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true class SharesController < ApplicationController - layout 'public' + layout 'modal' before_action :authenticate_user! + before_action :set_body_classes def show serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer) @@ -22,4 +23,8 @@ class SharesController < ApplicationController text: params[:text], } end + + def set_body_classes + @body_classes = 'compose-standalone' + end end diff --git a/app/javascript/styles/containers.scss b/app/javascript/styles/containers.scss index 063db44db..cfe8ea643 100644 --- a/app/javascript/styles/containers.scss +++ b/app/javascript/styles/containers.scss @@ -53,6 +53,7 @@ box-sizing: border-box; @media screen and (max-width: 400px) { + width: 100%; margin-top: 0; padding: 20px; } -- cgit