Skip to content
Snippets Groups Projects
Commit 960b7273 authored by Justin Ho Tuan Duong's avatar Justin Ho Tuan Duong Committed by Bob Van Landuyt
Browse files

Remove jira_connect/users page

Changelog: removed
parent 93560c69
No related branches found
No related tags found
2 merge requests!122597doc/gitaly: Remove references to removed metrics,!119712Remove jira_connect/users page
Showing
with 4 additions and 143 deletions
......@@ -98,7 +98,6 @@ Style/ClassAndModuleChildren:
- 'app/controllers/jira_connect/installations_controller.rb'
- 'app/controllers/jira_connect/oauth_callbacks_controller.rb'
- 'app/controllers/jira_connect/subscriptions_controller.rb'
- 'app/controllers/jira_connect/users_controller.rb'
- 'app/controllers/ldap/omniauth_callbacks_controller.rb'
- 'app/controllers/oauth/applications_controller.rb'
- 'app/controllers/oauth/authorizations_controller.rb'
......
@import '../themes/theme_indigo';
......@@ -30,7 +30,7 @@ def index
respond_to do |format|
format.html
format.json do
render json: JiraConnect::AppDataSerializer.new(@subscriptions, !!current_user).as_json
render json: JiraConnect::AppDataSerializer.new(@subscriptions).as_json
end
end
end
......
# frozen_string_literal: true
class JiraConnect::UsersController < ApplicationController
feature_category :integrations
layout 'signup_onboarding'
before_action :verify_return_to_url, only: [:show]
def show
@jira_app_link = params.delete(:return_to)
end
private
def verify_return_to_url
return unless params[:return_to].present?
params.delete(:return_to) unless Integrations::Jira.valid_jira_cloud_url?(params[:return_to])
end
end
......@@ -4,9 +4,8 @@ class JiraConnect::AppDataSerializer
include Gitlab::Routing
include ::API::Helpers::RelatedResourcesHelpers
def initialize(subscriptions, signed_in)
def initialize(subscriptions)
@subscriptions = subscriptions
@signed_in = signed_in
end
def as_json
......@@ -15,14 +14,7 @@ def as_json
{
groups_path: api_v4_groups_path(params: { min_access_level: Gitlab::Access::MAINTAINER, skip_groups: skip_groups }),
subscriptions: JiraConnect::SubscriptionEntity.represent(@subscriptions).as_json,
subscriptions_path: jira_connect_subscriptions_path,
login_path: signed_in? ? nil : jira_connect_users_path
subscriptions_path: jira_connect_subscriptions_path
}
end
private
def signed_in?
!!@signed_in
end
end
.gl-text-center.gl-mx-auto.gl-pt-6
%h3.gl-mb-4
= _('You are signed in to GitLab as:')
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-mb-4
= link_to user_path(current_user), target: '_blank', rel: 'noopener noreferrer' do
= user_avatar_without_link(user: current_user, size: 60, css_class: 'gl-mr-0! gl-mb-2', has_tooltip: false)
= link_to current_user.to_reference, user_path(current_user), target: '_blank', rel: 'noopener noreferrer'
%p.gl-mb-6
= s_('JiraService|You can now close this window and%{br}return to the GitLab for Jira application.').html_safe % { br: '<br>'.html_safe }
- if @jira_app_link
%p
= render Pajamas::ButtonComponent.new(href: @jira_app_link, variant: :confirm) do
= s_('Integrations|Return to GitLab for Jira')
%p= link_to _('Sign out'), destroy_user_session_path, method: :post
- add_page_specific_style 'page_bundles/jira_connect_users'
......@@ -292,7 +292,6 @@ class Application < Rails::Application
config.assets.precompile << "page_bundles/issues_list.css"
config.assets.precompile << "page_bundles/issues_show.css"
config.assets.precompile << "page_bundles/jira_connect.css"
config.assets.precompile << "page_bundles/jira_connect_users.css"
config.assets.precompile << "page_bundles/learn_gitlab.css"
config.assets.precompile << "page_bundles/login.css"
config.assets.precompile << "page_bundles/marketing_popover.css"
......
......@@ -5,7 +5,6 @@
root to: proc { [404, {}, ['']] }, as: 'base'
get 'app_descriptor' => 'app_descriptor#show'
get :users, to: 'users#show'
namespace :events do
post 'installed'
......
......@@ -23979,9 +23979,6 @@ msgstr ""
msgid "Integrations|Restrict to branch (optional)"
msgstr ""
 
