Skip to content

Commit aba2ff2

Browse files
authored
Merge pull request #4609 from crazyserver/MOBILE-4842
Mobile 4842
2 parents 21f192c + c70783c commit aba2ff2

File tree

8 files changed

+14
-60
lines changed

8 files changed

+14
-60
lines changed

src/addons/competency/services/competency.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ export class AddonCompetencyProvider {
4747
}
4848

4949
return site.canUseAdvancedFeature('enablecompetencies') &&
50-
!(site.isFeatureDisabled('CoreMainMenuDelegate_AddonCompetency') &&
51-
site.isFeatureDisabled('CoreCourseOptionsDelegate_AddonCompetency') &&
52-
site.isFeatureDisabled('CoreUserDelegate_AddonCompetency'));
50+
!(site.isFeatureDisabled('CoreUserDelegate_AddonCompetency') &&
51+
site.isFeatureDisabled('CoreCourseOptionsDelegate_AddonCompetency'));
5352
}
5453

5554
/**

src/addons/competency/services/handlers/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import { AddonCompetency } from '../competency';
3434
@Injectable( { providedIn: 'root' })
3535
export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler {
3636

37-
name = 'AddonCompetency'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
37+
// This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
38+
name = 'AddonCompetency:fakename';
3839
priority = 100;
3940
type = CoreUserProfileHandlerType.LIST_ITEM;
4041
cacheEnabled = true;
@@ -57,8 +58,7 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler
5758
}
5859

5960
if (context === CoreUserDelegateContext.USER_MENU) {
60-
// This option used to belong to main menu, check the original disabled feature value.
61-
if (currentSite.isFeatureDisabled('CoreMainMenuDelegate_AddonCompetency')) {
61+
if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonCompetency')) {
6262
return false;
6363
}
6464
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonCompetency:learningPlan')) {

src/addons/privatefiles/services/handlers/user.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,11 @@ export class AddonPrivateFilesUserHandlerService implements CoreUserProfileHandl
4545
return AddonPrivateFiles.isPluginEnabled();
4646
}
4747

48-
/**
49-
* @inheritdoc
50-
*/
51-
async isEnabledForContext(context: CoreUserDelegateContext): Promise<boolean> {
52-
// Private files only available in user menu.
53-
if (context !== CoreUserDelegateContext.USER_MENU) {
54-
return false;
55-
}
56-
57-
// Check if feature is disabled.
58-
const currentSite = CoreSites.getCurrentSite();
59-
if (!currentSite) {
60-
return false;
61-
}
62-
63-
// This option used to belong to main menu, check the original disabled feature value.
64-
return !currentSite.isFeatureDisabled('CoreMainMenuDelegate_AddonPrivateFiles');
65-
}
66-
6748
/**
6849
* @inheritdoc
6950
*/
7051
async isEnabledForUser(user: CoreUserProfile, context: CoreUserDelegateContext): Promise<boolean> {
71-
// Private files only available for the current user.
72-
return user.id == CoreSites.getCurrentSiteUserId() && context === CoreUserDelegateContext.USER_MENU;
52+
return user.id === CoreSites.getCurrentSiteUserId() && context === CoreUserDelegateContext.USER_MENU;
7353
}
7454

7555
/**

src/addons/privatefiles/services/privatefiles.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -261,30 +261,6 @@ export class AddonPrivateFilesProvider {
261261
await site.invalidateWsCacheForKey(this.getPrivateFilesInfoCacheKey(userId || site.getUserId()));
262262
}
263263

264-
/**
265-
* Check if Files is disabled in a certain site.
266-
*
267-
* @param siteId Site Id. If not defined, use current site.
268-
* @returns Promise resolved with true if disabled, rejected or resolved with false otherwise.
269-
*/
270-
async isDisabled(siteId?: string): Promise<boolean> {
271-
const site = await CoreSites.getSite(siteId);
272-
273-
return this.isDisabledInSite(site);
274-
}
275-
276-
/**
277-
* Check if Files is disabled in a certain site.
278-
*
279-
* @param site Site. If not defined, use current site.
280-
* @returns Whether it's disabled.
281-
*/
282-
isDisabledInSite(site: CoreSite): boolean {
283-
site = site || CoreSites.getCurrentSite();
284-
285-
return site.isFeatureDisabled('CoreMainMenuDelegate_AddonPrivateFiles');
286-
}
287-
288264
/**
289265
* Return whether or not the plugin is enabled.
290266
*

src/core/classes/sites/unauthenticated-site.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ export class CoreUnauthenticatedSite {
7777
{ old: /_mmaModWorkshop/g, new: '_AddonModWorkshop' },
7878
{ old: /remoteAddOn_/g, new: 'sitePlugin_' },
7979
{ old: /AddonNotes:addNote/g, new: 'AddonNotes:notes' },
80+
{ old: /CoreMainMenuDelegate_AddonCompetency/g, new: 'CoreUserDelegate_AddonCompetency' },
81+
{ old: /CoreMainMenuDelegate_AddonPrivateFiles/g, new: 'CoreUserDelegate_AddonPrivateFiles' },
82+
{ old: /CoreMainMenuDelegate_CoreGrades/g, new: 'CoreUserDelegate_CoreGrades' },
8083
];
8184

8285
/**

src/core/directives/reading-mode.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,12 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
137137
this.disabledStyles = this.disabledStyles.concat(disabledStyles);
138138

139139
// Rename style attributes on DOM elements.
140-
const renamedStyles: HTMLElement[] = Array.from(element.querySelectorAll('*[style]'));
141-
renamedStyles.forEach((element: HTMLElement) => {
142-
this.renamedStyles.push(element);
140+
this.renamedStyles = Array.from(element.querySelectorAll('*[style]'));
141+
this.renamedStyles.forEach((element: HTMLElement) => {
143142
element.setAttribute('data-original-style', element.getAttribute('style') || '');
144143
element.removeAttribute('style');
145144
});
146145

147-
this.renamedStyles = this.renamedStyles.concat(renamedStyles);
148-
149146
// Navigate to parent hidding all other elements.
150147
let currentChild = element;
151148
let parent = currentChild.parentElement;

src/core/features/grades/services/handlers/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ import { GRADES_PAGE_NAME } from '../../constants';
3636
@Injectable({ providedIn: 'root' })
3737
export class CoreGradesUserHandlerService implements CoreUserProfileHandler {
3838

39-
name = 'CoreGrades'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
39+
// This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
40+
name = 'CoreGrades:fakename';
4041
priority = 500;
4142
type = CoreUserProfileHandlerType.LIST_ITEM;
4243
cacheEnabled = true;
@@ -59,8 +60,7 @@ export class CoreGradesUserHandlerService implements CoreUserProfileHandler {
5960
}
6061

6162
if (context === CoreUserDelegateContext.USER_MENU) {
62-
// This option used to belong to main menu, check the original disabled feature value.
63-
if (currentSite.isFeatureDisabled('CoreMainMenuDelegate_CoreGrades')) {
63+
if (currentSite.isFeatureDisabled('CoreUserDelegate_CoreGrades')) {
6464
return false;
6565
}
6666
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_CoreGrades:viewGrades')) {

src/theme/components/swiper.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ swiper-container {
5151
display: flex;
5252
flex-direction: column;
5353
flex-grow: 1;
54-
overflow: hidden;
5554

5655
swiper-container {
5756
flex-grow: 1;

0 commit comments

Comments
 (0)