forked from CIT/Vmeda.Online
		
	Merge pull request #2773 from crazyserver/MOBILE-3615
MOBILE-3615 url: Fix docs url release number
This commit is contained in:
		
						commit
						119b0178db
					
				@ -668,6 +668,21 @@ export class CoreSitesProvider {
 | 
			
		||||
        return '';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the major release number from site release info.
 | 
			
		||||
     *
 | 
			
		||||
     * @param rawRelease Raw release info text.
 | 
			
		||||
     * @return Major release number or empty.
 | 
			
		||||
     */
 | 
			
		||||
    getMajorReleaseNumber(rawRelease: string): string {
 | 
			
		||||
        const matches = rawRelease.match(/^\d+(\.\d+)?/);
 | 
			
		||||
        if (matches) {
 | 
			
		||||
            return matches[0];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return '';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Saves a site in local DB.
 | 
			
		||||
     *
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ import { CoreConstants } from '@/core/constants';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { CoreApp } from '@services/app';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * "Utils" service with helper functions for URLs.
 | 
			
		||||
@ -233,7 +234,8 @@ export class CoreUrlUtilsProvider {
 | 
			
		||||
        let docsUrl = 'https://docs.moodle.org/en/' + page;
 | 
			
		||||
 | 
			
		||||
        if (typeof release != 'undefined') {
 | 
			
		||||
            const version = release.substr(0, 3).replace('.', '');
 | 
			
		||||
            const version = CoreSites.getMajorReleaseNumber(release).replace('.', '');
 | 
			
		||||
 | 
			
		||||
            // Check is a valid number.
 | 
			
		||||
            if (Number(version) >= 24) {
 | 
			
		||||
                // Append release number.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user