feat(navigation): enhance adult verification handling and notifications
- Updated navigationController to simplify the eroticChat menu structure. - Enhanced adminService to notify users of adult verification status changes, including previous status. - Improved AppNavigation and related components to register and unregister socket listeners for adult verification updates. - Added localized messages for adult verification notifications in English, German, and Spanish. - Introduced a verification hint in the EroticAccessView to guide users on document submission.
This commit is contained in:
@@ -184,6 +184,7 @@
|
||||
import { mapGetters, mapActions } from 'vuex';
|
||||
import apiClient from '@/utils/axios.js';
|
||||
import { EventBus } from '@/utils/eventBus.js';
|
||||
import { showInfo } from '@/utils/feedback.js';
|
||||
|
||||
export default {
|
||||
name: 'AppNavigation',
|
||||
@@ -198,7 +199,11 @@ export default {
|
||||
pinnedSubKey: null,
|
||||
suppressHover: false,
|
||||
hoverReleaseTimer: null,
|
||||
isMobileNav: false
|
||||
isMobileNav: false,
|
||||
_forumsChangedHandler: null,
|
||||
_friendLoginChangedHandler: null,
|
||||
_reloadMenuHandler: null,
|
||||
_adultVerificationChangedHandler: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -212,10 +217,9 @@ export default {
|
||||
this.collapseMenus();
|
||||
},
|
||||
socket(newSocket) {
|
||||
this.unregisterSocketListeners();
|
||||
if (newSocket) {
|
||||
newSocket.on('forumschanged', this.fetchForums);
|
||||
newSocket.on('friendloginchanged', this.fetchFriends);
|
||||
newSocket.on('reloadmenu', this.loadMenu);
|
||||
this.registerSocketListeners(newSocket);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -230,14 +234,12 @@ export default {
|
||||
window.addEventListener('resize', this.updateViewportState);
|
||||
document.addEventListener('click', this.handleDocumentClick);
|
||||
document.addEventListener('keydown', this.handleDocumentKeydown);
|
||||
if (this.socket) {
|
||||
this.registerSocketListeners(this.socket);
|
||||
}
|
||||
},
|
||||
beforeUnmount() {
|
||||
const sock = this.socket;
|
||||
if (sock) {
|
||||
sock.off('forumschanged');
|
||||
sock.off('friendloginchanged');
|
||||
sock.off('reloadmenu');
|
||||
}
|
||||
this.unregisterSocketListeners();
|
||||
window.removeEventListener('resize', this.updateViewportState);
|
||||
document.removeEventListener('click', this.handleDocumentClick);
|
||||
document.removeEventListener('keydown', this.handleDocumentKeydown);
|
||||
@@ -248,6 +250,38 @@ export default {
|
||||
methods: {
|
||||
...mapActions(['loadMenu', 'logout']),
|
||||
|
||||
registerSocketListeners(sock) {
|
||||
if (!sock) return;
|
||||
this._forumsChangedHandler = () => this.fetchForums();
|
||||
this._friendLoginChangedHandler = () => this.fetchFriends();
|
||||
this._reloadMenuHandler = () => this.loadMenu();
|
||||
this._adultVerificationChangedHandler = async (payload = {}) => {
|
||||
await this.loadMenu();
|
||||
if (payload.status === 'approved') {
|
||||
showInfo(this, this.$t('socialnetwork.erotic.notifications.approved'));
|
||||
} else if (payload.status === 'rejected') {
|
||||
showInfo(this, this.$t('socialnetwork.erotic.notifications.rejected'));
|
||||
}
|
||||
};
|
||||
sock.on('forumschanged', this._forumsChangedHandler);
|
||||
sock.on('friendloginchanged', this._friendLoginChangedHandler);
|
||||
sock.on('reloadmenu', this._reloadMenuHandler);
|
||||
sock.on('adultVerificationChanged', this._adultVerificationChangedHandler);
|
||||
},
|
||||
|
||||
unregisterSocketListeners() {
|
||||
const sock = this.socket;
|
||||
if (!sock) return;
|
||||
if (this._forumsChangedHandler) sock.off('forumschanged', this._forumsChangedHandler);
|
||||
if (this._friendLoginChangedHandler) sock.off('friendloginchanged', this._friendLoginChangedHandler);
|
||||
if (this._reloadMenuHandler) sock.off('reloadmenu', this._reloadMenuHandler);
|
||||
if (this._adultVerificationChangedHandler) sock.off('adultVerificationChanged', this._adultVerificationChangedHandler);
|
||||
this._forumsChangedHandler = null;
|
||||
this._friendLoginChangedHandler = null;
|
||||
this._reloadMenuHandler = null;
|
||||
this._adultVerificationChangedHandler = null;
|
||||
},
|
||||
|
||||
updateViewportState() {
|
||||
this.isMobileNav = window.innerWidth <= 960;
|
||||
if (!this.isMobileNav) {
|
||||
@@ -458,8 +492,8 @@ export default {
|
||||
/**
|
||||
* Einheitliche Klick‑Logik:
|
||||
* 1) Nur aufklappen, wenn noch Untermenüs existieren
|
||||
* 2) Bei `view`: Dialog/Window öffnen
|
||||
* 3) Bei `action`: custom action aufrufen
|
||||
* 2) Bei `action`: custom action aufrufen
|
||||
* 3) Bei `view`: Dialog/Window öffnen
|
||||
* 4) Sonst: normale Router-Navigation
|
||||
*/
|
||||
handleItem(item, event, key = null) {
|
||||
@@ -481,7 +515,14 @@ export default {
|
||||
|
||||
if (this.hasChildren(item)) return;
|
||||
|
||||
// 2) view → Dialog/Window
|
||||
// 2) custom action (openForum, openChat, ...)
|
||||
if (item.action && typeof this[item.action] === 'function') {
|
||||
this[item.action](item.params, event);
|
||||
this.collapseMenus();
|
||||
return;
|
||||
}
|
||||
|
||||
// 3) view → Dialog/Window
|
||||
if (item.view) {
|
||||
const dialogRef = this.$root.$refs[item.class];
|
||||
if (!dialogRef) {
|
||||
@@ -500,13 +541,6 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// 3) custom action (openForum, openChat, ...)
|
||||
if (item.action && typeof this[item.action] === 'function') {
|
||||
this[item.action](item.params, event);
|
||||
this.collapseMenus();
|
||||
return;
|
||||
}
|
||||
|
||||
// 4) Standard‑Navigation
|
||||
if (item.path) {
|
||||
this.$router.push(item.path);
|
||||
|
||||
Reference in New Issue
Block a user