Commit 8f7b2b34 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '201743-avoid-loading-user-activity-calendar-data-on-mobile' into 'master'

Avoid loading user activity calendar on user profile on mobile

Closes #201743

See merge request gitlab-org/gitlab!24277
parents 1c6fc0d5 c3ba5ac5
import $ from 'jquery';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import axios from '~/lib/utils/axios_utils';
import Activities from '~/activities';
import { localTimeAgo } from '~/lib/utils/datetime_utility';
......@@ -209,7 +210,7 @@ export default class UserTabs {
loadActivityCalendar() {
const $calendarWrap = this.$parentEl.find('.tab-pane.active .user-calendar');
if (!$calendarWrap.length) return;
if (!$calendarWrap.length || bp.getBreakpointSize() === 'xs') return;
const calendarPath = $calendarWrap.data('calendarPath');
......
---
title: Avoid loading user activity calendar on mobile
merge_request: 24277
author: Takuya Noguchi
type: fixed
......@@ -3,6 +3,8 @@
require 'spec_helper'
describe 'Contributions Calendar', :js do
include MobileHelpers
let(:user) { create(:user) }
let(:contributed_project) { create(:project, :public, :repository) }
let(:issue_note) { create(:note, project: contributed_project) }
......@@ -122,15 +124,15 @@ describe 'Contributions Calendar', :js do
end
end
describe 'calendar daily activities' do
shared_context 'visit user page' do
before do
visit user.username
page.find('.js-overview-tab a').click
wait_for_requests
end
shared_context 'visit user page' do
before do
visit user.username
page.find('.js-overview-tab a').click
wait_for_requests
end
end
describe 'calendar daily activities' do
shared_examples 'a day with activity' do |contribution_count:|
include_context 'visit user page'
......@@ -199,4 +201,22 @@ describe 'Contributions Calendar', :js do
end
end
end
describe 'on smaller screens' do
shared_examples 'hidden activity calendar' do
include_context 'visit user page'
it 'hides the activity calender' do
expect(find('#js-overview')).not_to have_css('.js-contrib-calendar')
end
end
context 'size xs' do
before do
resize_screen_xs
end
it_behaves_like 'hidden activity calendar'
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment