forked from EVOgeek/Vmeda.Online
		
	MOBILE-4081 core: Fix site name not translated in My Courses
This commit is contained in:
		
							parent
							
								
									bc83f62f0b
								
							
						
					
					
						commit
						9076a61493
					
				@ -958,18 +958,12 @@ export class CoreSite {
 | 
				
			|||||||
        // Call the WS.
 | 
					        // Call the WS.
 | 
				
			||||||
        const initialToken = this.token ?? '';
 | 
					        const initialToken = this.token ?? '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Call the WS.
 | 
					        // Send the language to use. Do it after checking cache to prevent losing offline data when changing language.
 | 
				
			||||||
        if (method !== 'core_webservice_get_site_info') {
 | 
					        // Moodle uses underscore instead of dash.
 | 
				
			||||||
            // Send the language to use. Do it after checking cache to prevent losing offline data when changing language.
 | 
					        data = {
 | 
				
			||||||
            // Don't send it to core_webservice_get_site_info, that WS is used to check if Moodle version is supported.
 | 
					            ...data,
 | 
				
			||||||
            data = {
 | 
					            moodlewssettinglang: (preSets.lang ?? await CoreLang.getCurrentLanguage()).replace('-', '_'),
 | 
				
			||||||
                ...data,
 | 
					        };
 | 
				
			||||||
                moodlewssettinglang: preSets.lang ?? await CoreLang.getCurrentLanguage(),
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
            // Moodle uses underscore instead of dash.
 | 
					 | 
				
			||||||
            data.moodlewssettinglang = data.moodlewssettinglang.replace('-', '_');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            return await this.callOrEnqueueRequest<T>(method, data, preSets, wsPreSets);
 | 
					            return await this.callOrEnqueueRequest<T>(method, data, preSets, wsPreSets);
 | 
				
			||||||
@ -988,6 +982,14 @@ export class CoreSite {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (error?.errorcode === 'invalidparameter' && method === 'core_webservice_get_site_info') {
 | 
				
			||||||
 | 
					                // Retry without passing the lang, this parameter isn't supported in 3.4 or older sites
 | 
				
			||||||
 | 
					                // and we need this WS call to be able to determine if the site is supported or not.
 | 
				
			||||||
 | 
					                delete data.moodlewssettinglang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return await this.callOrEnqueueRequest<T>(method, data, preSets, wsPreSets);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            throw error;
 | 
					            throw error;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user