Skip to content

Node.js based forum software built for the modern web

refactor: use tx, dont parse description if cid == -1

Barış Soner Uşaklıd4779f915a6c
diff --git a/src/categories/data.js b/src/categories/data.js
index 5a298c60c7..fa8d70ff30 100644
--- a/src/categories/data.js
+++ b/src/categories/data.js
@@ -15,6 +15,7 @@ const worldCategory = {
cid: -1,
name: '[[category:uncategorized]]',
description: '[[category:uncategorized.description]]',
+ descriptionParsed: '[[category:uncategorized.description]]',
icon: 'fa-globe',
imageClass: 'cover',
bgColor: '#eee',
@@ -26,7 +27,6 @@ const worldCategory = {
link: '',
class: '',
};
-worldCategory.descriptionParsed = worldCategory.description;
module.exports = function (Categories) {
Categories.getCategoriesFields = async function (cids, fields) {
@@ -151,7 +151,7 @@ async function modifyCategories(categories, fields) {
category.name = category.nickname || category.name;
}
- if (hasField('description')) {
+ if (hasField('description') && category.cid !== -1) {
category.descriptionParsed = await plugins.hooks.fire('filter:parse.raw', category.description);
}
}));
diff --git a/src/views/partials/category/watch.tpl b/src/views/partials/category/watch.tpl
index 195386b46f..33118186ed 100644
--- a/src/views/partials/category/watch.tpl
+++ b/src/views/partials/category/watch.tpl
@@ -1,13 +1,13 @@
{{{ if config.loggedIn }}}
<div class="dropdown bottom-sheet" component="topic/watch">
<button class="btn btn-ghost btn-sm ff-secondary dropdown-toggle h-100" data-bs-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
- <span component="category/watching/menu" class="d-flex gap-2 align-items-center {{{ if !./isWatched }}} hidden{{{ end }}}"><i class="fa fa-fw fa-bell-o text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">[[category:watching]]</span></span>
+ <span component="category/watching/menu" class="d-flex gap-2 align-items-center {{{ if !./isWatched }}} hidden{{{ end }}}"><i class="fa fa-fw fa-bell-o text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">{{tx("category:watching")}}</span></span>
- <span component="category/tracking/menu" class="d-flex gap-2 align-items-center {{{ if !./isTracked }}} hidden{{{ end }}}"><i class="fa fa-fw fa-inbox text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">[[category:tracking]]</span></span>
+ <span component="category/tracking/menu" class="d-flex gap-2 align-items-center {{{ if !./isTracked }}} hidden{{{ end }}}"><i class="fa fa-fw fa-inbox text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">{{tx("category:tracking")}}</span></span>
- <span component="category/notwatching/menu" class="d-flex gap-2 align-items-center {{{ if !./isNotWatched }}} hidden{{{ end }}}"><i class="fa fa-fw fa-clock-o text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">[[category:not-watching]]</span></span>
+ <span component="category/notwatching/menu" class="d-flex gap-2 align-items-center {{{ if !./isNotWatched }}} hidden{{{ end }}}"><i class="fa fa-fw fa-clock-o text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">{{tx("category:not-watching")}}</span></span>
- <span component="category/ignoring/menu" class="d-flex gap-2 align-items-center {{{ if !./isIgnored }}} hidden{{{ end }}}"><i class="fa fa-fw fa-eye-slash text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">[[category:ignoring]]</span></span>
+ <span component="category/ignoring/menu" class="d-flex gap-2 align-items-center {{{ if !./isIgnored }}} hidden{{{ end }}}"><i class="fa fa-fw fa-eye-slash text-primary"></i><span class="visible-md-inline visible-lg-inline fw-semibold">{{tx("category:ignoring")}}</span></span>
</button>
<ul class="dropdown-menu p-1 text-sm {{{ if template.account/categories }}}dropdown-menu-end{{{ end }}}" role="menu">
@@ -16,9 +16,9 @@
<div class="flex-grow-1 d-flex flex-column">
<span class="d-flex align-items-center gap-2">
<i class="flex-shrink-0 fa fa-fw fa-bell-o text-secondary"></i>
- <span class="flex-grow-1 fw-semibold">[[category:watching]]</span>
+ <span class="flex-grow-1 fw-semibold">{{tx("category:watching")}}</span>
</span>
- <div class="help-text text-secondary text-xs">[[category:watching.description]]</div>
+ <div class="help-text text-secondary text-xs">{{tx("category:watching.description")}}</div>
</div>
<span class="flex-shrink-0"><i component="category/watching/check" class="fa fa-fw {{{ if ./isWatched }}}fa-check{{{ end }}}"></i></span>
</a>
@@ -29,9 +29,9 @@
<div class="flex-grow-1 d-flex flex-column">
<span class="d-flex align-items-center gap-2">
<i class="flex-shrink-0 fa fa-fw fa-inbox text-secondary"></i>
- <span class="flex-grow-1 fw-semibold">[[category:tracking]]</span>
+ <span class="flex-grow-1 fw-semibold">{{tx("category:tracking")}}</span>
</span>
- <div class="help-text text-secondary text-xs">[[category:tracking.description]]</div>
+ <div class="help-text text-secondary text-xs">{{tx("category:tracking.description")}}</div>
</div>
<span class="flex-shrink-0"><i component="category/tracking/check" class="fa fa-fw {{{ if ./isTracked }}}fa-check{{{ end }}}"></i></span>
</a>
@@ -42,9 +42,9 @@
<div class="flex-grow-1 d-flex flex-column">
<span class="d-flex align-items-center gap-2">
<i class="flex-shrink-0 fa fa-fw fa-clock-o text-secondary"></i>
- <span class="flex-grow-1 fw-semibold">[[category:not-watching]]</span>
+ <span class="flex-grow-1 fw-semibold">{{tx("category:not-watching")}}</span>
</span>
- <div class="help-text text-secondary text-xs">[[category:not-watching.description]]</div>
+ <div class="help-text text-secondary text-xs">{{tx("category:not-watching.description")}}</div>
</div>
<span class="flex-shrink-0"><i component="category/notwatching/check" class="fa fa-fw {{{ if ./isNotWatched }}}fa-check{{{ end }}}"></i></span>
</a>
@@ -55,9 +55,9 @@
<div class="flex-grow-1 d-flex flex-column">
<span class="d-flex align-items-center gap-2">
<i class="flex-shrink-0 fa fa-fw fa-eye-slash text-secondary"></i>
- <span class="flex-grow-1 fw-semibold">[[category:ignoring]]</span>
+ <span class="flex-grow-1 fw-semibold">{{tx("category:ignoring")}}</span>
</span>
- <div class="help-text text-secondary text-xs">[[category:ignoring.description]]</div>
+ <div class="help-text text-secondary text-xs">{{tx("category:ignoring.description")}}</div>
</div>
<span class="flex-shrink-0"><i component="category/ignoring/check" class="fa fa-fw {{{ if ./isIgnored }}}fa-check{{{ end }}}"></i></span>
</a>
diff --git a/src/views/partials/topic/topic-menu-list.tpl b/src/views/partials/topic/topic-menu-list.tpl
index e285a1f3bf..48d94b0de1 100644
--- a/src/views/partials/topic/topic-menu-list.tpl
+++ b/src/views/partials/topic/topic-menu-list.tpl
@@ -1,46 +1,46 @@
{{{ if privileges.editable }}}
<li {{{ if locked }}}hidden{{{ end }}}>
- <a component="topic/lock" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if locked }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-lock text-secondary"></i> [[topic:thread-tools.lock]]</a>
+ <a component="topic/lock" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if locked }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-lock text-secondary"></i> {{tx("topic:thread-tools.lock")}}</a>
</li>
<li {{{ if !locked }}}hidden{{{ end }}}>
- <a component="topic/unlock" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !locked }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-unlock text-secondary"></i> [[topic:thread-tools.unlock]]</a>
+ <a component="topic/unlock" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !locked }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-unlock text-secondary"></i> {{tx("topic:thread-tools.unlock")}}</a>
</li>
<li {{{ if pinned }}}hidden{{{ end }}}>
- <a component="topic/pin" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if pinned }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-thumb-tack text-secondary"></i> [[topic:thread-tools.pin]]</a>
+ <a component="topic/pin" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if pinned }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-thumb-tack text-secondary"></i> {{tx("topic:thread-tools.pin")}}</a>
</li>
<li {{{ if !pinned }}}hidden{{{ end }}}>
- <a component="topic/unpin" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !pinned }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-thumb-tack fa-rotate-90 text-secondary"></i> [[topic:thread-tools.unpin]]</a>
+ <a component="topic/unpin" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !pinned }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-thumb-tack fa-rotate-90 text-secondary"></i> {{tx("topic:thread-tools.unpin")}}</a>
</li>
{{{ if isNumber(cid) }}}
<li>
- <a component="topic/move" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> [[topic:thread-tools.move]]</a>
+ <a component="topic/move" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> {{tx("topic:thread-tools.move")}}</a>
</li>
{{{ end }}}
<li>
- <a component="topic/merge" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa-solid fa-code-merge text-secondary"></i> [[topic:thread-tools.merge]]</a>
+ <a component="topic/merge" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa-solid fa-code-merge text-secondary"></i> {{tx("topic:thread-tools.merge")}}</a>
</li>
<li>
- <a component="topic/fork" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa-solid fa-code-fork text-secondary"></i> [[topic:thread-tools.fork]]</a>
+ <a component="topic/fork" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa-solid fa-code-fork text-secondary"></i> {{tx("topic:thread-tools.fork")}}</a>
</li>
<li>
- <a component="topic/tag" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-tag text-secondary"></i> [[topic:thread-tools.tag]]</a>
+ <a component="topic/tag" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-tag text-secondary"></i> {{tx("topic:thread-tools.tag")}}</a>
</li>
{{{ if !scheduled }}}
<li>
- <a component="topic/move-posts" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> [[topic:thread-tools.move-posts]]</a>
+ <a component="topic/move-posts" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> {{tx("topic:thread-tools.move-posts")}}</a>
</li>
{{{ end }}}
<li>
- <a component="topic/mark-unread-for-all" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-inbox text-secondary"></i> [[topic:thread-tools.markAsUnreadForAll]]</a>
+ <a component="topic/mark-unread-for-all" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-inbox text-secondary"></i> {{tx("topic:thread-tools.markAsUnreadForAll")}}</a>
</li>
<li class="dropdown-divider"></li>
@@ -48,29 +48,29 @@
{{{ if (privileges.canMoveOwnTopic && isNumber(cid)) }}}
<li>
- <a component="topic/move" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> [[topic:thread-tools.move]]</a>
+ <a component="topic/move" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> {{tx("topic:thread-tools.move")}}</a>
</li>
{{{ end }}}
{{{ if privileges.deletable }}}
<li {{{ if deleted }}}hidden{{{ end }}}>
- <a component="topic/delete" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if deleted }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-trash-o text-secondary"></i> [[topic:thread-tools.delete]]</a>
+ <a component="topic/delete" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if deleted }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-trash-o text-secondary"></i> {{tx("topic:thread-tools.delete")}}</a>
</li>
{{{ if !scheduled }}}
<li {{{ if !deleted }}}hidden{{{ end }}}>
- <a component="topic/restore" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !deleted }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-history text-secondary"></i> [[topic:thread-tools.restore]]</a>
+ <a component="topic/restore" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !deleted }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-history text-secondary"></i> {{tx("topic:thread-tools.restore")}}</a>
</li>
{{{ end }}}
{{{ if privileges.purge }}}
<li {{{ if !deleted }}}hidden{{{ end }}}>
- <a component="topic/purge" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !deleted }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-eraser text-secondary"></i> [[topic:thread-tools.purge]]</a>
+ <a component="topic/purge" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !deleted }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-eraser text-secondary"></i> {{tx("topic:thread-tools.purge")}}</a>
</li>
{{{ end }}}
{{{ if privileges.isAdminOrMod }}}
<li>
- <a component="topic/delete/posts" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-trash-o text-secondary"></i> [[topic:thread-tools.delete-posts]]</a>
+ <a component="topic/delete/posts" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-trash-o text-secondary"></i> {{tx("topic:thread-tools.delete-posts")}}</a>
</li>
{{{ end }}}
{{{ end }}}