Skip to content

Commit

Permalink
Revert "feat: add total domain and aliases into respective admin pages"
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism authored Aug 29, 2024
1 parent b517e22 commit 6032c00
Show file tree
Hide file tree
Showing 29 changed files with 40 additions and 160 deletions.
38 changes: 8 additions & 30 deletions app/controllers/web/admin/domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]);

Expand Down
37 changes: 7 additions & 30 deletions app/controllers/web/admin/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]);

Expand Down
3 changes: 0 additions & 3 deletions app/views/admin/domains/_table.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions app/views/admin/users/_table.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 1 addition & 3 deletions locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "وصفه من موقعه على الإنترنت هو:"
}
4 changes: 1 addition & 3 deletions locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <span class=\"notranslate\">%s</span> with <span class=\"notranslate\">%d</span> email services": "Sammenlign <span class=\"notranslate\">%s</span> med <span class=\"notranslate\">%d</span> e-mail-tjenester",
"domains": "domains",
"Replying to": "Replying to"
"Compare <span class=\"notranslate\">%s</span> with <span class=\"notranslate\">%d</span> email services": "Sammenlign <span class=\"notranslate\">%s</span> med <span class=\"notranslate\">%d</span> e-mail-tjenester"
}
4 changes: 1 addition & 3 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
23 changes: 1 addition & 22 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 1 addition & 3 deletions locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 :"
}
4 changes: 1 addition & 3 deletions locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "התיאור שלו מהאתר שלו הוא:"
}
4 changes: 1 addition & 3 deletions locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -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ő:"
}
4 changes: 1 addition & 3 deletions locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 è:"
}
4 changes: 1 addition & 3 deletions locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "ウェブサイトからの説明は次のとおりです。"
}
4 changes: 1 addition & 3 deletions locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "해당 웹사이트의 설명은 다음과 같습니다."
}
4 changes: 1 addition & 3 deletions locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 é:"
}
4 changes: 1 addition & 3 deletions locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "Описание на сайте:"
}
4 changes: 1 addition & 3 deletions locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "คำอธิบายจากเว็บไซต์มีดังนี้:"
}
4 changes: 1 addition & 3 deletions locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "Його опис на веб-сайті:"
}
4 changes: 1 addition & 3 deletions locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
}
4 changes: 1 addition & 3 deletions locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:": "其网站上的描述是:"
}

0 comments on commit 6032c00

Please sign in to comment.