Skip to content

Node.js based forum software built for the modern web

feat: when clicking group membership request notification

Barış Soner Uşaklı24b781c3b81c
diff --git a/public/src/client/groups/details.js b/public/src/client/groups/details.js
index d19e03134a..dd4de8eb82 100644
--- a/public/src/client/groups/details.js
+++ b/public/src/client/groups/details.js
@@ -1,6 +1,7 @@
'use strict';
define('forum/groups/details', [
+ 'bootstrap',
'forum/groups/memberlist',
'iconSelect',
'components',
@@ -14,6 +15,7 @@ define('forum/groups/details', [
'helpers',
'translator',
], function (
+ bootstrap,
memberList,
iconSelect,
components,
@@ -35,6 +37,8 @@ define('forum/groups/details', [
groupName = ajaxify.data.group.name;
+ handleTabNavigation(detailsPage);
+
if (ajaxify.data.group.isOwner) {
Details.prepareSettings();
@@ -188,6 +192,31 @@ define('forum/groups/details', [
});
};
+ function handleTabNavigation(detailsPage) {
+ if (window.location.hash) {
+ const tabId = window.location.hash.slice(1);
+ const tabToggle = document.querySelector(
+ `[data-bs-toggle="tab"][data-bs-target="#groups-${tabId}"]`
+ );
+ if (tabToggle) {
+ bootstrap.Tab.getOrCreateInstance(tabToggle).show();
+ }
+ }
+
+ detailsPage.find('[data-bs-toggle="tab"]').on('shown.bs.tab', function (event) {
+ const tabTarget = event.target.getAttribute('data-bs-target');
+ if (!tabTarget || !tabTarget.startsWith('#')) {
+ return;
+ }
+
+ const paneId = tabTarget.slice(1);
+ const hash = paneId.startsWith('groups-') ? `#${paneId.slice('groups-'.length)}` : tabTarget;
+ if (window.location.hash !== hash) {
+ history.replaceState(null, '', hash);
+ }
+ });
+ }
+
Details.prepareSettings = function () {
const settingsFormEl = components.get('groups/settings');
const labelColorValueEl = settingsFormEl.find('[name="labelColor"]');
diff --git a/src/groups/invite.js b/src/groups/invite.js
index 2e49eb1baa..8201b3dff5 100644
--- a/src/groups/invite.js
+++ b/src/groups/invite.js
@@ -28,7 +28,7 @@ module.exports = function (Groups) {
bodyShort: tx.compile('groups:request.notification-title', displayname),
bodyLong: tx.compile('groups:request.notification-text', displayname, tx.escape(groupName)),
nid: `group:${groupName}:uid:${uid}:request`,
- path: `/groups/${slugify(groupName)}`,
+ path: `/groups/${slugify(groupName)}#pending`,
from: uid,
}),
Groups.getOwners(groupName),