1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-23 23:33:01 +02:00

Compare commits

..

12 Commits

Author SHA1 Message Date
Laurent Cozic
1c7b568b20 fixed test 2022-04-11 22:50:26 +01:00
Laurent Cozic
c3d892615d fixed test 2022-04-11 21:59:19 +01:00
Laurent Cozic
0c5d2b8120 Revert "fixed test"
This reverts commit 80a94f02b9.
2022-04-11 21:58:13 +01:00
Laurent Cozic
80a94f02b9 fixed test 2022-04-11 20:41:41 +01:00
Laurent Cozic
d3763345f0 fixed test 2022-04-11 20:03:14 +01:00
Laurent Cozic
9cf19f4b5c fixed test 2022-04-11 19:32:43 +01:00
Laurent Cozic
da2a61df0a fixed test 2022-04-11 19:27:56 +01:00
Laurent Cozic
da2a00bf1d fixed test 2022-04-11 18:08:40 +01:00
Laurent Cozic
37c712c778 trying to fix windows ci 2022-04-11 17:49:04 +01:00
Laurent Cozic
21706fa00a Desktop: Fixed color of published note on Light theme 2022-04-11 17:46:33 +01:00
Laurent Cozic
74273cd570 Plugins: Allow updating a resource via the data API 2022-04-11 17:01:01 +01:00
Laurent
6458ad0540 Desktop: Resolves #591: Add support for multiple profiles (#6385) 2022-04-11 16:49:32 +01:00
12 changed files with 57 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
# Removed windows-2016 for now - discontinued by GitHub
os: [macos-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest, windows-2019]
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.colorWarn2;
if (item.is_shared) listItemTitleStyle.color = theme.colorWarn3;
if (item.is_todo && !!item.todo_completed) listItemTitleStyle = Object.assign(listItemTitleStyle, props.style.listItemTitleCompleted);
const displayTitle = Note.displayTitle(item);

View File

@@ -1,5 +1,6 @@
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(() => {
@@ -9,6 +10,12 @@ 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,6 +23,11 @@ const switchToSubProfileSettings = async () => {
await Setting.load();
};
const restoreSettingState = async () => {
await setupDatabaseAndSynchronizer(1);
await switchClient(1);
};
describe('models/Setting', function() {
beforeEach(async (done) => {
@@ -291,6 +296,8 @@ 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 () => {
@@ -327,6 +334,8 @@ 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.value('env') === Env.Dev) this.validateMetadata(this.metadata_);
if (this.constants_.env === Env.Dev) this.validateMetadata(this.metadata_);
return this.metadata_;
}

View File

@@ -46,7 +46,6 @@ 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++) {
@@ -54,7 +53,6 @@ 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,6 +379,28 @@ 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,6 +26,7 @@ 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.
@@ -76,6 +77,7 @@ 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,6 +235,8 @@ 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));
@@ -242,12 +244,16 @@ function shimInit(options = null) {
defaultProps = defaultProps ? defaultProps : {};
let resourceId = defaultProps.id ? defaultProps.id : uuid.create();
if (options.destinationResourceId) resourceId = options.destinationResourceId;
if (isUpdate) resourceId = options.destinationResourceId;
let resource = options.destinationResourceId ? {} : Resource.new();
let resource = isUpdate ? {} : 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);
resource.title = basename(filePath);
if (!isUpdate) resource.title = basename(filePath);
let fileExt = safeFileExtension(fileExtension(filePath));
@@ -288,7 +294,7 @@ function shimInit(options = null) {
const saveOptions = { isNew: true };
if (options.userSideValidation) saveOptions.userSideValidation = true;
if (options.destinationResourceId) {
if (isUpdate) {
saveOptions.isNew = false;
const tempPath = `${targetPath}.tmp`;
await shim.fsDriver().move(targetPath, tempPath);

View File

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