Skip to content

Commit

Permalink
Added method to retrieve the current moderators list (#266)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
csharpfritz and github-actions[bot] authored Oct 30, 2023
1 parent 8af4446 commit 31fed80
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/TagzApp.Web/Hubs/ModerationHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ public async Task SetStatus(string provider, string providerId, ModerationState

}

public async Task<NewModerator[]> GetCurrentModerators()
{

return _CurrentUsersModerating.Select((k) => new NewModerator(k.Key, k.Key.ToGravatar(), k.Value)).ToArray();

}

}

public interface IModerationClient
Expand Down
10 changes: 10 additions & 0 deletions src/TagzApp.Web/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@
}

function AddModerator(moderator) {
// Don't double add the moderator
if (document.getElementById('moderator-' + moderator.email)) return;

var moderatorList = document.querySelector('.currentModerators');

var newMod = document.createElement('img');
Expand Down Expand Up @@ -669,6 +672,13 @@
});
window.Masonry.resizeAllGridItems();
});

connection.invoke('GetCurrentModerators').then(function (result) {
result.forEach(function (moderator) {
AddModerator(moderator);
});
window.Masonry.resizeAllGridItems();
});
},
};

Expand Down

0 comments on commit 31fed80

Please sign in to comment.