mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-02 23:31:41 +00:00
6bfbb9332d
* Adding listMedia endpoint, to view all your local image uploads. - Fixes #4445 * Fix ts import. * Forgot to order by published desc * Adding an endpoint to list all images, for admins only. * Forgot to add file. * Add additional test. * Use better logic for no-limit version. * Better call sites. * Adding another test. * Fix tests. * Moving list_media to /account action. * Addressing PR comments. * Removing pointless comment. --------- Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
34 lines
978 B
Rust
34 lines
978 B
Rust
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
|
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
|
|
|
|
pub mod add_admin;
|
|
pub mod ban_person;
|
|
pub mod block;
|
|
pub mod change_password;
|
|
pub mod change_password_after_reset;
|
|
pub mod generate_totp_secret;
|
|
pub mod get_captcha;
|
|
pub mod list_banned;
|
|
pub mod list_logins;
|
|
pub mod list_media;
|
|
pub mod login;
|
|
pub mod logout;
|
|
pub mod notifications;
|
|
pub mod report_count;
|
|
pub mod reset_password;
|
|
pub mod save_settings;
|
|
pub mod update_totp;
|
|
pub mod validate_auth;
|
|
pub mod verify_email;
|
|
|
|
/// Check if the user's email is verified if email verification is turned on
|
|
/// However, skip checking verification if the user is an admin
|
|
fn check_email_verified(local_user_view: &LocalUserView, site_view: &SiteView) -> LemmyResult<()> {
|
|
if !local_user_view.local_user.admin
|
|
&& site_view.local_site.require_email_verification
|
|
&& !local_user_view.local_user.email_verified
|
|
{
|
|
Err(LemmyErrorType::EmailNotVerified)?
|
|
}
|
|
Ok(())
|
|
}
|