Merge pull request #3506 from dpalou/MOBILE-4081

Mobile 4081
main
Noel De Martin 2022-12-13 13:06:51 +01:00 committed by GitHub
commit 578c40f3d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View File

@ -53,6 +53,7 @@
"ro": "Română",
"ru": "Русский",
"sl": "Slovenščina",
"sq": "Shqip",
"sr-cr": "Српски",
"sr-lt": "Srpski",
"sv": "Svenska",

View File

@ -617,7 +617,7 @@ export class AddonCalendarHelperProvider {
const eventCourse = (event.course && event.course.id) || event.courseid;
// Show the event if it is from site home or if it matches the selected course.
return !!eventCourse && (eventCourse == CoreSites.getCurrentSiteHomeId() || eventCourse == courseId);
return !eventCourse || (eventCourse === CoreSites.getCurrentSiteHomeId() || eventCourse === courseId);
}
/**

View File

@ -166,7 +166,7 @@
<!-- Add or edit submission. -->
<div collapsible-footer *ngIf="loaded && !isSubmittedForGrading" [hidden]="selectedTab !== 'submission'" slot="fixed">
<div class="list-item-limited-width adaptable-buttons-row" *ngIf="canEdit || canSubmit">
<div class="list-item-limited-width" *ngIf="canEdit || canSubmit">
<ng-container *ngIf="canEdit">
<ng-container *ngIf=" !unsupportedEditPlugins.length && !showErrorStatementEdit">
<!-- If has offline data, show edit. -->

View File

@ -15,6 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { PREFERENCES_TABLE_NAME, CoreUserPreferenceDBRecord } from './database/user';
@ -33,7 +34,10 @@ export class CoreUserOfflineProvider {
async getChangedPreferences(siteId?: string): Promise<CoreUserPreferenceDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return site.getDb().getRecordsSelect(PREFERENCES_TABLE_NAME, 'value != onlineValue');
return site.getDb().getRecordsSelect(
PREFERENCES_TABLE_NAME,
'value != onlinevalue OR onlinevalue IS NULL',
);
}
/**
@ -64,8 +68,19 @@ export class CoreUserOfflineProvider {
const record: Partial<CoreUserPreferenceDBRecord> = {
name,
value,
onlinevalue: onlineValue,
};
if (onlineValue === undefined) {
// Keep online value already stored (if any).
const entry = await CoreUtils.ignoreErrors(
site.getDb().getRecord<CoreUserPreferenceDBRecord>(PREFERENCES_TABLE_NAME, { name }),
null,
);
record.onlinevalue = entry?.onlinevalue;
}
await site.getDb().insertRecord(PREFERENCES_TABLE_NAME, record);
}