Move img.swipe notice block up

c7040d2be46324400c2098d2c58950c0036d9da0

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +13 -13Showing whitespace changes
public/scripts/chats.js+13 -13
@@ -2080,6 +2080,19 @@ async function onImageSwiped(messageId, element, direction) {
20802080 return;
20812081 }
20822082
2083+ // Show a message that swipe right no longer automatically generates an image
2084+ if (direction === SWIPE_DIRECTION.RIGHT && message.extra.media_index === media.length - 1) {
2085+ const key = 'imageSwipeNoticeShown';
2086+ const hasSeenNotice = accountStorage.getItem(key);
2087+ if (!hasSeenNotice) {
2088+ await Popup.show.text(
2089+ t`Image swiping no longer automatically generates new images.`,
2090+ t`Use the 'Generate Image' (paintbrush) button in the message actions menu to generate more images. This message will not be shown again.`,
2091+ );
2092+ accountStorage.setItem(key, 'true');
2093+ }
2094+ }
2095+
20832096 if (media.length === 1) {
20842097 console.warn('Only one media item in the message, swiping is not applicable');
20852098 return;
@@ -2105,19 +2118,6 @@ async function onImageSwiped(messageId, element, direction) {
21052118 message.extra.media_index = newIndex >= media.length ? 0 : newIndex;
21062119 }
21072120
2108- // Show a message that swipe right no longer automatically generates an image
2109- if (media.length > 0 && direction === SWIPE_DIRECTION.RIGHT && message.extra.media_index === 0) {
2110- const key = 'imageSwipeNoticeShown';
2111- const hasSeenNotice = accountStorage.getItem(key);
2112- if (!hasSeenNotice) {
2113- await Popup.show.text(
2114- t`Image swiping no longer automatically generates new images.`,
2115- t`Use the 'Generate Image' (paintbrush) button in the message actions menu to generate more images. This message will not be shown again.`,
2116- );
2117- accountStorage.setItem(key, 'true');
2118- }
2119- }
2120-
21212121 await saveChatConditional();
21222122 await eventSource.emit(event_types.IMAGE_SWIPED, { message, element, direction });
21232123 appendMediaToMessage(message, element);