From 2bed405cd50241afb9fe2843917c92bbfed186e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 4 Jan 2024 12:59:33 -0500 Subject: [PATCH 01/24] chore: up harmony --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 000a92b8c6..1d370dc97f 100644 --- a/install/package.json +++ b/install/package.json @@ -103,7 +103,7 @@ "nodebb-plugin-ntfy": "1.7.3", "nodebb-plugin-spam-be-gone": "2.2.0", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.1.107", + "nodebb-theme-harmony": "1.1.108", "nodebb-theme-lavender": "7.1.7", "nodebb-theme-peace": "2.1.26", "nodebb-theme-persona": "13.2.50", From d3d6d77d1e3433a0865ef4d21628d650a564f33a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 5 Jan 2024 16:15:13 -0500 Subject: [PATCH 02/24] fix: recent loading --- public/src/client/chats/recent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/client/chats/recent.js b/public/src/client/chats/recent.js index 02da563286..b9b7e1b678 100644 --- a/public/src/client/chats/recent.js +++ b/public/src/client/chats/recent.js @@ -35,7 +35,7 @@ define('forum/chats/recent', ['alerts', 'api', 'chat'], function (alerts, api, c return; } recentChats.attr('loading', 1); - app.get(`/chats`, { + api.get(`/chats`, { uid: ajaxify.data.uid, after: recentChats.attr('data-nextstart'), }).then(({ rooms, nextStart }) => { From 80d8cfda1c75e560840a2ee6ac08e6c554d87060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 5 Jan 2024 17:27:18 -0500 Subject: [PATCH 03/24] move btn-ghost to core remove "btn-outline", it can be replaced with "btn-ghost border" move chats templates and css from harmony to core, persona nd peace will use same templates --- public/scss/admin/common.scss | 14 +- public/scss/btn-ghost.scss | 51 +++++++ public/scss/chats.scss | 127 ++++++++++++++++++ public/scss/client.scss | 2 + src/views/chat.tpl | 37 +++++ src/views/chats.tpl | 54 ++++++++ src/views/partials/chats/add-reaction.tpl | 1 + src/views/partials/chats/composer.tpl | 27 ++++ src/views/partials/chats/dropdown.tpl | 10 ++ src/views/partials/chats/message-window.tpl | 43 ++++++ src/views/partials/chats/message.tpl | 73 ++++++++++ src/views/partials/chats/messages.tpl | 7 + src/views/partials/chats/options.tpl | 100 ++++++++++++++ src/views/partials/chats/parent.tpl | 13 ++ .../partials/chats/pinned-messages-list.tpl | 32 +++++ src/views/partials/chats/pinned-messages.tpl | 12 ++ src/views/partials/chats/reactions.tpl | 1 + src/views/partials/chats/recent_room.tpl | 55 ++++++++ src/views/partials/chats/scroll-up-alert.tpl | 3 + src/views/partials/chats/system-message.tpl | 7 + src/views/partials/chats/user-list.tpl | 11 ++ src/views/partials/chats/user.tpl | 1 + 22 files changed, 668 insertions(+), 13 deletions(-) create mode 100644 public/scss/btn-ghost.scss create mode 100644 public/scss/chats.scss create mode 100644 src/views/chat.tpl create mode 100644 src/views/chats.tpl create mode 100644 src/views/partials/chats/add-reaction.tpl create mode 100644 src/views/partials/chats/composer.tpl create mode 100644 src/views/partials/chats/dropdown.tpl create mode 100644 src/views/partials/chats/message-window.tpl create mode 100644 src/views/partials/chats/message.tpl create mode 100644 src/views/partials/chats/messages.tpl create mode 100644 src/views/partials/chats/options.tpl create mode 100644 src/views/partials/chats/parent.tpl create mode 100644 src/views/partials/chats/pinned-messages-list.tpl create mode 100644 src/views/partials/chats/pinned-messages.tpl create mode 100644 src/views/partials/chats/reactions.tpl create mode 100644 src/views/partials/chats/recent_room.tpl create mode 100644 src/views/partials/chats/scroll-up-alert.tpl create mode 100644 src/views/partials/chats/system-message.tpl create mode 100644 src/views/partials/chats/user-list.tpl create mode 100644 src/views/partials/chats/user.tpl diff --git a/public/scss/admin/common.scss b/public/scss/admin/common.scss index b99da61b94..945c5b89e3 100644 --- a/public/scss/admin/common.scss +++ b/public/scss/admin/common.scss @@ -51,18 +51,6 @@ } } -.btn-outline { - @include btn-ghost-base(); - border-color: $border-color; -} - -.btn-outline-sm { - @include btn-ghost-base(); - border-color: $border-color; - font-size: 0.875rem; - line-height: 1.25rem; -} - @include color-mode(dark) { .btn-light { @extend .btn-dark; @@ -70,7 +58,7 @@ .text-bg-light { @extend .text-bg-dark; } - .btn-ghost, .btn-ghost-sm, .btn-outline, .btn-outline-sm { + .btn-ghost, .btn-ghost-sm { color: $btn-ghost-color-dark; &:hover, &.active { background-color: $btn-ghost-hover-color-dark; diff --git a/public/scss/btn-ghost.scss b/public/scss/btn-ghost.scss new file mode 100644 index 0000000000..fc1a99e76e --- /dev/null +++ b/public/scss/btn-ghost.scss @@ -0,0 +1,51 @@ +$btn-ghost-hover-color: mix($light, $dark, 90%); +$btn-ghost-active-color: lighten($btn-ghost-hover-color, 5%); +$btn-ghost-hover-color-dark: mix($dark, $light, 90%); +$btn-ghost-active-color-dark: lighten($btn-ghost-hover-color-dark, 5%); + +:root { + --btn-ghost-hover-color: #{$btn-ghost-hover-color}; + --btn-ghost-active-color: #{$btn-ghost-active-color}; +} +[data-bs-theme="dark"] { + --btn-ghost-hover-color: #{$btn-ghost-hover-color-dark}; + --btn-ghost-active-color: #{$btn-ghost-active-color-dark}; +} + +@mixin btn-ghost-base { + display: flex; + align-items: center; + justify-content: center; + gap: ($spacer * 0.5); + border-radius: $border-radius-sm; + border-width: 1px; + border-color: transparent; + background-color: transparent; + box-shadow: none; + padding: ($spacer * 0.25) ($spacer * 0.5); + text-align: left; + --bs-text-opacity: 1; + color: inherit !important; + cursor: pointer; + &:hover, &.active { + background-color: var(--btn-ghost-hover-color); + text-decoration: none; + } +} + +.btn-ghost { + @include btn-ghost-base(); + line-height: 1.5rem; + > i { + line-height: 1.5rem; + } +} + +.btn-ghost-sm { + @include btn-ghost-base(); + font-size: 0.875rem; + line-height: 1.25rem; + > i { + line-height: 1.25rem; + } +} \ No newline at end of file diff --git a/public/scss/chats.scss b/public/scss/chats.scss new file mode 100644 index 0000000000..e9bd116a90 --- /dev/null +++ b/public/scss/chats.scss @@ -0,0 +1,127 @@ +// chats need a bit of css + +.stacked-avatars { + width: 32px; + height: 32px; + span:first-child { + top: 0; + left: 8px; + } + span:last-child { + left: 0; + top: 8px; + } +} + +body.page-user-chats { + #content { + max-width: 100%; + margin-bottom: 0!important; + } + overflow: hidden; + [data-widget-area="footer"] { + display: none; + } + height: 100%; +} + +[component="chat/recent"] { + .active .chat-room-btn { + background-color: var(--btn-ghost-hover-color); + } +} + +[component="chat/nav-wrapper"] { + width: 300px; + [component="chat/public/room"].unread { + font-weight: $font-weight-bold; + } +} + +[component="chat/user/list"] [data-uid] { + [component="chat/user/list/username"] { + color: $text-muted; + } + &.online { + [component="chat/user/list/username"] { + color: initial; + font-weight: $font-weight-semibold; + } + } +} + +.expanded-chat { + .chat-content { + .message-body { + @include fix-lists; + } + + .chat-message { + .message-body-wrapper { + .controls { + opacity: 0; + transition: $transition-fade; + &:has([aria-expanded="true"]) { opacity: 1; } + [data-action="restore"], [data-action="unpin"] { display: none; } + } + &:hover { + .controls { opacity: 1; } + } + } + &.deleted { + .message-body { opacity: 0.3; } + .message-body-wrapper .controls { + [data-action] { display: none; } + [data-action="restore"] { display: block; } + } + } + &.pinned { + .message-body-wrapper .controls { + [data-action="pin"] { display: none; } + [data-action="unpin"] { display: block;} + } + } + } + } +} + +/* Mobile handling of chat page */ +@include media-breakpoint-down(lg) { + .page-user-chats.chat-loaded { + padding-bottom: 4.75rem; + } +} + +@include media-breakpoint-down(md) { + .page-user-chats.chat-loaded { + padding-bottom: initial; + } + [component="chat/nav-wrapper"] { + width: 100%; + } + + + .page-user-chats.chat-loaded .bottombar { + display: none!important; + } + + [component="chat/nav-wrapper"][data-loaded="1"] { + display: none!important; + } + + [component="chat/nav-wrapper"][data-loaded="0"] + [component="chat/main-wrapper"] { + display: none!important; + } +} + +.chat-modal { + left: auto; + top: auto; + bottom: 0px; + right: 2rem; + width: auto!important; + height: auto!important; + [component="chat/user/list/btn"], [component="chat/pinned/messages/btn"] { + display: none!important; + } +} diff --git a/public/scss/client.scss b/public/scss/client.scss index 3d134ceb42..3bcd1bd080 100644 --- a/public/scss/client.scss +++ b/public/scss/client.scss @@ -1,7 +1,9 @@ // core scss files shared by all themes @import "flags"; +@import "chats"; @import "global"; @import "modals"; +@import "btn-ghost"; @import "modules/picture-switcher"; @import "modules/bottom-sheet"; @import "modules/icon-picker"; diff --git a/src/views/chat.tpl b/src/views/chat.tpl new file mode 100644 index 0000000000..c4b673088c --- /dev/null +++ b/src/views/chat.tpl @@ -0,0 +1,37 @@ + diff --git a/src/views/chats.tpl b/src/views/chats.tpl new file mode 100644 index 0000000000..23db9e49fc --- /dev/null +++ b/src/views/chats.tpl @@ -0,0 +1,54 @@ +
+
+ +
+ +
+ + {{{ if publicRooms.length }}} +
+ +
+
+ + +
+
+
+ {{{ each publicRooms }}} +
+
{./roomName}
{./unreadCountText}
+
+
+
+
+ {{{ end }}} +
+
+
+ {{{ end }}} + +
+ +
+ {{{ if publicRooms.length }}} +
+ + +
+ {{{ end }}} + +
+ {{{each rooms}}} + + {{{end}}} +
+
+
+
+ +
+
[[topic:composer.drag-and-drop-images]]
+
\ No newline at end of file diff --git a/src/views/partials/chats/add-reaction.tpl b/src/views/partials/chats/add-reaction.tpl new file mode 100644 index 0000000000..c8f127e786 --- /dev/null +++ b/src/views/partials/chats/add-reaction.tpl @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/partials/chats/composer.tpl b/src/views/partials/chats/composer.tpl new file mode 100644 index 0000000000..cae9634f9a --- /dev/null +++ b/src/views/partials/chats/composer.tpl @@ -0,0 +1,27 @@ +
+ +
+ +
+ +
+
+ {{{ each composerActions }}} + + {{{ end }}} + +
+
+
+
+ + +
+
{maximumChatMessageLength}
+
+ +
\ No newline at end of file diff --git a/src/views/partials/chats/dropdown.tpl b/src/views/partials/chats/dropdown.tpl new file mode 100644 index 0000000000..6524ee5dcb --- /dev/null +++ b/src/views/partials/chats/dropdown.tpl @@ -0,0 +1,10 @@ +{{{ if !rooms.length }}} +
  • +
    +
    [[modules:chat.no-active]]
    +
  • +{{{ end }}} + +{{{ each rooms }}} + +{{{ end }}} \ No newline at end of file diff --git a/src/views/partials/chats/message-window.tpl b/src/views/partials/chats/message-window.tpl new file mode 100644 index 0000000000..26c95c3d9a --- /dev/null +++ b/src/views/partials/chats/message-window.tpl @@ -0,0 +1,43 @@ +
    + {{{ if widgets.header.length }}} +
    + {{{each widgets.header}}} + {{widgets.header.html}} + {{{end}}} +
    + {{{ end }}} + {{{ if !roomId }}} +
    + + [[modules:chat.no-active]] +
    + {{{ else }}} +
    + +
    + {{{ if ./roomName }}} {roomName}{{{ else }}}{./chatWithMessage}{{{ end}}} +
    + + +
    + +
    +
    +
    +
      + +
    + + +
    + + + +
    + {{{ end }}} +
    \ No newline at end of file diff --git a/src/views/partials/chats/message.tpl b/src/views/partials/chats/message.tpl new file mode 100644 index 0000000000..b0bb0d0e76 --- /dev/null +++ b/src/views/partials/chats/message.tpl @@ -0,0 +1,73 @@ +
  • + + {{{ if messages.parent }}} + + {{{ end }}} + +
    + {buildAvatar(messages.fromUser, "18px", true, "not-responsive")} + {messages.fromUser.displayname} + {{{ if messages.fromUser.banned }}} + [[user:banned]] + {{{ end }}} + {{{ if messages.fromUser.deleted }}} + [[user:deleted]] + {{{ end }}} + + +
    +
    +
    +
    + {messages.content} +
    + +
    +
    + + + +
    + + +
    +
    +
    +
    +
  • \ No newline at end of file diff --git a/src/views/partials/chats/messages.tpl b/src/views/partials/chats/messages.tpl new file mode 100644 index 0000000000..d59cce50a5 --- /dev/null +++ b/src/views/partials/chats/messages.tpl @@ -0,0 +1,7 @@ +{{{each messages}}} + {{{ if !./system }}} + + {{{ else }}} + + {{{ end }}} +{{{end}}} \ No newline at end of file diff --git a/src/views/partials/chats/options.tpl b/src/views/partials/chats/options.tpl new file mode 100644 index 0000000000..1500439a02 --- /dev/null +++ b/src/views/partials/chats/options.tpl @@ -0,0 +1,100 @@ +
    + + + + + + + + + + + + + + + + {{{ if users.length }}} +
    +
    + {{{ if ./users.0 }}} + {buildAvatar(./users.0, "24px", true)} + {{{ end }}} + {{{ if ./users.1 }}} + {buildAvatar(./users.1, "24px", true)} + {{{ end }}} + {{{ if ./users.2 }}} + {buildAvatar(./users.2, "24px", true)} + {{{ end }}} +
    + {./userCount} +
    + {{{ end }}} +
    diff --git a/src/views/partials/chats/parent.tpl b/src/views/partials/chats/parent.tpl new file mode 100644 index 0000000000..5f76398846 --- /dev/null +++ b/src/views/partials/chats/parent.tpl @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/src/views/partials/chats/pinned-messages-list.tpl b/src/views/partials/chats/pinned-messages-list.tpl new file mode 100644 index 0000000000..7fbe978328 --- /dev/null +++ b/src/views/partials/chats/pinned-messages-list.tpl @@ -0,0 +1,32 @@ +{{{ each messages }}} +
  • + + {{{ if messages.parent }}} + + {{{ end }}} + + +
    +
    + {messages.content} +
    +
    +
    + {{{ if (isAdminOrGlobalMod || (!config.disableChatMessageEditing && messages.self)) }}} + + {{{ end }}} + {{{ if (isAdminOrGlobalMod || isOwner )}}} + + + {{{ end }}} +
    +
    +
    +
  • +{{{ end }}} \ No newline at end of file diff --git a/src/views/partials/chats/pinned-messages.tpl b/src/views/partials/chats/pinned-messages.tpl new file mode 100644 index 0000000000..20d33f9c1d --- /dev/null +++ b/src/views/partials/chats/pinned-messages.tpl @@ -0,0 +1,12 @@ + diff --git a/src/views/partials/chats/reactions.tpl b/src/views/partials/chats/reactions.tpl new file mode 100644 index 0000000000..c8f127e786 --- /dev/null +++ b/src/views/partials/chats/reactions.tpl @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/partials/chats/recent_room.tpl b/src/views/partials/chats/recent_room.tpl new file mode 100644 index 0000000000..92c50bcd4e --- /dev/null +++ b/src/views/partials/chats/recent_room.tpl @@ -0,0 +1,55 @@ +{{{ if (loadingMore && @first)}}} +
    +{{{ end }}} +
    +
    +
    +
    + {{{ if ./users.length }}} + {{{ if ./groupChat}}} +
    + {buildAvatar(./users.1, "24px", true)} + {buildAvatar(./users.0, "24px", true)} +
    + {{{ else }}} + {buildAvatar(./users.0, "32px", true)} + {{{ end }}} + {{{ else }}} + ? + {{{ end }}} +
    + +
    +
    + {{{ if ./roomName}}} + {./roomName} + {{{ else }}} + {{{ if !./lastUser.uid }}} + [[modules:chat.no-users-in-room]] + {{{ else }}} + {./usernames} + {{{ end }}} + {{{ end }}} +
    + + {{{ if ./teaser }}} +
    + {buildAvatar(./teaser.user, "14px", true)} + {./teaser.user.username}: + {./teaser.content} +
    +
    {{{ if ./teaser.timeagoLong }}}{./teaser.timeagoLong}{{{ else }}}{{{ end }}}
    + {{{ end }}} +
    +
    +
    + +
    +
    +
    +{{{ if !@last }}} +
    +{{{ end }}} diff --git a/src/views/partials/chats/scroll-up-alert.tpl b/src/views/partials/chats/scroll-up-alert.tpl new file mode 100644 index 0000000000..52601bfa47 --- /dev/null +++ b/src/views/partials/chats/scroll-up-alert.tpl @@ -0,0 +1,3 @@ +
    + +
    \ No newline at end of file diff --git a/src/views/partials/chats/system-message.tpl b/src/views/partials/chats/system-message.tpl new file mode 100644 index 0000000000..f522bd108c --- /dev/null +++ b/src/views/partials/chats/system-message.tpl @@ -0,0 +1,7 @@ +
  • +
    +
    + [[modules:chat.system.{messages.content}, {messages.fromUser.username}, {messages.timestampISO}]] +
    +
    +
  • \ No newline at end of file diff --git a/src/views/partials/chats/user-list.tpl b/src/views/partials/chats/user-list.tpl new file mode 100644 index 0000000000..c73a915828 --- /dev/null +++ b/src/views/partials/chats/user-list.tpl @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/src/views/partials/chats/user.tpl b/src/views/partials/chats/user.tpl new file mode 100644 index 0000000000..9ed5b71fbf --- /dev/null +++ b/src/views/partials/chats/user.tpl @@ -0,0 +1 @@ +{buildAvatar(rooms.users, "32px", true)} \ No newline at end of file From 79ebbee5ef9a403f38c6c1e2370b078339cd4183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 5 Jan 2024 17:29:02 -0500 Subject: [PATCH 04/24] chore: up themes --- install/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/package.json b/install/package.json index 0a6922091e..c1a4e99042 100644 --- a/install/package.json +++ b/install/package.json @@ -103,10 +103,10 @@ "nodebb-plugin-ntfy": "1.7.3", "nodebb-plugin-spam-be-gone": "2.2.0", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.1.108", + "nodebb-theme-harmony": "1.2.0", "nodebb-theme-lavender": "7.1.7", - "nodebb-theme-peace": "2.1.26", - "nodebb-theme-persona": "13.2.50", + "nodebb-theme-peace": "2.2.0", + "nodebb-theme-persona": "13.3.0", "nodebb-widget-essentials": "7.0.14", "nodemailer": "6.9.8", "nprogress": "0.2.0", From ef8f8db7bd91f8f0988a2dbe57a5141ade806c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 6 Jan 2024 22:30:27 -0500 Subject: [PATCH 05/24] chore: up composer --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 1d370dc97f..a8c3e80048 100644 --- a/install/package.json +++ b/install/package.json @@ -94,7 +94,7 @@ "multiparty": "4.2.3", "nconf": "0.12.1", "nodebb-plugin-2factor": "7.4.0", - "nodebb-plugin-composer-default": "10.2.29", + "nodebb-plugin-composer-default": "10.2.31", "nodebb-plugin-dbsearch": "6.2.3", "nodebb-plugin-emoji": "5.1.13", "nodebb-plugin-emoji-android": "4.0.0", From 12aeb6f72f5f16dc6620299d2fb27a770b9610c8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 6 Jan 2024 22:30:35 -0500 Subject: [PATCH 06/24] chore(deps): update dependency jsdom to v23.1.0 (#12265) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index c1a4e99042..a5c7dc8e67 100644 --- a/install/package.json +++ b/install/package.json @@ -163,7 +163,7 @@ "grunt": "1.6.1", "grunt-contrib-watch": "1.1.0", "husky": "8.0.3", - "jsdom": "23.0.1", + "jsdom": "23.1.0", "lint-staged": "15.2.0", "mocha": "10.2.0", "mocha-lcov-reporter": "1.3.0", From ebb4fe0cacc3805ccf90e07d539a634365abd5bb Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Sun, 7 Jan 2024 09:18:14 +0000 Subject: [PATCH 07/24] Latest translations and fallbacks --- public/language/he/uploads.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/language/he/uploads.json b/public/language/he/uploads.json index 57c63805f4..75476e2a37 100644 --- a/public/language/he/uploads.json +++ b/public/language/he/uploads.json @@ -4,6 +4,6 @@ "upload-success": "הקובץ הועלה בהצלחה!", "maximum-file-size": "מקסימום %1 קילובייט", "no-uploads-found": "לא נמצאו העלאות!", - "public-uploads-info": "העלאות הינם ציבוריות. כל הגולשים יוכלו לראותם.", + "public-uploads-info": "העלאות הינם ציבוריות. כל מי שיש ברשותו לינק לקובץ יוכל לראות אותו.", "private-uploads-info": "העלאות הינם פרטיות. רק משתמשים מחוברים יוכלו לראותם." } \ No newline at end of file From 7cc69df017540e289af7b5bddedbb1f4f33f9079 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 21:23:51 -0500 Subject: [PATCH 08/24] chore(deps): update dependency jsdom to v23.2.0 (#12269) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index f1f177780a..521d2e3886 100644 --- a/install/package.json +++ b/install/package.json @@ -163,7 +163,7 @@ "grunt": "1.6.1", "grunt-contrib-watch": "1.1.0", "husky": "8.0.3", - "jsdom": "23.1.0", + "jsdom": "23.2.0", "lint-staged": "15.2.0", "mocha": "10.2.0", "mocha-lcov-reporter": "1.3.0", From a1143e22eba46b452fe6b988861b8f0e6bea2066 Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Wed, 10 Jan 2024 14:22:20 +0000 Subject: [PATCH 09/24] chore: incrementing version number - v3.6.2 --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index a8c3e80048..6e4acbe0ce 100644 --- a/install/package.json +++ b/install/package.json @@ -2,7 +2,7 @@ "name": "nodebb", "license": "GPL-3.0", "description": "NodeBB Forum", - "version": "3.6.1", + "version": "3.6.2", "homepage": "https://www.nodebb.org", "repository": { "type": "git", From 82a936c38087988e940bef76ac7b845a78ad9d3c Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Wed, 10 Jan 2024 14:22:20 +0000 Subject: [PATCH 10/24] chore: update changelog for v3.6.2 --- CHANGELOG.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0b8e2fc1..94d2255224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +#### v3.6.2 (2024-01-10) + +##### Chores + +* up composer (ef8f8db7) +* up harmony (2bed405c) +* up harmony (b6dbe1a6) +* up lavender (16f0affa) +* up themes (980bfee8) +* incrementing version number - v3.6.1 (f1a69468) +* update changelog for v3.6.1 (1e4abdbf) +* incrementing version number - v3.6.0 (4cdf85f8) +* incrementing version number - v3.5.3 (ed0e8783) +* incrementing version number - v3.5.2 (52fbb2da) +* incrementing version number - v3.5.1 (4c543488) +* incrementing version number - v3.5.0 (d06fb4f0) +* incrementing version number - v3.4.3 (5c984250) +* incrementing version number - v3.4.2 (3f0dac38) +* incrementing version number - v3.4.1 (01e69574) +* incrementing version number - v3.4.0 (fd9247c5) +* incrementing version number - v3.3.9 (5805e770) +* incrementing version number - v3.3.8 (a5603565) +* incrementing version number - v3.3.7 (b26f1744) +* incrementing version number - v3.3.6 (7fb38792) +* incrementing version number - v3.3.4 (a67f84ea) +* incrementing version number - v3.3.3 (f94d239b) +* incrementing version number - v3.3.2 (ec9dac97) +* incrementing version number - v3.3.1 (151cc68f) +* incrementing version number - v3.3.0 (fc1ad70f) +* incrementing version number - v3.2.3 (b06d3e63) +* incrementing version number - v3.2.2 (758ecfcd) +* incrementing version number - v3.2.1 (20145074) +* incrementing version number - v3.2.0 (9ecac38e) +* incrementing version number - v3.1.7 (0b4e81ab) +* incrementing version number - v3.1.6 (b3a3b130) +* incrementing version number - v3.1.5 (ec19343a) +* incrementing version number - v3.1.4 (2452783c) +* incrementing version number - v3.1.3 (3b4e9d3f) +* incrementing version number - v3.1.2 (40fa3489) +* incrementing version number - v3.1.1 (40250733) +* incrementing version number - v3.1.0 (0cb386bd) +* incrementing version number - v3.0.1 (26f6ea49) +* incrementing version number - v3.0.0 (224e08cd) + +##### New Features + +* #12247 (0af19afd) + +##### Bug Fixes + +* recent loading (d3d6d77d) +* closes #12246, direction is passed in as string as query param with new api call (8867f243) +* stricter selector for sort (a74b5141) + +##### Performance Improvements + +* dont load all followed tids on unread/recent?filter=watched (563e03b6) + #### v3.6.1 (2023-12-22) ##### Chores From de405653c274f12632d066c77341422c33a8530d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 10 Jan 2024 14:59:34 -0500 Subject: [PATCH 11/24] add default to btn ghost colors --- public/scss/btn-ghost.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/scss/btn-ghost.scss b/public/scss/btn-ghost.scss index fc1a99e76e..80b819171a 100644 --- a/public/scss/btn-ghost.scss +++ b/public/scss/btn-ghost.scss @@ -1,7 +1,7 @@ -$btn-ghost-hover-color: mix($light, $dark, 90%); -$btn-ghost-active-color: lighten($btn-ghost-hover-color, 5%); -$btn-ghost-hover-color-dark: mix($dark, $light, 90%); -$btn-ghost-active-color-dark: lighten($btn-ghost-hover-color-dark, 5%); +$btn-ghost-hover-color: mix($light, $dark, 90%)!default; +$btn-ghost-active-color: lighten($btn-ghost-hover-color, 5%)!default; +$btn-ghost-hover-color-dark: mix($dark, $light, 90%)!default; +$btn-ghost-active-color-dark: lighten($btn-ghost-hover-color-dark, 5%)!default; :root { --btn-ghost-hover-color: #{$btn-ghost-hover-color}; From 5f91cc833f5f5a46eae14a619acdcdb131b0557f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 10 Jan 2024 17:44:52 -0500 Subject: [PATCH 12/24] fix: topic event translations closes #12273 --- src/topics/events.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/topics/events.js b/src/topics/events.js index b4c80d2347..68d26406a5 100644 --- a/src/topics/events.js +++ b/src/topics/events.js @@ -30,43 +30,43 @@ const Events = module.exports; Events._types = { pin: { icon: 'fa-thumb-tack', - translation: async event => translateSimple(event, 'topic:user-pinned-topic'), + translation: async (event, language) => translateSimple(event, language, 'topic:user-pinned-topic'), }, unpin: { icon: 'fa-thumb-tack fa-rotate-90', - translation: async event => translateSimple(event, 'topic:user-unpinned-topic'), + translation: async (event, language) => translateSimple(event, language, 'topic:user-unpinned-topic'), }, lock: { icon: 'fa-lock', - translation: async event => translateSimple(event, 'topic:user-locked-topic'), + translation: async (event, language) => translateSimple(event, language, 'topic:user-locked-topic'), }, unlock: { icon: 'fa-unlock', - translation: async event => translateSimple(event, 'topic:user-unlocked-topic'), + translation: async (event, language) => translateSimple(event, language, 'topic:user-unlocked-topic'), }, delete: { icon: 'fa-trash', - translation: async event => translateSimple(event, 'topic:user-deleted-topic'), + translation: async (event, language) => translateSimple(event, language, 'topic:user-deleted-topic'), }, restore: { icon: 'fa-trash-o', - translation: async event => translateSimple(event, 'topic:user-restored-topic'), + translation: async (event, language) => translateSimple(event, language, 'topic:user-restored-topic'), }, move: { icon: 'fa-arrow-circle-right', - translation: async event => translateEventArgs(event, 'topic:user-moved-topic-from', renderUser(event), `${event.fromCategory.name}`, renderTimeago(event)), + translation: async (event, language) => translateEventArgs(event, language, 'topic:user-moved-topic-from', renderUser(event), `${event.fromCategory.name}`, renderTimeago(event)), }, 'post-queue': { icon: 'fa-history', - translation: async event => translateEventArgs(event, 'topic:user-queued-post', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)), + translation: async (event, language) => translateEventArgs(event, language, 'topic:user-queued-post', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)), }, backlink: { icon: 'fa-link', - translation: async event => translateEventArgs(event, 'topic:user-referenced-topic', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)), + translation: async (event, language) => translateEventArgs(event, language, 'topic:user-referenced-topic', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)), }, fork: { icon: 'fa-code-fork', - translation: async event => translateEventArgs(event, 'topic:user-forked-topic', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)), + translation: async (event, language) => translateEventArgs(event, language, 'topic:user-forked-topic', renderUser(event), `${relative_path}${event.href}`, renderTimeago(event)), }, }; @@ -76,14 +76,14 @@ Events.init = async () => { Events._types = types; }; -async function translateEventArgs(event, prefix, ...args) { +async function translateEventArgs(event, language, prefix, ...args) { const key = getTranslationKey(event, prefix); const compiled = translator.compile.apply(null, [key, ...args]); - return utils.decodeHTMLEntities(await translator.translate(compiled)); + return utils.decodeHTMLEntities(await translator.translate(compiled, language)); } -async function translateSimple(event, prefix) { - return await translateEventArgs(event, prefix, renderUser(event), renderTimeago(event)); +async function translateSimple(event, language, prefix) { + return await translateEventArgs(event, language, prefix, renderUser(event), renderTimeago(event)); } Events.translateSimple = translateSimple; // so plugins can perform translate @@ -162,9 +162,10 @@ async function modifyEvent({ tid, uid, eventIds, timestamps, events }) { }); } - const [users, fromCategories] = await Promise.all([ + const [users, fromCategories, userSettings] = await Promise.all([ getUserInfo(events.map(event => event.uid).filter(Boolean)), getCategoryInfo(events.map(event => event.fromCid).filter(Boolean)), + user.getSettings(uid), ]); // Remove backlink events if backlinks are disabled @@ -200,7 +201,7 @@ async function modifyEvent({ tid, uid, eventIds, timestamps, events }) { await Promise.all(events.map(async (event) => { if (Events._types[event.type].translation) { - event.text = await Events._types[event.type].translation(event); + event.text = await Events._types[event.type].translation(event, userSettings.userLang); } })); From eb0fb411f6db2063bbf8a8c633446c171445fb95 Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Thu, 11 Jan 2024 09:18:18 +0000 Subject: [PATCH 13/24] Latest translations and fallbacks --- public/language/he/error.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/language/he/error.json b/public/language/he/error.json index b0f1cd5991..561daffeea 100644 --- a/public/language/he/error.json +++ b/public/language/he/error.json @@ -32,7 +32,7 @@ "folder-exists": "התיקיה קיימת", "invalid-pagination-value": "ערך דף לא חוקי, חייב להיות לפחות %1 ולא מעל %2", "username-taken": "שם משתמש תפוס", - "email-taken": "Email address is already taken.", + "email-taken": "כתובת האימייל כבר תפוסה.", "email-nochange": "כתובת דוא\"ל שהוזן זהה לדוא\"ל שנמצא כבר", "email-invited": "נשלחה כבר הזמנה לדוא\"ל זה", "email-not-confirmed": "פרסום בקטגוריות או בנושאים מסוימים מופעל רק לאחר אישור הדוא\"ל שלכם, אנא לחצו כאן כדי לשלוח אימות לדוא\"ל שלכם.", From bbdefad3fc7b171587d800caf0bbf1011c19d62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 11 Jan 2024 11:22:19 -0500 Subject: [PATCH 14/24] chore: up harmony --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 550a4db14e..4caf6596bb 100644 --- a/install/package.json +++ b/install/package.json @@ -103,7 +103,7 @@ "nodebb-plugin-ntfy": "1.7.3", "nodebb-plugin-spam-be-gone": "2.2.0", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.2.0", + "nodebb-theme-harmony": "1.2.1", "nodebb-theme-lavender": "7.1.7", "nodebb-theme-peace": "2.2.0", "nodebb-theme-persona": "13.3.0", From 16598f7fccd54d34ee8264517ff2445f5b120f73 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:01:42 -0500 Subject: [PATCH 15/24] fix(deps): update socket.io packages to v4.7.4 (#12278) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- install/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/package.json b/install/package.json index 4caf6596bb..e1f203b90c 100644 --- a/install/package.json +++ b/install/package.json @@ -129,8 +129,8 @@ "serve-favicon": "2.5.0", "sharp": "0.33.1", "sitemap": "7.1.1", - "socket.io": "4.7.3", - "socket.io-client": "4.7.3", + "socket.io": "4.7.4", + "socket.io-client": "4.7.4", "@socket.io/redis-adapter": "8.2.1", "sortablejs": "1.15.1", "spdx-license-list": "6.8.0", From fc78b00c2f632c0968f70748cf19a2efb47b9c36 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:02:35 -0500 Subject: [PATCH 16/24] fix(deps): update dependency nodebb-theme-harmony to v1.2.2 (#12279) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index e1f203b90c..192152dbc0 100644 --- a/install/package.json +++ b/install/package.json @@ -103,7 +103,7 @@ "nodebb-plugin-ntfy": "1.7.3", "nodebb-plugin-spam-be-gone": "2.2.0", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.2.1", + "nodebb-theme-harmony": "1.2.2", "nodebb-theme-lavender": "7.1.7", "nodebb-theme-peace": "2.2.0", "nodebb-theme-persona": "13.3.0", From f3927ce76bd333b67f4aca9af170372fd0ae8077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 12 Jan 2024 10:28:26 -0500 Subject: [PATCH 17/24] fix: #12275, pin sharp to 0.32.6 --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 6e4acbe0ce..ed3ca0e4af 100644 --- a/install/package.json +++ b/install/package.json @@ -127,7 +127,7 @@ "sass": "1.69.5", "semver": "7.5.4", "serve-favicon": "2.5.0", - "sharp": "0.33.1", + "sharp": "0.32.6", "sitemap": "7.1.1", "socket.io": "4.7.2", "socket.io-client": "4.7.2", From 2eb36b03a625dbe211af988395b53f063a082e0a Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Fri, 12 Jan 2024 16:06:05 +0000 Subject: [PATCH 18/24] chore: incrementing version number - v3.6.3 --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index ed3ca0e4af..bb30df3d1c 100644 --- a/install/package.json +++ b/install/package.json @@ -2,7 +2,7 @@ "name": "nodebb", "license": "GPL-3.0", "description": "NodeBB Forum", - "version": "3.6.2", + "version": "3.6.3", "homepage": "https://www.nodebb.org", "repository": { "type": "git", From 92ffc57cceb7293193ce3992a17323903c97662e Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Fri, 12 Jan 2024 16:06:06 +0000 Subject: [PATCH 19/24] chore: update changelog for v3.6.3 --- CHANGELOG.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d2255224..0a21d27aa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,48 @@ +#### v3.6.3 (2024-01-12) + +##### Chores + +* incrementing version number - v3.6.2 (0f577a57) +* update changelog for v3.6.2 (82a936c3) +* incrementing version number - v3.6.1 (f1a69468) +* incrementing version number - v3.6.0 (4cdf85f8) +* incrementing version number - v3.5.3 (ed0e8783) +* incrementing version number - v3.5.2 (52fbb2da) +* incrementing version number - v3.5.1 (4c543488) +* incrementing version number - v3.5.0 (d06fb4f0) +* incrementing version number - v3.4.3 (5c984250) +* incrementing version number - v3.4.2 (3f0dac38) +* incrementing version number - v3.4.1 (01e69574) +* incrementing version number - v3.4.0 (fd9247c5) +* incrementing version number - v3.3.9 (5805e770) +* incrementing version number - v3.3.8 (a5603565) +* incrementing version number - v3.3.7 (b26f1744) +* incrementing version number - v3.3.6 (7fb38792) +* incrementing version number - v3.3.4 (a67f84ea) +* incrementing version number - v3.3.3 (f94d239b) +* incrementing version number - v3.3.2 (ec9dac97) +* incrementing version number - v3.3.1 (151cc68f) +* incrementing version number - v3.3.0 (fc1ad70f) +* incrementing version number - v3.2.3 (b06d3e63) +* incrementing version number - v3.2.2 (758ecfcd) +* incrementing version number - v3.2.1 (20145074) +* incrementing version number - v3.2.0 (9ecac38e) +* incrementing version number - v3.1.7 (0b4e81ab) +* incrementing version number - v3.1.6 (b3a3b130) +* incrementing version number - v3.1.5 (ec19343a) +* incrementing version number - v3.1.4 (2452783c) +* incrementing version number - v3.1.3 (3b4e9d3f) +* incrementing version number - v3.1.2 (40fa3489) +* incrementing version number - v3.1.1 (40250733) +* incrementing version number - v3.1.0 (0cb386bd) +* incrementing version number - v3.0.1 (26f6ea49) +* incrementing version number - v3.0.0 (224e08cd) + +##### Bug Fixes + +* #12275, pin sharp to 0.32.6 (f3927ce7) +* topic event translations closes #12273 (5f91cc83) + #### v3.6.2 (2024-01-10) ##### Chores From 5213e22a6e90fee5411c27764dd6d5dd33d77535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 12 Jan 2024 14:02:28 -0500 Subject: [PATCH 20/24] feat: search in bookmarks on search page --- public/language/en-GB/search.json | 1 + public/src/client/search.js | 6 +++-- src/controllers/search.js | 2 +- src/posts/user.js | 17 +++++++++++++ src/search.js | 41 +++++++++++++++++++++++++++++-- 5 files changed, 62 insertions(+), 5 deletions(-) diff --git a/public/language/en-GB/search.json b/public/language/en-GB/search.json index 0a9201e00e..b404ae1fc8 100644 --- a/public/language/en-GB/search.json +++ b/public/language/en-GB/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/src/client/search.js b/public/src/client/search.js index 4ca01b80f9..5bf52a1ef9 100644 --- a/public/src/client/search.js +++ b/public/src/client/search.js @@ -119,7 +119,7 @@ define('forum/search', [ in: $('#search-in').val(), }; searchData.term = $('#search-input').val(); - if (searchData.in === 'posts' || searchData.in === 'titlesposts' || searchData.in === 'titles') { + if (['posts', 'titlesposts', 'titles', 'bookmarks'].includes(searchData.in)) { searchData.matchWords = form.find('#match-words-filter').val(); searchData.by = selectedUsers.length ? selectedUsers.map(u => u.username) : undefined; searchData.categories = selectedCids.length ? selectedCids : undefined; @@ -143,7 +143,7 @@ define('forum/search', [ } function updateFormItemVisiblity(searchIn) { - const hideTitlePostFilters = !searchIn.includes('posts') && !searchIn.includes('titles'); + const hideTitlePostFilters = !['posts', 'titles', 'bookmarks'].some(token => searchIn.includes(token)); $('.post-search-item').toggleClass('hidden', hideTitlePostFilters); } @@ -252,6 +252,7 @@ define('forum/search', [ function categoryFilterDropdown(_selectedCids) { ajaxify.data.allCategoriesUrl = ''; + selectedCids = _selectedCids || []; const dropdownEl = $('[component="category/filter"]'); categoryFilter.init(dropdownEl, { selectedCids: _selectedCids, @@ -290,6 +291,7 @@ define('forum/search', [ } function userFilterDropdown(el, _selectedUsers) { + selectedUsers = _selectedUsers || []; userFilter.init(el, { selectedUsers: _selectedUsers, template: 'partials/search-filters', diff --git a/src/controllers/search.js b/src/controllers/search.js index a12c433edd..8b21189e7d 100644 --- a/src/controllers/search.js +++ b/src/controllers/search.js @@ -36,7 +36,7 @@ searchController.search = async function (req, res, next) { let allowed = (req.query.in === 'users' && userPrivileges['search:users']) || (req.query.in === 'tags' && userPrivileges['search:tags']) || (req.query.in === 'categories') || - (['titles', 'titlesposts', 'posts'].includes(req.query.in) && userPrivileges['search:content']); + (['titles', 'titlesposts', 'posts', 'bookmarks'].includes(req.query.in) && userPrivileges['search:content']); ({ allowed } = await plugins.hooks.fire('filter:search.isAllowed', { uid: req.uid, query: req.query, diff --git a/src/posts/user.js b/src/posts/user.js index 4d9ab4d21e..850ed4c613 100644 --- a/src/posts/user.js +++ b/src/posts/user.js @@ -261,4 +261,21 @@ module.exports = function (Posts) { } }); } + + Posts.filterPidsByUid = async function (pids, uids) { + if (!uids) { + return pids; + } + + if (!Array.isArray(uids) || uids.length === 1) { + return await filterPidsBySingleUid(pids, uids); + } + const pidsArr = await Promise.all(uids.map(uid => Posts.filterPidsByUid(pids, uid))); + return _.union(...pidsArr); + }; + + async function filterPidsBySingleUid(pids, uid) { + const isMembers = await db.isSortedSetMembers(`uid:${parseInt(uid, 10)}:posts`, pids); + return pids.filter((pid, index) => pid && isMembers[index]); + } }; diff --git a/src/search.js b/src/search.js index cbd4e4f40c..1ab7063398 100644 --- a/src/search.js +++ b/src/search.js @@ -3,6 +3,7 @@ const _ = require('lodash'); const db = require('./database'); +const batch = require('./batch'); const posts = require('./posts'); const topics = require('./topics'); const categories = require('./categories'); @@ -18,7 +19,7 @@ search.search = async function (data) { data.sortBy = data.sortBy || 'relevance'; let result; - if (data.searchIn === 'posts' || data.searchIn === 'titles' || data.searchIn === 'titlesposts') { + if (['posts', 'titles', 'titlesposts', 'bookmarks'].includes(data.searchIn)) { result = await searchInContent(data); } else if (data.searchIn === 'users') { result = await user.search(data); @@ -68,6 +69,8 @@ async function searchInContent(data) { const tid = inTopic[1]; const cleanedTerm = data.query.replace(inTopic[0], ''); pids = await topics.search(tid, cleanedTerm); + } else if (data.searchIn === 'bookmarks') { + pids = await searchInBookmarks(data, searchCids, searchUids); } else { [pids, tids] = await Promise.all([ doSearch('post', ['posts', 'titlesposts']), @@ -115,8 +118,42 @@ async function searchInContent(data) { return Object.assign(returnData, metadata); } +async function searchInBookmarks(data, searchCids, searchUids) { + const { uid, query, matchWords } = data; + const allPids = []; + await batch.processSortedSet(`uid:${uid}:bookmarks`, async (pids) => { + if (Array.isArray(searchCids) && searchCids.length) { + pids = await posts.filterPidsByCid(pids, searchCids); + } + if (Array.isArray(searchUids) && searchUids.length) { + pids = await posts.filterPidsByUid(pids, searchUids); + } + if (query) { + const tokens = String(query).split(' '); + const postData = await db.getObjectsFields(pids.map(pid => `post:${pid}`), ['content']); + pids = pids.filter((pid, i) => { + const content = String(postData[i].content); + if (matchWords === 'any') { + return tokens.some(t => content.includes(t)); + } + return tokens.every(t => content.includes(t)); + }); + } + allPids.push(...pids); + }, { + batch: 500, + }); + + return allPids; +} + async function filterAndSort(pids, data) { - if (data.sortBy === 'relevance' && !data.replies && !data.timeRange && !data.hasTags && !plugins.hooks.hasListeners('filter:search.filterAndSort')) { + if (data.sortBy === 'relevance' && + !data.replies && + !data.timeRange && + !data.hasTags && + data.searchIn !== 'bookmarks' && + !plugins.hooks.hasListeners('filter:search.filterAndSort')) { return pids; } let postsData = await getMatchedPosts(pids, data); From fe0845b9a288e5398cde8425cc7b83d3d390c354 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:02:55 -0500 Subject: [PATCH 21/24] fix(deps): update dependency nodebb-theme-persona to v13.3.1 (#12281) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index d708d6fe82..02d0c2a60d 100644 --- a/install/package.json +++ b/install/package.json @@ -106,7 +106,7 @@ "nodebb-theme-harmony": "1.2.2", "nodebb-theme-lavender": "7.1.7", "nodebb-theme-peace": "2.2.0", - "nodebb-theme-persona": "13.3.0", + "nodebb-theme-persona": "13.3.1", "nodebb-widget-essentials": "7.0.14", "nodemailer": "6.9.8", "nprogress": "0.2.0", From 34a8069b0b43657475a59c84e9a46eb497f5d110 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:03:05 -0500 Subject: [PATCH 22/24] fix(deps): update dependency nodebb-theme-harmony to v1.2.3 (#12280) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 02d0c2a60d..2e21530830 100644 --- a/install/package.json +++ b/install/package.json @@ -103,7 +103,7 @@ "nodebb-plugin-ntfy": "1.7.3", "nodebb-plugin-spam-be-gone": "2.2.0", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.2.2", + "nodebb-theme-harmony": "1.2.3", "nodebb-theme-lavender": "7.1.7", "nodebb-theme-peace": "2.2.0", "nodebb-theme-persona": "13.3.1", From 43bf1f9b873a03fddf60e12cfbdfb57a5a70a24b Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Fri, 12 Jan 2024 19:02:55 +0000 Subject: [PATCH 23/24] chore(i18n): fallback strings for new resources: nodebb.search --- public/language/ar/search.json | 1 + public/language/bg/search.json | 1 + public/language/bn/search.json | 1 + public/language/cs/search.json | 1 + public/language/da/search.json | 1 + public/language/de/search.json | 1 + public/language/el/search.json | 1 + public/language/en-US/search.json | 1 + public/language/en-x-pirate/search.json | 1 + public/language/es/search.json | 1 + public/language/et/search.json | 1 + public/language/fa-IR/search.json | 1 + public/language/fi/search.json | 1 + public/language/fr/search.json | 1 + public/language/gl/search.json | 1 + public/language/he/search.json | 1 + public/language/hr/search.json | 1 + public/language/hu/search.json | 1 + public/language/hy/search.json | 1 + public/language/id/search.json | 1 + public/language/it/search.json | 1 + public/language/ja/search.json | 1 + public/language/ko/search.json | 1 + public/language/lt/search.json | 1 + public/language/lv/search.json | 1 + public/language/ms/search.json | 1 + public/language/nb/search.json | 1 + public/language/nl/search.json | 1 + public/language/pl/search.json | 1 + public/language/pt-BR/search.json | 1 + public/language/pt-PT/search.json | 1 + public/language/ro/search.json | 1 + public/language/ru/search.json | 1 + public/language/rw/search.json | 1 + public/language/sc/search.json | 1 + public/language/sk/search.json | 1 + public/language/sl/search.json | 1 + public/language/sq-AL/search.json | 1 + public/language/sr/search.json | 1 + public/language/sv/search.json | 1 + public/language/th/search.json | 1 + public/language/tr/search.json | 1 + public/language/uk/search.json | 1 + public/language/vi/search.json | 1 + public/language/zh-CN/search.json | 1 + public/language/zh-TW/search.json | 1 + 46 files changed, 46 insertions(+) diff --git a/public/language/ar/search.json b/public/language/ar/search.json index d00f8548f9..0592ec6ab6 100644 --- a/public/language/ar/search.json +++ b/public/language/ar/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/bg/search.json b/public/language/bg/search.json index ccd5a1f0ca..4c72793dae 100644 --- a/public/language/bg/search.json +++ b/public/language/bg/search.json @@ -7,6 +7,7 @@ "in-titles": "В заглавията", "in-titles-posts": "В заглавията и публикациите", "in-posts": "В публикациите", + "in-bookmarks": "In bookmarks", "in-categories": "В категориите", "in-users": "В потребителите", "in-tags": "В етикетите", diff --git a/public/language/bn/search.json b/public/language/bn/search.json index 4b9b3b9899..3b9499b566 100644 --- a/public/language/bn/search.json +++ b/public/language/bn/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/cs/search.json b/public/language/cs/search.json index 0406cbbabd..02fa6a52c5 100644 --- a/public/language/cs/search.json +++ b/public/language/cs/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/da/search.json b/public/language/da/search.json index 054c12a9a9..27b686a7dd 100644 --- a/public/language/da/search.json +++ b/public/language/da/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/de/search.json b/public/language/de/search.json index 77ea332310..5765012bc4 100644 --- a/public/language/de/search.json +++ b/public/language/de/search.json @@ -7,6 +7,7 @@ "in-titles": "In Titeln", "in-titles-posts": "In Titeln und Beiträgen", "in-posts": "In Beiträgen", + "in-bookmarks": "In bookmarks", "in-categories": "In Kategorien", "in-users": "In Benutzern", "in-tags": "In Tags", diff --git a/public/language/el/search.json b/public/language/el/search.json index 374d720463..b1a075fe07 100644 --- a/public/language/el/search.json +++ b/public/language/el/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/en-US/search.json b/public/language/en-US/search.json index aba25b2345..0e8f179e87 100644 --- a/public/language/en-US/search.json +++ b/public/language/en-US/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/en-x-pirate/search.json b/public/language/en-x-pirate/search.json index aba25b2345..0e8f179e87 100644 --- a/public/language/en-x-pirate/search.json +++ b/public/language/en-x-pirate/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/es/search.json b/public/language/es/search.json index b2d3c9e432..c2bd1b0e4b 100644 --- a/public/language/es/search.json +++ b/public/language/es/search.json @@ -7,6 +7,7 @@ "in-titles": "En títulos", "in-titles-posts": "En títulos y posts", "in-posts": "En posts", + "in-bookmarks": "In bookmarks", "in-categories": "En categorías", "in-users": "En usuarios", "in-tags": "En etiquetas", diff --git a/public/language/et/search.json b/public/language/et/search.json index 4505b99df7..12a74b2130 100644 --- a/public/language/et/search.json +++ b/public/language/et/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/fa-IR/search.json b/public/language/fa-IR/search.json index 3ff16b9203..f82365012b 100644 --- a/public/language/fa-IR/search.json +++ b/public/language/fa-IR/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "در دسته‌بندی‌ها", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/fi/search.json b/public/language/fi/search.json index 7c28699640..0e5d086bda 100644 --- a/public/language/fi/search.json +++ b/public/language/fi/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/fr/search.json b/public/language/fr/search.json index e98a78f6cb..93d9293d00 100644 --- a/public/language/fr/search.json +++ b/public/language/fr/search.json @@ -7,6 +7,7 @@ "in-titles": "Dans les titres", "in-titles-posts": "Dans les titres et messages", "in-posts": "Dans les messages", + "in-bookmarks": "In bookmarks", "in-categories": "Dans les catégories", "in-users": "Dans les utilisateurs", "in-tags": "Dans les mots-clés", diff --git a/public/language/gl/search.json b/public/language/gl/search.json index 902d37e96e..79a4e537d3 100644 --- a/public/language/gl/search.json +++ b/public/language/gl/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/he/search.json b/public/language/he/search.json index f4ba259dee..da0fb150ba 100644 --- a/public/language/he/search.json +++ b/public/language/he/search.json @@ -7,6 +7,7 @@ "in-titles": "בכותרות הנושאים", "in-titles-posts": "בכותרות ובפוסטים", "in-posts": "בפוסטים", + "in-bookmarks": "In bookmarks", "in-categories": "בקטגוריות", "in-users": "במשתמשים", "in-tags": "בתגיות", diff --git a/public/language/hr/search.json b/public/language/hr/search.json index aadbe80d42..419de0aba4 100644 --- a/public/language/hr/search.json +++ b/public/language/hr/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/hu/search.json b/public/language/hu/search.json index 578f293e90..699107e1f5 100644 --- a/public/language/hu/search.json +++ b/public/language/hu/search.json @@ -7,6 +7,7 @@ "in-titles": "Címekben", "in-titles-posts": "Címekben és bejegyzésekben", "in-posts": "Bejegyzésekben", + "in-bookmarks": "In bookmarks", "in-categories": "Kategóriákban", "in-users": "Felhasználóknál", "in-tags": "Címkékben", diff --git a/public/language/hy/search.json b/public/language/hy/search.json index 584f392565..2e78f2526b 100644 --- a/public/language/hy/search.json +++ b/public/language/hy/search.json @@ -7,6 +7,7 @@ "in-titles": "Վերնագրերում", "in-titles-posts": "Վերնագրերում և գրառումներում", "in-posts": "Գրառումներում", + "in-bookmarks": "In bookmarks", "in-categories": "Կատեգորիաներում", "in-users": "Օգտատերերում", "in-tags": "Պիտակներում", diff --git a/public/language/id/search.json b/public/language/id/search.json index c0e138e4ba..b4ea09a843 100644 --- a/public/language/id/search.json +++ b/public/language/id/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/it/search.json b/public/language/it/search.json index 04d973ab35..cb67e4de6a 100644 --- a/public/language/it/search.json +++ b/public/language/it/search.json @@ -7,6 +7,7 @@ "in-titles": "Nei titoli", "in-titles-posts": "Nei titoli e nei post", "in-posts": "Nei post", + "in-bookmarks": "In bookmarks", "in-categories": "Nelle categorie", "in-users": "Negli utenti", "in-tags": "Nei tag", diff --git a/public/language/ja/search.json b/public/language/ja/search.json index 73414eee31..be8e0e5cd1 100644 --- a/public/language/ja/search.json +++ b/public/language/ja/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/ko/search.json b/public/language/ko/search.json index d13450921d..b5994aa189 100644 --- a/public/language/ko/search.json +++ b/public/language/ko/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/lt/search.json b/public/language/lt/search.json index ce66165c72..a1c0e6f388 100644 --- a/public/language/lt/search.json +++ b/public/language/lt/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/lv/search.json b/public/language/lv/search.json index cbd7d86d9f..c58ceda81f 100644 --- a/public/language/lv/search.json +++ b/public/language/lv/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/ms/search.json b/public/language/ms/search.json index f0d20470af..0e2a5a45b3 100644 --- a/public/language/ms/search.json +++ b/public/language/ms/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/nb/search.json b/public/language/nb/search.json index 587ea72c04..9e80084d95 100644 --- a/public/language/nb/search.json +++ b/public/language/nb/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/nl/search.json b/public/language/nl/search.json index b1769569e8..347e7a94dc 100644 --- a/public/language/nl/search.json +++ b/public/language/nl/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categorieën", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/pl/search.json b/public/language/pl/search.json index 68ba5465df..3093307c80 100644 --- a/public/language/pl/search.json +++ b/public/language/pl/search.json @@ -7,6 +7,7 @@ "in-titles": "W tytułach", "in-titles-posts": "W tytułach i postach", "in-posts": "W postach", + "in-bookmarks": "In bookmarks", "in-categories": "W kategoriach", "in-users": "W użytkownikach", "in-tags": "W tagach", diff --git a/public/language/pt-BR/search.json b/public/language/pt-BR/search.json index cfc9a28478..d61266d251 100644 --- a/public/language/pt-BR/search.json +++ b/public/language/pt-BR/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/pt-PT/search.json b/public/language/pt-PT/search.json index 7e0d9e9f9a..4d29c4d28d 100644 --- a/public/language/pt-PT/search.json +++ b/public/language/pt-PT/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/ro/search.json b/public/language/ro/search.json index f09ce2f0c4..f994b924cb 100644 --- a/public/language/ro/search.json +++ b/public/language/ro/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/ru/search.json b/public/language/ru/search.json index 75b91b172e..12cff8c62d 100644 --- a/public/language/ru/search.json +++ b/public/language/ru/search.json @@ -7,6 +7,7 @@ "in-titles": "В заголовках", "in-titles-posts": "В заголовках и постах", "in-posts": "В постах", + "in-bookmarks": "In bookmarks", "in-categories": "В категориях", "in-users": "В пользователях", "in-tags": "В тегах", diff --git a/public/language/rw/search.json b/public/language/rw/search.json index 5d5f493db9..9746a475e5 100644 --- a/public/language/rw/search.json +++ b/public/language/rw/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/sc/search.json b/public/language/sc/search.json index aba25b2345..0e8f179e87 100644 --- a/public/language/sc/search.json +++ b/public/language/sc/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/sk/search.json b/public/language/sk/search.json index ec123e794a..c0c635a72f 100644 --- a/public/language/sk/search.json +++ b/public/language/sk/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/sl/search.json b/public/language/sl/search.json index b18cac724e..dfbdd66f0e 100644 --- a/public/language/sl/search.json +++ b/public/language/sl/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/sq-AL/search.json b/public/language/sq-AL/search.json index c114b44e61..3c388bafb4 100644 --- a/public/language/sq-AL/search.json +++ b/public/language/sq-AL/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/sr/search.json b/public/language/sr/search.json index 649e565cb5..7bdc911633 100644 --- a/public/language/sr/search.json +++ b/public/language/sr/search.json @@ -7,6 +7,7 @@ "in-titles": "У насловима", "in-titles-posts": "У насловима и објавама", "in-posts": "У објавама", + "in-bookmarks": "In bookmarks", "in-categories": "У категоријама", "in-users": "У корисницима", "in-tags": "У ознакама", diff --git a/public/language/sv/search.json b/public/language/sv/search.json index 36f20d4f1a..41b44552e4 100644 --- a/public/language/sv/search.json +++ b/public/language/sv/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/th/search.json b/public/language/th/search.json index bdc458aa60..cab3c226c2 100644 --- a/public/language/th/search.json +++ b/public/language/th/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/tr/search.json b/public/language/tr/search.json index 1710c3c93e..73227232a6 100644 --- a/public/language/tr/search.json +++ b/public/language/tr/search.json @@ -7,6 +7,7 @@ "in-titles": "Başlıklarda", "in-titles-posts": "Başlıklarda ve iletilerde", "in-posts": "İletilerde", + "in-bookmarks": "In bookmarks", "in-categories": "Kategorilerde", "in-users": "Kullanıcılarda", "in-tags": "Etiketlerde", diff --git a/public/language/uk/search.json b/public/language/uk/search.json index 9210f1c016..a2b902707b 100644 --- a/public/language/uk/search.json +++ b/public/language/uk/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", diff --git a/public/language/vi/search.json b/public/language/vi/search.json index 59c6f24984..c8cc0c4c72 100644 --- a/public/language/vi/search.json +++ b/public/language/vi/search.json @@ -7,6 +7,7 @@ "in-titles": "Trong tiêu đề", "in-titles-posts": "Trong tiêu đề và bài đăng", "in-posts": "Trong bài đăng", + "in-bookmarks": "In bookmarks", "in-categories": "Trong danh mục", "in-users": "Trong người dùng", "in-tags": "Trong thẻ", diff --git a/public/language/zh-CN/search.json b/public/language/zh-CN/search.json index c885ea96bc..1132d3da44 100644 --- a/public/language/zh-CN/search.json +++ b/public/language/zh-CN/search.json @@ -7,6 +7,7 @@ "in-titles": "在标题中", "in-titles-posts": "在标题和帖子中", "in-posts": "在帖子中", + "in-bookmarks": "In bookmarks", "in-categories": "在板块中", "in-users": "在用户中", "in-tags": "在标签中", diff --git a/public/language/zh-TW/search.json b/public/language/zh-TW/search.json index 5a4dd3b4e7..5e7b7c0395 100644 --- a/public/language/zh-TW/search.json +++ b/public/language/zh-TW/search.json @@ -7,6 +7,7 @@ "in-titles": "In titles", "in-titles-posts": "In titles and posts", "in-posts": "In posts", + "in-bookmarks": "In bookmarks", "in-categories": "In categories", "in-users": "In users", "in-tags": "In tags", From 4ee9873e5825cd5adaf427209d183a03f64f41c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 12 Jan 2024 14:31:41 -0500 Subject: [PATCH 24/24] search in topic titles as well --- src/search.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/search.js b/src/search.js index 1ab7063398..df249ec1f6 100644 --- a/src/search.js +++ b/src/search.js @@ -130,13 +130,17 @@ async function searchInBookmarks(data, searchCids, searchUids) { } if (query) { const tokens = String(query).split(' '); - const postData = await db.getObjectsFields(pids.map(pid => `post:${pid}`), ['content']); + const postData = await db.getObjectsFields(pids.map(pid => `post:${pid}`), ['content', 'tid']); + const tids = _.uniq(postData.map(p => p.tid)); + const topicData = await db.getObjectsFields(tids.map(tid => `topic:${tid}`), ['title']); + const tidToTopic = _.zipObject(tids, topicData); pids = pids.filter((pid, i) => { const content = String(postData[i].content); - if (matchWords === 'any') { - return tokens.some(t => content.includes(t)); - } - return tokens.every(t => content.includes(t)); + const title = String(tidToTopic[postData[i].tid].title); + const method = (matchWords === 'any' ? 'some' : 'every'); + return tokens[method]( + token => content.includes(token) || title.includes(token) + ); }); } allPids.push(...pids);