Hide report-abuse on current_user profile (#4460) [ci skip]
This commit is contained in:
parent
a00d1eb0d2
commit
9fa97ff642
2 changed files with 17 additions and 7 deletions
|
|
@ -1,11 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
function initializeUserProfilePage() {
|
||||
if (document.getElementById('user-profile-dropdown')) {
|
||||
document.getElementById('user-profile-dropdown').onclick = () => {
|
||||
document
|
||||
.getElementById('user-profile-dropdownmenu')
|
||||
.classList.toggle('showing');
|
||||
};
|
||||
const profileDropdownDiv = document.getElementsByClassName("profile-dropdown")[0];
|
||||
if (profileDropdownDiv) {
|
||||
const currentUser = userData();
|
||||
if (currentUser && (currentUser.username === profileDropdownDiv.dataset.username)) {
|
||||
profileDropdownDiv.hidden = true;
|
||||
}
|
||||
else {
|
||||
profileDropdownDiv.hidden = false;
|
||||
const userProfileDropdownButton = document.getElementById('user-profile-dropdown');
|
||||
if (userProfileDropdownButton) {
|
||||
const userProfileDropdownMenu = document.getElementById('user-profile-dropdownmenu');
|
||||
userProfileDropdownButton.addEventListener('click', () => {
|
||||
userProfileDropdownMenu.classList.toggle('showing');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<%= render "articles/user_metadata", context: "profile" %>
|
||||
<div class="profile-dropdown">
|
||||
<div class="profile-dropdown" data-username="<%= @user.username %>">
|
||||
<button id="user-profile-dropdown">
|
||||
<%= image_tag("three-dots.svg", class: "dropdown-icon", alt: "Toggle dropdown menu") %>
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue