1
0
mirror of https://github.com/laurent22/joplin.git synced 2026-01-20 00:46:28 +02:00

Compare commits

..

14 Commits

Author SHA1 Message Date
Laurent Cozic
f6cd988939 disable edition if no multi profiles 2022-04-11 16:36:23 +01:00
Laurent Cozic
a99eec7cdf 1 based 2022-04-11 16:24:41 +01:00
Laurent Cozic
7ef09dfa77 enter to valid 2022-04-11 16:19:27 +01:00
Laurent Cozic
b11573a2a7 Disable welcome notes 2022-04-11 12:30:54 +01:00
Laurent Cozic
f4034b1ff0 Merge branch 'dev' into multi_profiles 2022-04-11 12:22:48 +01:00
Laurent Cozic
dfadacd7f4 save settings 2022-04-10 19:13:01 +01:00
Laurent Cozic
ecc7b17708 loading settings 2022-04-10 18:19:56 +01:00
Laurent Cozic
ee6ab55649 setting loading 2022-04-10 16:50:11 +01:00
Laurent Cozic
b0d64e2f51 Merge branch 'dev' into multi_profiles 2022-04-10 15:23:19 +01:00
Laurent Cozic
f322d40910 tests 2022-04-09 18:29:20 +01:00
Laurent Cozic
557cb9a6c3 edit profile 2022-04-09 17:38:39 +01:00
Laurent Cozic
d5a55c7908 ui 2022-04-09 17:21:48 +01:00
Laurent Cozic
7308bbd3ca switch logic 2022-04-09 16:42:49 +01:00
Laurent Cozic
c1e8f9befd Multi profile support 2022-04-09 15:37:14 +01:00
12 changed files with 10 additions and 57 deletions

View File

@@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
# Removed windows-2016 for now - discontinued by GitHub
os: [macos-latest, ubuntu-latest, windows-2019]
os: [macos-latest, ubuntu-latest]
steps:
# Silence apt-get update errors (for example when a module doesn't

View File

@@ -110,7 +110,7 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
let listItemTitleStyle = Object.assign({}, props.style.listItemTitle);
listItemTitleStyle.paddingLeft = !item.is_todo ? hPadding : 4;
if (item.is_shared) listItemTitleStyle.color = theme.colorWarn3;
if (item.is_shared) listItemTitleStyle.color = theme.colorWarn2;
if (item.is_todo && !!item.todo_completed) listItemTitleStyle = Object.assign(listItemTitleStyle, props.style.listItemTitleCompleted);
const displayTitle = Note.displayTitle(item);

View File

