Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pointercrate-core/src/permission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ impl PermissionsManager {

Ok(())
}

pub fn is_elevated(&self, permission_bits: u16) -> bool {
permission_bits > 0
}
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion pointercrate-demonlist-pages/src/account/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Module containing the tabs of the management web interfaces shown on the account page

pub mod demons;
pub mod list_integration;
pub mod players;
pub mod profile;
pub mod records;
pub mod submitters;
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ use pointercrate_user::{
use pointercrate_user_pages::account::AccountPageTab;
use sqlx::PgConnection;

pub struct ListIntegrationTab(#[doc = "discord invite url"] pub &'static str);
pub struct ProfileTab(#[doc = "discord invite url"] pub &'static str);

#[async_trait::async_trait]
impl AccountPageTab for ListIntegrationTab {
impl AccountPageTab for ProfileTab {
fn should_display_for(&self, _permissions_we_have: u16, _permissions: &PermissionsManager) -> bool {
true
}

fn initialization_script(&self) -> String {
"/static/demonlist/js/account/integration.js".into()
"/static/demonlist/js/account/profile.js".into()
}

fn tab_id(&self) -> u8 {
Expand All @@ -34,10 +34,10 @@ impl AccountPageTab for ListIntegrationTab {
fn tab(&self) -> Markup {
html! {
b {
(tr("list-integration"))
(tr("profile"))
}
(PreEscaped("  "))
i class = "fa fa-list fa-2x" aria-hidden="true" {}
i class = "fa fa-user fa-2x" aria-hidden="true" {}
}
}

Expand Down
4 changes: 2 additions & 2 deletions pointercrate-demonlist-pages/static/ftl/en-us/player.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ player-name-dialog = Change player name

.name-validator-valuemissing = Please provide a name for the player

## List integration tab
list-integration = List Integration
## Profile tab
profile = Profile

claimed-player = Claimed Player
.verified = Verified
Expand Down
4 changes: 2 additions & 2 deletions pointercrate-demonlist-pages/static/ftl/ru-ru/player.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ player-name-dialog = Изменение имени игрока

.name-validator-valuemissing = Пожалуйста, укажите имя игрока

## List integration tab
list-integration = Интеграция в листе
## Profile tab
profile = Профиль

claimed-player = Присвоенный профиль
.verified = Подтвержден
Expand Down
12 changes: 5 additions & 7 deletions pointercrate-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ use pointercrate_core_pages::{
};
use pointercrate_demonlist::LIST_ADMINISTRATOR;
use pointercrate_demonlist_api::GeolocationProvider;
use pointercrate_demonlist_pages::account::{
demons::DemonsTab, list_integration::ListIntegrationTab, players::PlayersPage, records::RecordsPage,
};
use pointercrate_demonlist_pages::account::{demons::DemonsTab, players::PlayersPage, profile::ProfileTab, records::RecordsPage};
use pointercrate_user::MODERATOR;
use pointercrate_user_pages::account::{profile::ProfileTab, users::UsersTab, AccountPageConfig};
use pointercrate_user_pages::account::{settings::SettingsTab, users::UsersTab, AccountPageConfig};
use rocket::{async_trait, fs::FileServer, response::Redirect, serde, uri, Request};
use std::net::IpAddr;
use unic_langid::lang;
Expand Down Expand Up @@ -146,9 +144,9 @@ async fn rocket() -> _ {
// [`AccountPageTab::should_display_for`] returns `true`.
let account_page_config = AccountPageConfig::default()
// Tab where users can modify their own accounts
.with_page(ProfileTab)
// Tab where users can initiate player claims and manage their claimed players
.with_page(ListIntegrationTab("https://discord.gg/tMBzYP77ag"))
.with_page(SettingsTab)
// Tab where users can initiate player claims and manage their claimed players (formerly "List Integration" tab)
.with_page(ProfileTab("https://discord.gg/tMBzYP77ag"))
// Tab where website moderators can manage permissions.
// The vector below specified which permissions a user needs to have for the tab to be displayed.
.with_page(UsersTab(vec![MODERATOR, LIST_ADMINISTRATOR]))
Expand Down
2 changes: 1 addition & 1 deletion pointercrate-user-pages/src/account/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use pointercrate_core_pages::{
use pointercrate_user::auth::{AuthenticatedUser, NonMutating};
use sqlx::PgConnection;

pub mod profile;
pub mod settings;
pub mod users;

#[async_trait::async_trait]
Expand Down
Loading
Loading