-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat(note): change parent note #148
Conversation
* | ||
* @param id - note id, if undefined returns an empty string | ||
*/ | ||
function getNoteURL(id: NoteId | undefined): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its better to place in on a presentation level, in NoteSettings.vue
/** | ||
* Link to the parent note | ||
*/ | ||
parentURL: Ref<string>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets expose parentNote
instead
function getParentURL(id: NoteId | undefined): string { | ||
console.log('TEST' + parentNote.value); | ||
if (parentNote.value === undefined) { | ||
return 'null'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems strange? what's the reason of "null" string?
* @param id - id of the note | ||
*/ | ||
function getParentURL(id: NoteId | undefined): string { | ||
console.log('TEST' + parentNote.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log('TEST' + parentNote.value); |
loadSettings(props.id); | ||
const parentURL = ref<string>(''); | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs missed
try { | ||
await updateParent(props.id, parentURL.value); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
window.alert(error.message); | ||
} | ||
throw error; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move try-catch to the application service
|
||
const invitationLink = computed( | ||
() => `${import.meta.env.VITE_PRODUCTION_HOSTNAME}/join/${noteSettings.value?.invitationHash}` | ||
); | ||
|
||
loadSettings(props.id); | ||
const parentURL = ref<string>(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs missed
// Extracts the ID from the URL. The ID is matches[1] as matches[0] is the full match | ||
const parentId = matches[1]; | ||
|
||
const noteIdPattern = /^[a-zA-Z0-9-_]{10}$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't to put this regex to the first regex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in the case where there is no slash at the end, we will take the first 10 characters of what comes after “/note/”. This may cause unexpected behavior
For example, when parentURL = '/note/1234567890abc'
match will be like this match = '1234567890'
. This could be the id of a real note that we don't want to be the parent of
* | ||
* @param id - Note id | ||
*/ | ||
const load = async (id: NoteId): Promise<void> => { | ||
noteSettings.value = await noteSettingsService.getNoteSettingsById(id); | ||
parentNote.value = (await noteService.getNoteById(id)).parentNote; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets create a note
ref that will store current note
@@ -21,6 +21,9 @@ | |||
"title": "Note Settings", | |||
"customHostname": "Custom Hostname", | |||
"hostnamePlaceholder": "example: landing.codex.so", | |||
"parentNote": "Parent Note", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"parentNote": "Parent Note", | |
"parentNote": "Parent note", |
@@ -17,6 +17,17 @@ | |||
type="primary" | |||
@click="regenerateHash" | |||
/> | |||
<form-field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<form-field | |
<FormField |
* Fix ts errors and change files structure * Rename typings to types
* Add codex-ui to eslint working directories, lint codex-ui * Update lock
@@ -10,6 +10,7 @@ | |||
"sourceType": "module", | |||
"parser": "@typescript-eslint/parser" | |||
}, | |||
"ignorePatterns": ["codex-ui/dist"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your branch should not contain this change 🤔
seems like you did smth wrong while merging branches
What's new: