Remove unnecessary double popup for replace

748005b903600fab5f7718e77e145781a5044afa

Wolfsblvt <wolfsblvt@gmail.com>

2 files changed, +11 -9Showing whitespace changes
public/scripts/bookmarks.js+4 -9
@@ -57,10 +57,10 @@ async function getExistingChatNames() {
57 }57 }
58}58}
5959
60async function getBookmarkName({ forceName = null } = {}) {60async function getBookmarkName({ isReplace = false, forceName = null } = {}) {
61 const chatNames = await getExistingChatNames();61 const chatNames = await getExistingChatNames();
6262
63 const body = await renderTemplateAsync('createCheckpoint');63 const body = await renderTemplateAsync('createCheckpoint', { isReplace: isReplace });
64 let name = forceName || await Popup.show.input('Create Checkpoint', body);64 let name = forceName || await Popup.show.input('Create Checkpoint', body);
65 if (name === null) {65 if (name === null) {
66 return null;66 return null;
@@ -195,14 +195,9 @@ export async function createNewBookmark(mesId, { forceName = null } = {}) {
195 lastMes.extra = {};195 lastMes.extra = {};
196 }196 }
197197
198 if (lastMes.extra.bookmark_link && !forceName) {198 const isReplace = lastMes.extra.bookmark_link;
199 const confirm = await Popup.show.confirm('Replace Checkpoint', 'Checkpoint for the last message already exists.<br />Would you like to replace it?');
200 if (!confirm) {
201 return null;
202 }
203 }
204199
205 let name = await getBookmarkName({ forceName: forceName });200 let name = await getBookmarkName({ isReplace: isReplace, forceName: forceName });
206 if (!name) {201 if (!name) {
207 return null;202 return null;
208 }203 }
public/scripts/templates/createCheckpoint.html+7 -0
@@ -1 +1,8 @@
1<div>
1 <span class="margin-right-10px">Enter Checkpoint Name:</span><small>(Leave empty to auto-generate)</small>2 <span class="margin-right-10px">Enter Checkpoint Name:</span><small>(Leave empty to auto-generate)</small>
3</div>
4{{#if isReplace}}
5<div class="m-t-1">
6 <small>The currently existing checkpoint will be unlinked and replaced with the new checkpoint, but can still be found in the Chat Management.</small>
7</div>
8{{/if}}