@@ -1,6 +1,5 @@
import { notesSortOrderFieldArray, notesSortOrderNextField, setNotesSortOrder } from './notesSortOrderUtils';
import Setting from '@joplin/lib/models/Setting';
// import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
const { shimInit } = require('@joplin/lib/shim-init-node.js');
beforeAll(() => {
@@ -10,12 +9,6 @@ beforeAll(() => {
describe('notesSortOrderUtils', () => {
// beforeEach(async (done) => {
// await setupDatabaseAndSynchronizer(1);
// await switchClient(1);
// done();
// });
it('should always provide the same ordered fields', async () => {
const expected = ['user_updated_time', 'user_created_time', 'title', 'order'];
expect(notesSortOrderFieldArray()).toStrictEqual(expected);

View File

@@ -23,11 +23,6 @@ const switchToSubProfileSettings = async () => {
await Setting.load();
};
const restoreSettingState = async () => {
await setupDatabaseAndSynchronizer(1);
await switchClient(1);
};
describe('models/Setting', function() {
beforeEach(async (done) => {
@@ -296,8 +291,6 @@ describe('models/Setting', function() {
expect((await Setting.loadOne('locale')).value).toBe('fr_FR');
expect((await Setting.loadOne('theme')).value).toBe(Setting.THEME_DARK);
expect((await Setting.loadOne('sync.target')).value).toBe(undefined);
await restoreSettingState();
});
it('should save sub-profile settings', async () => {
@@ -334,8 +327,6 @@ describe('models/Setting', function() {
'$schema': 'https://joplinapp.org/schema/settings.json',
'sync.target': 8,
});
await restoreSettingState();
});
it('all global settings should be saved to file', async () => {

View File

@@ -1516,7 +1516,7 @@ class Setting extends BaseModel {
this.metadata_ = Object.assign(this.metadata_, this.customMetadata_);
if (this.constants_.env === Env.Dev) this.validateMetadata(this.metadata_);
if (this.value('env') === Env.Dev) this.validateMetadata(this.metadata_);
return this.metadata_;
}

View File

@@ -46,6 +46,7 @@ export default class InteropService_Importer_Md extends InteropService_Importer_
}
async importDirectory(dirPath: string, parentFolderId: string) {
console.info(`Import: ${dirPath}`);
const supportedFileExtension = this.metadata().fileExtensions;
const stats = await shim.fsDriver().readDirStats(dirPath);
for (let i = 0; i < stats.length; i++) {
@@ -53,6 +54,7 @@ export default class InteropService_Importer_Md extends InteropService_Importer_
if (stat.isDirectory()) {
if (await this.isDirectoryEmpty(`${dirPath}/${stat.path}`)) {
console.info(`Ignoring empty directory: ${stat.path}`);
continue;
}
const folderTitle = await Folder.findUniqueItemTitle(basename(stat.path));

View File

@@ -379,28 +379,6 @@ describe('services_rest_Api', function() {
expect(resourceV2.size).toBe((await shim.fsDriver().stat(Resource.fullPath(resourceV2))).size);
}));
it('should allow updating a resource file only', (async () => {
await api.route(RequestMethod.POST, 'resources', null, JSON.stringify({
title: 'resource',
}), [{ path: `${supportDir}/photo.jpg` }]);
const resourceV1: ResourceEntity = (await Resource.all())[0];
await msleep(1);
await api.route(RequestMethod.PUT, `resources/${resourceV1.id}`, null, null, [
{
path: `${supportDir}/photo-large.png`,
},
]);
const resourceV2: ResourceEntity = (await Resource.all())[0];
// It should have updated the file content, but not the metadata
expect(resourceV2.title).toBe(resourceV1.title);
expect(resourceV2.size).toBeGreaterThan(resourceV1.size);
}));
it('should update resource properties', (async () => {
await api.route(RequestMethod.POST, 'resources', null, JSON.stringify({
title: 'resource',

View File

@@ -26,7 +26,6 @@ const input: Theme = {
selectedColor2: '#131313',
colorError2: '#ff6c6c',
colorWarn2: '#ffcb81',
colorWarn3: '#ff7626',
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.
@@ -77,7 +76,6 @@ const expected = `
--joplin-selected-color2: #131313;
--joplin-color-error2: #ff6c6c;
--joplin-color-warn2: #ffcb81;
--joplin-color-warn3: #ff7626;
--joplin-background-color3: #F4F5F6;
--joplin-background-color-hover3: #CBDAF1;
--joplin-color3: #738598;

View File

@@ -235,8 +235,6 @@ function shimInit(options = null) {
const readChunk = require('read-chunk');
const imageType = require('image-type');
const isUpdate = !!options.destinationResourceId;
const uuid = require('./uuid').default;
if (!(await fs.pathExists(filePath))) throw new Error(_('Cannot access %s', filePath));
@@ -244,16 +242,12 @@ function shimInit(options = null) {
defaultProps = defaultProps ? defaultProps : {};
let resourceId = defaultProps.id ? defaultProps.id : uuid.create();
if (isUpdate) resourceId = options.destinationResourceId;
if (options.destinationResourceId) resourceId = options.destinationResourceId;
let resource = isUpdate ? {} : Resource.new();
let resource = options.destinationResourceId ? {} : Resource.new();
resource.id = resourceId;
// When this is an update we auto-update the mime type, in case the
// content type has changed, but we keep the title. It is still possible
// to modify the title on update using defaultProps.
resource.mime = mimeUtils.fromFilename(filePath);
if (!isUpdate) resource.title = basename(filePath);
resource.title = basename(filePath);
let fileExt = safeFileExtension(fileExtension(filePath));
@@ -294,7 +288,7 @@ function shimInit(options = null) {
const saveOptions = { isNew: true };
if (options.userSideValidation) saveOptions.userSideValidation = true;
if (isUpdate) {
if (options.destinationResourceId) {
saveOptions.isNew = false;
const tempPath = `${targetPath}.tmp`;
await shim.fsDriver().move(targetPath, tempPath);

View File

@@ -29,7 +29,6 @@ const theme: Theme = {
selectedColor2: '#013F74',
colorError2: '#ff6c6c',
colorWarn2: '#ffcb81',
colorWarn3: '#ffcb81',
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.

View File

@@ -26,7 +26,6 @@ const theme: Theme = {
selectedColor2: '#131313',
colorError2: '#ff6c6c',
colorWarn2: '#ffcb81',
colorWarn3: '#ff7626',
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.

View File

@@ -27,8 +27,7 @@ export interface Theme {
color2: string;
selectedColor2: string;
colorError2: string;
colorWarn2: string; // On a darker background (eg. sidebar)
colorWarn3: string; // On a lighter background (eg. note list)
colorWarn2: string;
// Color scheme "3" is used for the config screens for example/
// It's dark text over gray background.