msgid "Integrations|Return to GitLab for Jira"
msgstr ""
msgid "Integrations|SSL verification"
msgstr ""
 
......@@ -25310,9 +25307,6 @@ msgstr ""
msgid "JiraService|Work on Jira issues without leaving GitLab. Add a Jira menu to access a read-only list of your Jira issues. %{jira_issues_link_start}Learn more.%{link_end}"
msgstr ""
 
msgid "JiraService|You can now close this window and%{br}return to the GitLab for Jira application."
msgstr ""
msgid "JiraService|You must configure Jira before enabling this integration. %{jira_doc_link_start}Learn more.%{link_end}"
msgstr ""
 
......@@ -51131,9 +51125,6 @@ msgstr ""
msgid "You are receiving this message because you are a GitLab administrator for %{url}."
msgstr ""
 
msgid "You are signed in to GitLab as:"
msgstr ""
msgid "You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico."
msgstr ""
 
......@@ -56,26 +56,6 @@
expect(json_response).to include('subscriptions_path' => jira_connect_subscriptions_path)
end
context 'when not signed in to GitLab' do
it 'contains a login path' do
expect(json_response).to include('login_path' => jira_connect_users_path)
end
end
context 'when signed in to GitLab' do
let(:user) { create(:user) }
before do
sign_in(user)
get :index, params: { jwt: jwt }
end
it 'does not contain a login path' do
expect(json_response).to include('login_path' => nil)
end
end
context 'with context qsh' do
# The JSON endpoint will be requested by frontend using a JWT that Atlassian provides via Javascript.
# This JWT will likely use a context-qsh because Atlassian don't know for which endpoint it will be used.
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe JiraConnect::UsersController, feature_category: :integrations do
describe 'GET /-/jira_connect/users' do
let_it_be(:user) { create(:user) }
before do
sign_in(user)
end
context 'with a valid host' do
let(:return_to) { 'https://testcompany.atlassian.net/plugins/servlet/ac/gitlab-jira-connect-staging.gitlab.com/gitlab-configuration' }
it 'includes a return url' do
get '/-/jira_connect/users', params: { return_to: return_to }
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include('Return to GitLab')
end
end
context 'with an invalid host' do
let(:return_to) { 'https://evil.com' }
it 'does not include a return url' do
get '/-/jira_connect/users', params: { return_to: return_to }
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to include('Return to GitLab')
end
end
context 'with a script injected' do
let(:return_to) { 'javascript://test.atlassian.net/%250dalert(document.domain)' }
it 'does not include a return url' do
get '/-/jira_connect/users', params: { return_to: return_to }
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to include('Return to GitLab')
end
end
end
end
......@@ -4,12 +4,10 @@
RSpec.describe JiraConnect::AppDataSerializer do
describe '#as_json' do
subject(:app_data_json) { described_class.new(subscriptions, signed_in).as_json }
subject(:app_data_json) { described_class.new(subscriptions).as_json }
let_it_be(:subscriptions) { create_list(:jira_connect_subscription, 2) }
let(:signed_in) { false }
it 'uses the subscription entity' do
expect(JiraConnect::SubscriptionEntity).to receive(:represent).with(subscriptions)
......@@ -23,12 +21,5 @@
end
it { is_expected.to include(subscriptions_path: '/-/jira_connect/subscriptions') }
it { is_expected.to include(login_path: '/-/jira_connect/users') }
context 'when signed in' do
let(:signed_in) { true }
it { is_expected.to include(login_path: nil) }
end
end
end
......@@ -8641,7 +8641,6 @@
- './spec/requests/jira_connect/oauth_application_ids_controller_spec.rb'
- './spec/requests/jira_connect/oauth_callbacks_controller_spec.rb'
- './spec/requests/jira_connect/subscriptions_controller_spec.rb'
- './spec/requests/jira_connect/users_controller_spec.rb'
- './spec/requests/jira_routing_spec.rb'
- './spec/requests/jwks_controller_spec.rb'
- './spec/requests/jwt_controller_spec.rb'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment