Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/addons/competency/services/competency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ export class AddonCompetencyProvider {
}

return site.canUseAdvancedFeature('enablecompetencies') &&
!(site.isFeatureDisabled('CoreMainMenuDelegate_AddonCompetency') &&
site.isFeatureDisabled('CoreCourseOptionsDelegate_AddonCompetency') &&
site.isFeatureDisabled('CoreUserDelegate_AddonCompetency'));
!(site.isFeatureDisabled('CoreUserDelegate_AddonCompetency') &&
site.isFeatureDisabled('CoreCourseOptionsDelegate_AddonCompetency'));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/addons/competency/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import { AddonCompetency } from '../competency';
@Injectable( { providedIn: 'root' })
export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler {

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

if (context === CoreUserDelegateContext.USER_MENU) {
// This option used to belong to main menu, check the original disabled feature value.
if (currentSite.isFeatureDisabled('CoreMainMenuDelegate_AddonCompetency')) {
if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonCompetency')) {
return false;
}
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonCompetency:learningPlan')) {
Expand Down
22 changes: 1 addition & 21 deletions src/addons/privatefiles/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,11 @@ export class AddonPrivateFilesUserHandlerService implements CoreUserProfileHandl
return AddonPrivateFiles.isPluginEnabled();
}

/**
* @inheritdoc
*/
async isEnabledForContext(context: CoreUserDelegateContext): Promise<boolean> {
// Private files only available in user menu.
if (context !== CoreUserDelegateContext.USER_MENU) {
return false;
}

// Check if feature is disabled.
const currentSite = CoreSites.getCurrentSite();
if (!currentSite) {
return false;
}

// This option used to belong to main menu, check the original disabled feature value.
return !currentSite.isFeatureDisabled('CoreMainMenuDelegate_AddonPrivateFiles');
}

/**
* @inheritdoc
*/
async isEnabledForUser(user: CoreUserProfile, context: CoreUserDelegateContext): Promise<boolean> {
// Private files only available for the current user.
return user.id == CoreSites.getCurrentSiteUserId() && context === CoreUserDelegateContext.USER_MENU;
return user.id === CoreSites.getCurrentSiteUserId() && context === CoreUserDelegateContext.USER_MENU;
}

/**
Expand Down
24 changes: 0 additions & 24 deletions src/addons/privatefiles/services/privatefiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,30 +261,6 @@ export class AddonPrivateFilesProvider {
await site.invalidateWsCacheForKey(this.getPrivateFilesInfoCacheKey(userId || site.getUserId()));
}

/**
* Check if Files is disabled in a certain site.
*
* @param siteId Site Id. If not defined, use current site.
* @returns Promise resolved with true if disabled, rejected or resolved with false otherwise.
*/
async isDisabled(siteId?: string): Promise<boolean> {
const site = await CoreSites.getSite(siteId);

return this.isDisabledInSite(site);
}

/**
* Check if Files is disabled in a certain site.
*
* @param site Site. If not defined, use current site.
* @returns Whether it's disabled.
*/
isDisabledInSite(site: CoreSite): boolean {
site = site || CoreSites.getCurrentSite();

return site.isFeatureDisabled('CoreMainMenuDelegate_AddonPrivateFiles');
}

/**
* Return whether or not the plugin is enabled.
*
Expand Down
3 changes: 3 additions & 0 deletions src/core/classes/sites/unauthenticated-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export class CoreUnauthenticatedSite {
{ old: /_mmaModWorkshop/g, new: '_AddonModWorkshop' },
{ old: /remoteAddOn_/g, new: 'sitePlugin_' },
{ old: /AddonNotes:addNote/g, new: 'AddonNotes:notes' },
{ old: /CoreMainMenuDelegate_AddonCompetency/g, new: 'CoreUserDelegate_AddonCompetency' },
{ old: /CoreMainMenuDelegate_AddonPrivateFiles/g, new: 'CoreUserDelegate_AddonPrivateFiles' },
{ old: /CoreMainMenuDelegate_CoreGrades/g, new: 'CoreUserDelegate_CoreGrades' },
];

/**
Expand Down
7 changes: 2 additions & 5 deletions src/core/directives/reading-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,12 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
this.disabledStyles = this.disabledStyles.concat(disabledStyles);

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

this.renamedStyles = this.renamedStyles.concat(renamedStyles);

// Navigate to parent hidding all other elements.
let currentChild = element;
let parent = currentChild.parentElement;
Expand Down
6 changes: 3 additions & 3 deletions src/core/features/grades/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { GRADES_PAGE_NAME } from '../../constants';
@Injectable({ providedIn: 'root' })
export class CoreGradesUserHandlerService implements CoreUserProfileHandler {

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

if (context === CoreUserDelegateContext.USER_MENU) {
// This option used to belong to main menu, check the original disabled feature value.
if (currentSite.isFeatureDisabled('CoreMainMenuDelegate_CoreGrades')) {
if (currentSite.isFeatureDisabled('CoreUserDelegate_CoreGrades')) {
return false;
}
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_CoreGrades:viewGrades')) {
Expand Down
1 change: 0 additions & 1 deletion src/theme/components/swiper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ swiper-container {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow: hidden;

swiper-container {
flex-grow: 1;
Expand Down