diff --git a/app/controllers/web/admin/domains.js b/app/controllers/web/admin/domains.js index 7e11bed369..02a4841540 100644 --- a/app/controllers/web/admin/domains.js +++ b/app/controllers/web/admin/domains.js @@ -58,37 +58,15 @@ async function list(ctx) { } } - const sortField = ctx.query.sort - ? ctx.query.sort.replace('-', '') - : 'created_at'; - const sortOrder = ctx.query.sort && ctx.query.sort.startsWith('-') ? -1 : 1; - - const aggregationPipeline = [ - { $match: query }, - { - $lookup: { - from: 'aliases', - let: { domainId: '$_id' }, - pipeline: [ - { $match: { $expr: { $eq: ['$domain', '$$domainId'] } } }, - { $count: 'totalAliases' } - ], - as: 'totalAliasesInfo' - } - }, - { - $addFields: { - totalAliases: { $arrayElemAt: ['$totalAliasesInfo.totalAliases', 0] } - } - }, - { $unset: 'totalAliasesInfo' }, - { $sort: { [sortField]: sortOrder } }, - { $skip: ctx.paginate.skip }, - { $limit: ctx.query.limit } - ]; - const [domains, itemCount] = await Promise.all([ - Domains.aggregate(aggregationPipeline).exec(), + // eslint-disable-next-line unicorn/no-array-callback-reference + Domains.find(query) + .limit(ctx.query.limit) + .skip(ctx.paginate.skip) + .sort(ctx.query.sort || '-created_at') + .populate('members.user', 'id email') + .lean() + .exec(), Domains.countDocuments(query) ]); diff --git a/app/controllers/web/admin/users.js b/app/controllers/web/admin/users.js index 0b5ea5113c..3f19eb26d1 100644 --- a/app/controllers/web/admin/users.js +++ b/app/controllers/web/admin/users.js @@ -48,37 +48,14 @@ async function list(ctx) { } } - const sortField = ctx.query.sort - ? ctx.query.sort.replace('-', '') - : 'created_at'; - const sortOrder = ctx.query.sort && ctx.query.sort.startsWith('-') ? -1 : 1; - - const aggregationPipeline = [ - { $match: query }, - { - $lookup: { - from: 'domains', - let: { userId: '$_id' }, - pipeline: [ - { $match: { $expr: { $in: ['$$userId', '$members.user'] } } }, - { $count: 'totalDomains' } - ], - as: 'domainInfo' - } - }, - { - $addFields: { - totalDomains: { $arrayElemAt: ['$domainInfo.totalDomains', 0] } - } - }, - { $unset: 'domainInfo' }, - { $sort: { [sortField]: sortOrder } }, - { $skip: ctx.paginate.skip }, - { $limit: ctx.query.limit } - ]; - const [users, itemCount] = await Promise.all([ - Users.aggregate(aggregationPipeline).exec(), + // eslint-disable-next-line unicorn/no-array-callback-reference + Users.find(query) + .limit(ctx.query.limit) + .skip(ctx.paginate.skip) + .lean() + .sort(ctx.query.sort || '-created_at') + .exec(), Users.countDocuments(query) ]); diff --git a/app/views/admin/domains/_table.pug b/app/views/admin/domains/_table.pug index ca06e12c10..d91d79ab47 100644 --- a/app/views/admin/domains/_table.pug +++ b/app/views/admin/domains/_table.pug @@ -10,8 +10,6 @@ include ../../_pagination th(scope="col") +sortHeader('is_global', 'Global', '#table-domains') th.align-middle(scope="col")= t("Members") - th(scope="col") - +sortHeader('aliases', 'Aliases', '#table-domains') th(scope="col") +sortHeader('plan', 'Plan', '#table-domains') th(scope="col") @@ -54,7 +52,6 @@ include ../../_pagination = "(" code.text-muted= member.user.id = ")" - td.align-middle.text-center= domain.totalAliases td.align-middle.text-center = t(titleize(humanize(domain.plan))) td.align-middle.text-center diff --git a/app/views/admin/users/_table.pug b/app/views/admin/users/_table.pug index f361a49f00..6fa9b942de 100644 --- a/app/views/admin/users/_table.pug +++ b/app/views/admin/users/_table.pug @@ -11,8 +11,6 @@ include ../../_pagination +sortHeader(config.passport.fields.familyName, 'Last Name', '#table-users') th(scope="col") +sortHeader('email', null, '#table-users') - th(scope="col") - +sortHeader('domains', null, '#table-users') th(scope="col") +sortHeader('plan', null, '#table-users') th(scope="col") @@ -45,7 +43,6 @@ include ../../_pagination = "(" code.text-muted= user.id = ")" - td.align-middle= user.totalDomains td.align-middle= titleize(humanize(user.plan)) td.align-middle= titleize(humanize(user.group)) td.align-middle.dayjs( diff --git a/locales/ar.json b/locales/ar.json index 615fa29546..1ea6d5da8f 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "خدمة استضافة البريد الإلكتروني مفتوحة المصدر", "Custom Domain Email Forwarding": "إعادة توجيه البريد الإلكتروني إلى نطاق مخصص", "Suggested": "مقترح", - "Its description from its website is:": "وصفه من موقعه على الإنترنت هو:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "وصفه من موقعه على الإنترنت هو:" } \ No newline at end of file diff --git a/locales/cs.json b/locales/cs.json index 9e268933da..bccac9b0cf 100644 --- a/locales/cs.json +++ b/locales/cs.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Open-source e-mailová hostingová služba", "Custom Domain Email Forwarding": "Přeposílání e-mailů na vlastní doménu", "Suggested": "Doporučeno", - "Its description from its website is:": "Jeho popis z jeho webu je:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Jeho popis z jeho webu je:" } \ No newline at end of file diff --git a/locales/da.json b/locales/da.json index 802349f9c4..c24ec79145 100644 --- a/locales/da.json +++ b/locales/da.json @@ -7297,7 +7297,5 @@ "Legacy Free Guide": "Legacy gratis guide", "Suggested": "Foreslået", "Its description from its website is:": "Beskrivelsen fra dens hjemmeside er:", - "Compare %s with %d email services": "Sammenlign %s med %d e-mail-tjenester", - "domains": "domains", - "Replying to": "Replying to" + "Compare %s with %d email services": "Sammenlign %s med %d e-mail-tjenester" } \ No newline at end of file diff --git a/locales/de.json b/locales/de.json index bfd416a9bc..1dbda2f46c 100644 --- a/locales/de.json +++ b/locales/de.json @@ -9349,7 +9349,5 @@ "Open-source Email Hosting Service": "Open-Source-E-Mail-Hosting-Dienst", "Custom Domain Email Forwarding": "Benutzerdefinierte Domänen-E-Mail-Weiterleitung", "Suggested": "Empfohlen", - "Its description from its website is:": "Die Beschreibung auf der Website lautet:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Die Beschreibung auf der Website lautet:" } \ No newline at end of file diff --git a/locales/en.json b/locales/en.json index d59d32355d..397ed09427 100644 --- a/locales/en.json +++ b/locales/en.json @@ -6693,26 +6693,5 @@ "If your ISP blocks outbound port 25, then you will have to find an alternate solution or contact them.": "If your ISP blocks outbound port 25, then you will have to find an alternate solution or contact them.", "You can run": "You can run", "from command line or terminal to see if your outbound port 25 connection is blocked.": "from command line or terminal to see if your outbound port 25 connection is blocked.", - "Español": "Español", - "You do not belong to the administrative user group.": "You do not belong to the administrative user group.", - "Admin - Users": "Admin - Users", - "Search for users": "Search for users", - "Search by first name, last name, or email": "Search by first name, last name, or email", - "First Name": "First Name", - "Last Name": "Last Name", - "email": "email", - "domains": "domains", - "plan": "plan", - "group": "group", - "Last Login": "Last Login", - "Log in as user": "Log in as user", - "Admin - Inquiries": "Admin - Inquiries", - "Search for inquiries": "Search for inquiries", - "Search by email": "Search by email", - "Selected": "Selected", - "Reply": "Reply", - "Resolve": "Resolve", - "Bulk Reply": "Bulk Reply", - "Replying to": "Replying to", - "Submit Bulk Reply": "Submit Bulk Reply" + "Español": "Español" } \ No newline at end of file diff --git a/locales/es.json b/locales/es.json index f0183fc908..1b36b53b61 100644 --- a/locales/es.json +++ b/locales/es.json @@ -10308,7 +10308,5 @@ "Open-source Email Hosting Service": "Servicio de alojamiento de correo electrónico de código abierto", "Custom Domain Email Forwarding": "Reenvío de correo electrónico de dominio personalizado", "Suggested": "Sugerido", - "Its description from its website is:": "Su descripción desde su sitio web es:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Su descripción desde su sitio web es:" } \ No newline at end of file diff --git a/locales/fi.json b/locales/fi.json index e603204026..da206ed76d 100644 --- a/locales/fi.json +++ b/locales/fi.json @@ -10157,7 +10157,5 @@ "Open-source Email Hosting Service": "Avoimen lähdekoodin sähköpostipalvelu", "Custom Domain Email Forwarding": "Mukautetun verkkotunnuksen sähköpostin edelleenlähetys", "Suggested": "Ehdotettu", - "Its description from its website is:": "Sen kuvaus sen verkkosivuilta on:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Sen kuvaus sen verkkosivuilta on:" } \ No newline at end of file diff --git a/locales/fr.json b/locales/fr.json index fc6c635b90..b1240584e1 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -7834,7 +7834,5 @@ "Custom Domain Email Forwarding": "Transfert d'e-mails de domaine personnalisé", "Legacy Free Guide": "Guide gratuit sur l'héritage", "Suggested": "Suggéré", - "Its description from its website is:": "Sa description sur son site Web est :", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Sa description sur son site Web est :" } \ No newline at end of file diff --git a/locales/he.json b/locales/he.json index 9bc6128bd4..23b2dec43d 100644 --- a/locales/he.json +++ b/locales/he.json @@ -8330,7 +8330,5 @@ "Custom Domain Email Forwarding": "העברת דואר אלקטרוני בדומיין מותאם אישית", "Legacy Free Guide": "מדריך חינם מדור קודם", "Suggested": "מוּצָע", - "Its description from its website is:": "התיאור שלו מהאתר שלו הוא:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "התיאור שלו מהאתר שלו הוא:" } \ No newline at end of file diff --git a/locales/hu.json b/locales/hu.json index c325a0d6c5..61ac22bd7e 100644 --- a/locales/hu.json +++ b/locales/hu.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Nyílt forráskódú e-mail hosting szolgáltatás", "Custom Domain Email Forwarding": "Egyéni domain e-mail továbbítása", "Suggested": "Javasolt", - "Its description from its website is:": "Leírása a honlapjáról a következő:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Leírása a honlapjáról a következő:" } \ No newline at end of file diff --git a/locales/id.json b/locales/id.json index 34339ebc59..75e154a2f1 100644 --- a/locales/id.json +++ b/locales/id.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Layanan Hosting Email Sumber Terbuka", "Custom Domain Email Forwarding": "Penerusan Email Domain Kustom", "Suggested": "Disarankan", - "Its description from its website is:": "Uraian dari situs webnya adalah:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Uraian dari situs webnya adalah:" } \ No newline at end of file diff --git a/locales/it.json b/locales/it.json index d603b4d945..bfdf7b42f1 100644 --- a/locales/it.json +++ b/locales/it.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Servizio di hosting di posta elettronica open source", "Custom Domain Email Forwarding": "Inoltro e-mail di dominio personalizzato", "Suggested": "Suggerito", - "Its description from its website is:": "La descrizione dal suo sito web è:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "La descrizione dal suo sito web è:" } \ No newline at end of file diff --git a/locales/ja.json b/locales/ja.json index 7dc1ea2b6e..d3fa7cfbfa 100644 --- a/locales/ja.json +++ b/locales/ja.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "オープンソースのメールホスティングサービス", "Custom Domain Email Forwarding": "カスタムドメインメール転送", "Suggested": "提案", - "Its description from its website is:": "ウェブサイトからの説明は次のとおりです。", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "ウェブサイトからの説明は次のとおりです。" } \ No newline at end of file diff --git a/locales/ko.json b/locales/ko.json index d3e3a57f53..cb840319e3 100644 --- a/locales/ko.json +++ b/locales/ko.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "오픈소스 이메일 호스팅 서비스", "Custom Domain Email Forwarding": "사용자 정의 도메인 이메일 전달", "Suggested": "제안된", - "Its description from its website is:": "해당 웹사이트의 설명은 다음과 같습니다.", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "해당 웹사이트의 설명은 다음과 같습니다." } \ No newline at end of file diff --git a/locales/nl.json b/locales/nl.json index 2ce7b66cae..c75cbe1207 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Open-source e-mailhostingservice", "Custom Domain Email Forwarding": "E-mail doorsturen naar aangepast domein", "Suggested": "Voorgesteld", - "Its description from its website is:": "De beschrijving op de website is:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "De beschrijving op de website is:" } \ No newline at end of file diff --git a/locales/no.json b/locales/no.json index 5de171e4a1..cf7840d239 100644 --- a/locales/no.json +++ b/locales/no.json @@ -10315,7 +10315,5 @@ "Open-source Email Hosting Service": "Åpen kildekode e-postvertstjeneste", "Custom Domain Email Forwarding": "Egendefinert domene-e-postvideresending", "Suggested": "Foreslått", - "Its description from its website is:": "Beskrivelsen fra nettstedet er:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Beskrivelsen fra nettstedet er:" } \ No newline at end of file diff --git a/locales/pl.json b/locales/pl.json index add309ece8..5115971c2e 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Usługa hostingu poczty e-mail typu open source", "Custom Domain Email Forwarding": "Przekierowanie poczty e-mail na domenę niestandardową", "Suggested": "Sugerowane", - "Its description from its website is:": "Opis na stronie internetowej brzmi następująco:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Opis na stronie internetowej brzmi następująco:" } \ No newline at end of file diff --git a/locales/pt.json b/locales/pt.json index b327894354..f670f04f89 100644 --- a/locales/pt.json +++ b/locales/pt.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Serviço de hospedagem de e-mail de código aberto", "Custom Domain Email Forwarding": "Encaminhamento de e-mail de domínio personalizado", "Suggested": "Sugerido", - "Its description from its website is:": "A descrição no seu site é:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "A descrição no seu site é:" } \ No newline at end of file diff --git a/locales/ru.json b/locales/ru.json index 2f7cc89f4b..ee602f7180 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Служба хостинга электронной почты с открытым исходным кодом", "Custom Domain Email Forwarding": "Пересылка электронной почты на пользовательский домен", "Suggested": "Предложенный", - "Its description from its website is:": "Описание на сайте:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Описание на сайте:" } \ No newline at end of file diff --git a/locales/sv.json b/locales/sv.json index 55b1695ebd..51d42819b6 100644 --- a/locales/sv.json +++ b/locales/sv.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "E-postvärdtjänst med öppen källkod", "Custom Domain Email Forwarding": "Anpassad vidarebefordran av e-post på domän", "Suggested": "Föreslog", - "Its description from its website is:": "Dess beskrivning från dess hemsida är:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Dess beskrivning från dess hemsida är:" } \ No newline at end of file diff --git a/locales/th.json b/locales/th.json index ef97a3d114..57839107cd 100644 --- a/locales/th.json +++ b/locales/th.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "บริการโฮสติ้งอีเมล์โอเพ่นซอร์ส", "Custom Domain Email Forwarding": "การส่งต่ออีเมลโดเมนที่กำหนดเอง", "Suggested": "ข้อเสนอแนะ", - "Its description from its website is:": "คำอธิบายจากเว็บไซต์มีดังนี้:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "คำอธิบายจากเว็บไซต์มีดังนี้:" } \ No newline at end of file diff --git a/locales/tr.json b/locales/tr.json index 3f8b600ea9..e1c1ff6876 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Açık Kaynaklı E-posta Barındırma Hizmeti", "Custom Domain Email Forwarding": "Özel Alan Adı E-posta Yönlendirme", "Suggested": "Önerilen", - "Its description from its website is:": "Web sitesindeki açıklaması şöyle:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Web sitesindeki açıklaması şöyle:" } \ No newline at end of file diff --git a/locales/uk.json b/locales/uk.json index f66ec96153..4e5e6cb1d7 100644 --- a/locales/uk.json +++ b/locales/uk.json @@ -10310,7 +10310,5 @@ "Open-source Email Hosting Service": "Служба хостингу електронної пошти з відкритим кодом", "Custom Domain Email Forwarding": "Переадресація електронної пошти власного домену", "Suggested": "Запропоновано", - "Its description from its website is:": "Його опис на веб-сайті:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Його опис на веб-сайті:" } \ No newline at end of file diff --git a/locales/vi.json b/locales/vi.json index 842667b572..d64b883ad9 100644 --- a/locales/vi.json +++ b/locales/vi.json @@ -7839,7 +7839,5 @@ "Custom Domain Email Forwarding": "Chuyển tiếp Email theo tên miền tùy chỉnh", "Legacy Free Guide": "Hướng dẫn miễn phí Legacy", "Suggested": "Đề xuất", - "Its description from its website is:": "Mô tả từ trang web của nó như sau:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "Mô tả từ trang web của nó như sau:" } \ No newline at end of file diff --git a/locales/zh.json b/locales/zh.json index a5a2536407..44f4119983 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -10003,7 +10003,5 @@ "Open-source Email Hosting Service": "开源电子邮件托管服务", "Custom Domain Email Forwarding": "自定义域名电子邮件转发", "Suggested": "建议", - "Its description from its website is:": "其网站上的描述是:", - "domains": "domains", - "Replying to": "Replying to" + "Its description from its website is:": "其网站上的描述是:" } \ No newline at end of file