Merge branch 'main' into hide-removed-deleted-posts

This commit is contained in:
Felix Ableitner 2023-07-19 13:28:09 +02:00
commit 1ea5922e78
75 changed files with 450 additions and 16 deletions

View file

@ -27,6 +27,29 @@ pipeline:
commands:
- prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
restore-cache:
image: meltwater/drone-cache:v1
pull: true
settings:
restore: true
endpoint:
from_secret: MINIO_ENDPOINT
access-key:
from_secret: MINIO_WRITE_USER
secret-key:
from_secret: MINIO_WRITE_PASSWORD
bucket:
from_secret: MINIO_BUCKET
region: us-east-1
cache_key: "rust-cache"
path-style: true
mount:
- ".cargo"
- "target"
- "api_tests/node_modules"
secrets:
[MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
taplo_check:
image: tamasfe/taplo:0.8.1
commands:
@ -40,7 +63,7 @@ pipeline:
CARGO_HOME: .cargo
commands:
# need make existing toolchain available
- cp ~/.cargo . -r
- cp -n ~/.cargo . -r
- rustup toolchain install nightly-2023-07-10
- rustup component add rustfmt --toolchain nightly-2023-07-10
- cargo +nightly-2023-07-10 fmt -- --check
@ -68,7 +91,6 @@ pipeline:
-D clippy::explicit_into_iter_loop
-D clippy::explicit_iter_loop
-D clippy::needless_collect
- cargo clippy --workspace --features console --
-D clippy::unwrap_used
-D clippy::indexing_slicing
# when:
@ -158,6 +180,29 @@ pipeline:
# when:
# platform: linux/amd64
rebuild-cache:
image: meltwater/drone-cache:v1
pull: true
settings:
rebuild: true
endpoint:
from_secret: MINIO_ENDPOINT
access-key:
from_secret: MINIO_WRITE_USER
secret-key:
from_secret: MINIO_WRITE_PASSWORD
bucket:
from_secret: MINIO_BUCKET
cache_key: "rust-cache"
region: us-east-1
path-style: true
mount:
- ".cargo"
- "target"
- "api_tests/node_modules"
secrets:
[MINIO_ENDPOINT, MINIO_WRITE_USER, MINIO_WRITE_PASSWORD, MINIO_BUCKET]
publish_release_docker:
image: woodpeckerci/plugin-docker-buildx
secrets: [docker_username, docker_password]

View file

@ -16,7 +16,8 @@
<a href="readmes/README.es.md">Español</a> |
<a href="readmes/README.ru.md">Русский</a> |
<a href="readmes/README.zh.hans.md">汉语</a> |
<a href="readmes/README.zh.hant.md">漢語</a>
<a href="readmes/README.zh.hant.md">漢語</a> |
<a href="readmes/README.ja.md">日本語</a>
</p>
<p align="center">

View file

@ -1,11 +1,15 @@
#!/usr/bin/env bash
# IMPORTANT NOTE: this script does not use the normal LEMMY_DATABASE_URL format
# it is expected that this script is called by run-federation-test.sh script.
set -e
export RUST_BACKTRACE=1
export RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
echo "DB URL: ${LEMMY_DATABASE_URL} INSTANCE: $INSTANCE"
psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
echo "create database"
psql "${LEMMY_DATABASE_URL}/lemmy" -c "CREATE DATABASE $INSTANCE"
done
@ -26,6 +30,7 @@ else
done
fi
echo "killall existing lemmy_server processes"
killall lemmy_server || true
echo "$PWD"
@ -59,7 +64,12 @@ target/lemmy_server >/tmp/lemmy_epsilon.out 2>&1 &
echo "wait for all instances to start"
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-alpha:8541/api/v3/site')" != "200" ]]; do sleep 1; done
echo "alpha started"
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-beta:8551/api/v3/site')" != "200" ]]; do sleep 1; done
echo "beta started"
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-gamma:8561/api/v3/site')" != "200" ]]; do sleep 1; done
echo "gamma started"
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-delta:8571/api/v3/site')" != "200" ]]; do sleep 1; done
echo "delta started"
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-epsilon:8581/api/v3/site')" != "200" ]]; do sleep 1; done
echo "epsilon started. All started"

View file

@ -76,6 +76,9 @@ pub(crate) fn check_report_reason(reason: &str, local_site: &LocalSite) -> Resul
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use lemmy_api_common::utils::check_validator_time;
use lemmy_db_schema::{
source::{

View file

@ -82,6 +82,19 @@ pub async fn build_post_response(
Ok(PostResponse { post_view })
}
// this is a variation of build_post_response that returns post even if end-user-delted or mod-removed.
// Assumption is that before this function is ever called, the user is already confirmed to be authorized to view post.
// See GitHub Issue #3588
pub async fn build_post_response_deleted_allowed(
context: &Data<LemmyContext>,
_community_id: CommunityId,
person_id: PersonId,
post_id: PostId,
) -> Result<PostResponse, LemmyError> {
let post_view = PostView::read(&mut context.pool(), post_id, Some(person_id), Some(true)).await?;
Ok(PostResponse { post_view })
}
// TODO: this function is a mess and should be split up to handle email seperately
#[tracing::instrument(skip_all)]
pub async fn send_local_notifs(

View file

@ -270,6 +270,9 @@ pub fn build_user_agent(settings: &Settings) -> String {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::request::{
build_user_agent,
fetch_site_metadata,

View file

@ -731,6 +731,9 @@ pub async fn delete_user_account(
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::utils::{honeypot_check, password_length_check};
#[test]

View file

@ -1,7 +1,7 @@
use crate::PerformCrud;
use actix_web::web::Data;
use lemmy_api_common::{
build_response::build_post_response,
build_response::build_post_response_deleted_allowed,
context::LemmyContext,
post::{DeletePost, PostResponse},
utils::{check_community_ban, check_community_deleted_or_removed, local_user_view_from_jwt},
@ -52,7 +52,7 @@ impl PerformCrud for DeletePost {
)
.await?;
build_post_response(
build_post_response_deleted_allowed(
context,
orig_post.community_id,
local_user_view.person.id,

View file

@ -1,7 +1,7 @@
use crate::PerformCrud;
use actix_web::web::Data;
use lemmy_api_common::{
build_response::build_post_response,
build_response::build_post_response_deleted_allowed,
context::LemmyContext,
post::{PostResponse, RemovePost},
utils::{check_community_ban, is_mod_or_admin, local_user_view_from_jwt},
@ -61,7 +61,7 @@ impl PerformCrud for RemovePost {
};
ModRemovePost::create(&mut context.pool(), &form).await?;
build_post_response(
build_post_response_deleted_allowed(
context,
orig_post.community_id,
local_user_view.person.id,

View file

@ -183,6 +183,9 @@ fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) ->
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::site::create::validate_create_payload;
use lemmy_api_common::site::CreateSite;
use lemmy_db_schema::{source::local_site::LocalSite, ListingType, RegistrationMode};

View file

@ -42,6 +42,9 @@ pub fn application_question_check(
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::site::{application_question_check, site_default_post_listing_type_check};
use lemmy_db_schema::{ListingType, RegistrationMode};

View file

@ -217,6 +217,9 @@ fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> Lemm
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::site::update::validate_update_payload;
use lemmy_api_common::site::EditSite;
use lemmy_db_schema::{source::local_site::LocalSite, ListingType, RegistrationMode};

View file

@ -134,6 +134,9 @@ impl InCommunity for AnnouncableActivities {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
activity_lists::{
GroupInboxActivities,

View file

@ -100,6 +100,9 @@ impl Collection for ApubCommunityModerators {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
objects::{

View file

@ -179,6 +179,9 @@ impl Object for ApubComment {
#[cfg(test)]
pub(crate) mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
objects::{

View file

@ -204,6 +204,9 @@ impl ApubCommunity {
#[cfg(test)]
pub(crate) mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
objects::{instance::tests::parse_lemmy_instance, tests::init_context},

View file

@ -206,6 +206,9 @@ pub(crate) async fn remote_instance_inboxes(pool: &mut DbPool<'_>) -> Result<Vec
#[cfg(test)]
pub(crate) mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{objects::tests::init_context, protocol::tests::file_to_json_object};
use lemmy_db_schema::traits::Crud;

View file

@ -54,6 +54,9 @@ pub(crate) fn verify_is_remote_object(id: &Url, settings: &Settings) -> Result<(
#[cfg(test)]
pub(crate) mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use activitypub_federation::config::{Data, FederationConfig};
use anyhow::anyhow;
use lemmy_api_common::{context::LemmyContext, request::build_user_agent};

View file

@ -195,6 +195,9 @@ impl Actor for ApubPerson {
#[cfg(test)]
pub(crate) mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
objects::{

View file

@ -280,6 +280,9 @@ impl Object for ApubPost {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
objects::{

View file

@ -136,6 +136,9 @@ impl Object for ApubPrivateMessage {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
objects::{

View file

@ -3,6 +3,9 @@ pub mod undo_block_user;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::block::{block_user::BlockUser, undo_block_user::UndoBlockUser},
tests::test_parse_lemmy_item,

View file

@ -7,6 +7,9 @@ pub mod update;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::community::{
announce::AnnounceActivity,

View file

@ -4,6 +4,9 @@ pub mod page;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::create_or_update::{
chat_message::CreateOrUpdateChatMessage,

View file

@ -4,6 +4,9 @@ pub mod undo_delete;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::deletion::{delete::Delete, delete_user::DeleteUser, undo_delete::UndoDelete},
tests::test_parse_lemmy_item,

View file

@ -4,6 +4,9 @@ pub mod undo_follow;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::following::{accept::AcceptFollow, follow::Follow, undo_follow::UndoFollow},
tests::test_parse_lemmy_item,

View file

@ -16,6 +16,9 @@ pub enum CreateOrUpdateType {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::{
community::announce::AnnounceActivity,

View file

@ -3,6 +3,9 @@ pub mod vote;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
activities::voting::{undo_vote::UndoVote, vote::Vote},
tests::test_parse_lemmy_item,

View file

@ -6,6 +6,9 @@ pub(crate) mod group_outbox;
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
collections::{
empty_outbox::EmptyOutbox,

View file

@ -89,6 +89,9 @@ pub trait InCommunity {
#[cfg(test)]
pub(crate) mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use activitypub_federation::protocol::context::WithContext;
use assert_json_diff::assert_json_include;
use lemmy_utils::error::LemmyError;

View file

@ -95,6 +95,9 @@ impl LanguageTag {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{
objects::{
chat_message::ChatMessage,

View file

@ -242,6 +242,9 @@ where
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::protocol::{objects::page::Page, tests::test_parse_lemmy_item};
#[test]

View file

@ -35,6 +35,9 @@ impl CommentAggregates {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
aggregates::comment_aggregates::CommentAggregates,
source::{

View file

@ -19,6 +19,9 @@ impl CommunityAggregates {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
aggregates::community_aggregates::CommunityAggregates,
source::{

View file

@ -19,6 +19,9 @@ impl PersonAggregates {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
aggregates::person_aggregates::PersonAggregates,
source::{

View file

@ -35,6 +35,9 @@ impl PostAggregates {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
aggregates::post_aggregates::PostAggregates,
source::{

View file

@ -15,6 +15,9 @@ impl SiteAggregates {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
aggregates::site_aggregates::SiteAggregates,
source::{

View file

@ -58,6 +58,9 @@ impl ReceivedActivity {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::utils::build_db_pool_for_tests;
use serde_json::json;

View file

@ -384,6 +384,9 @@ async fn convert_read_languages(
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use crate::{
impls::actor_language::{

View file

@ -50,6 +50,9 @@ impl CaptchaAnswer {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm, CheckCaptchaAnswer},
utils::build_db_pool_for_tests,

View file

@ -251,6 +251,9 @@ impl Saveable for CommentSaved {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
newtypes::LanguageId,
source::{

View file

@ -81,6 +81,9 @@ impl CommentReply {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
comment::{Comment, CommentInsertForm},

View file

@ -331,6 +331,9 @@ impl ApubActor for Community {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
community::{

View file

@ -49,6 +49,9 @@ impl FederationAllowList {
}
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{federation_allowlist::FederationAllowList, instance::Instance},
utils::build_db_pool_for_tests,

View file

@ -42,6 +42,9 @@ impl Language {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{source::language::Language, utils::build_db_pool_for_tests};
use serial_test::serial;

View file

@ -551,6 +551,9 @@ impl Crud for AdminPurgeComment {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
comment::{Comment, CommentInsertForm},

View file

@ -107,6 +107,9 @@ fn bytes_to_hex(bytes: Vec<u8>) -> String {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
instance::Instance,

View file

@ -200,6 +200,9 @@ impl PersonFollower {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
instance::Instance,

View file

@ -82,6 +82,9 @@ impl PersonMention {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
comment::{Comment, CommentInsertForm},

View file

@ -329,6 +329,9 @@ impl Readable for PostRead {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
community::{Community, CommunityInsertForm},

View file

@ -91,6 +91,9 @@ impl PrivateMessage {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
source::{
instance::Instance,

View file

@ -406,6 +406,9 @@ where
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::{fuzzy_search, *};
use crate::utils::is_email_regex;

View file

@ -269,6 +269,9 @@ impl JoinView for CommentReportView {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::comment_report_view::{CommentReportQuery, CommentReportView};
use lemmy_db_schema::{
aggregates::structs::CommentAggregates,

View file

@ -397,6 +397,9 @@ impl JoinView for CommentView {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
comment_view::{
Comment,

View file

@ -265,6 +265,9 @@ impl JoinView for PostReportView {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::post_report_view::{PostReportQuery, PostReportView};
use lemmy_db_schema::{
aggregates::structs::PostAggregates,

View file

@ -145,6 +145,7 @@ impl PostView {
.into_boxed();
// Hide deleted and removed for non-admins or mods
// Note: one special use case for this flag variable is when end-user-delete post or mod-removed post.
if !is_mod_or_admin.unwrap_or(false) {
query = query
.filter(community::removed.eq(false))
@ -493,6 +494,9 @@ impl JoinView for PostView {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::{
post_view::{PostQuery, PostView},
structs::LocalUserView,

View file

@ -148,6 +148,9 @@ impl JoinView for PrivateMessageReportView {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::private_message_report_view::PrivateMessageReportQuery;
use lemmy_db_schema::{
source::{

View file

@ -160,6 +160,9 @@ impl JoinView for RegistrationApplicationView {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::registration_application_view::{
RegistrationApplicationQuery,
RegistrationApplicationView,

View file

@ -249,6 +249,8 @@ impl<T> LemmyErrorExt2<T> for Result<T, LemmyError> {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::*;
use actix_web::{body::MessageBody, ResponseError};
use std::fs::read_to_string;

View file

@ -275,6 +275,9 @@ fn parse_ip(addr: &str) -> Option<IpAddr> {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
#[test]
fn test_parse_ip() {
let ip_addrs = [

View file

@ -237,6 +237,9 @@ fn split_ipv6(ip: Ipv6Addr) -> ([u8; 6], u8, u8) {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
#[test]
fn test_split_ipv6() {
let ip = std::net::Ipv6Addr::new(

View file

@ -18,6 +18,9 @@ pub fn markdown_to_html(text: &str) -> String {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::utils::markdown::markdown_to_html;
#[test]

View file

@ -135,6 +135,9 @@ pub fn add(markdown_parser: &mut MarkdownIt) {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::utils::markdown::spoiler_rule::add;
use markdown_it::MarkdownIt;

View file

@ -35,6 +35,9 @@ pub fn scrape_text_for_mentions(text: &str) -> Vec<MentionData> {
#[cfg(test)]
mod test {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::utils::mention::scrape_text_for_mentions;
#[test]

View file

@ -65,6 +65,9 @@ pub(crate) fn slurs_vec_to_str(slurs: &[&str]) -> String {
#[cfg(test)]
mod test {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use crate::utils::slurs::{remove_slurs, slur_check, slurs_vec_to_str};
use regex::RegexBuilder;

View file

@ -311,6 +311,9 @@ pub fn check_url_scheme(url: &Option<Url>) -> LemmyResult<()> {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use super::build_totp_2fa;
use crate::{
error::LemmyErrorType,

View file

@ -16,7 +16,8 @@
<span>Español</span> |
<a href="README.ru.md">Русский</a> |
<a href="README.zh.hans.md">汉语</a> |
<a href="README.zh.hant.md">漢語</a>
<a href="README.zh.hant.md">漢語</a> |
<a href="README.ja.md">日本語</a>
</p>
<p align="center">

178
readmes/README.ja.md Normal file
View file

@ -0,0 +1,178 @@
<div align="center">
![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/LemmyNet/lemmy.svg)
[![Build Status](https://woodpecker.join-lemmy.org/api/badges/LemmyNet/lemmy/status.svg)](https://woodpecker.join-lemmy.org/LemmyNet/lemmy)
[![GitHub issues](https://img.shields.io/github/issues-raw/LemmyNet/lemmy.svg)](https://github.com/LemmyNet/lemmy/issues)
[![Docker Pulls](https://img.shields.io/docker/pulls/dessalines/lemmy.svg)](https://cloud.docker.com/repository/docker/dessalines/lemmy/)
[![Translation status](http://weblate.join-lemmy.org/widgets/lemmy/-/lemmy/svg-badge.svg)](http://weblate.join-lemmy.org/engage/lemmy/)
[![License](https://img.shields.io/github/license/LemmyNet/lemmy.svg)](LICENSE)
![GitHub stars](https://img.shields.io/github/stars/LemmyNet/lemmy?style=social)
[![Delightful Humane Tech](https://codeberg.org/teaserbot-labs/delightful-humane-design/raw/branch/main/humane-tech-badge.svg)](https://codeberg.org/teaserbot-labs/delightful-humane-design)
</div>
<p align="center">
<a href="../README.md">English</a> |
<a href="README.ru.md">Español</a> |
<a href="README.ru.md">Русский</a> |
<a href="README.zh.hans.md">汉语</a> |
<a href="README.zh.hant.md">漢語</a> |
<span>日本語</span>
</p>
<p align="center">
<a href="https://join-lemmy.org/" rel="noopener">
<img width=200px height=200px src="https://raw.githubusercontent.com/LemmyNet/lemmy-ui/main/src/assets/icons/favicon.svg"></a>
<h3 align="center"><a href="https://join-lemmy.org">Lemmy</a></h3>
<p align="center">
フェディバースのリンクアグリゲーターとフォーラムです。
<br />
<br />
<a href="https://join-lemmy.org">Lemmy に参加</a>
·
<a href="https://join-lemmy.org/docs/en/index.html">ドキュメント</a>
·
<a href="https://matrix.to/#/#lemmy-space:matrix.org">マトリックスチャット</a>
·
<a href="https://github.com/LemmyNet/lemmy/issues">バグを報告</a>
·
<a href="https://github.com/LemmyNet/lemmy/issues">機能リクエスト</a>
·
<a href="https://github.com/LemmyNet/lemmy/blob/main/RELEASES.md">リリース</a>
·
<a href="https://join-lemmy.org/docs/en/code_of_conduct.html">行動規範</a>
</p>
</p>
## プロジェクトについて
| デスクトップ | モバイル |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| ![desktop](https://raw.githubusercontent.com/LemmyNet/joinlemmy-site/main/src/assets/images/main_img.webp) | ![mobile](https://raw.githubusercontent.com/LemmyNet/joinlemmy-site/main/src/assets/images/mobile_pic.webp) |
[Lemmy](https://github.com/LemmyNet/lemmy) は、[Reddit](https://reddit.com)、[Lobste.rs](https://lobste.rs)、[Hacker News](https://news.ycombinator.com/) といったサイトに似ています。興味のあるフォーラムを購読してリンクや議論を掲載し、投票したり、コメントしたりしています。誰でも簡単にサーバーを運営することができ、これらのサーバーはすべて連合しており(電子メールを考えてください)、[Fediverse](https://en.wikipedia.org/wiki/Fediverse) と呼ばれる同じ宇宙に接続されています。
リンクアグリゲーターの場合、あるサーバーに登録したユーザーが他のサーバーのフォーラムを購読し、他のサーバーに登録したユーザーとディスカッションができることを意味します。
Reddit や他のリンクアグリゲーターに代わる、企業の支配や干渉を受けない、簡単にセルフホスティングできる分散型の代替手段です。
各 Lemmy サーバーは、独自のモデレーションポリシーを設定することができます。サイト全体の管理者やコミュニティモデレーターを任命し、荒らしを排除し、誰もが安心して貢献できる健全で毒気のない環境を育みます。
### なぜ Lemmy というのか?
- [Motörhead](https://invidio.us/watch?v=3mbvWn1EY6g) のリードシンガー。
- 古くは[ビデオゲーム](<https://en.wikipedia.org/wiki/Lemmings_(video_game)>)。
- [スーパーマリオのクッパ](https://www.mariowiki.com/Lemmy_Koopa)。
- [毛むくじゃらの齧歯類](http://sunchild.fpwc.org/lemming-the-little-giant-of-the-north/)。
### こちらでビルド
- [Rust](https://www.rust-lang.org)
- [Actix](https://actix.rs/)
- [Diesel](http://diesel.rs/)
- [Inferno](https://infernojs.org)
- [Typescript](https://www.typescriptlang.org/)
## 特徴
- オープンソース、[AGPL License](/LICENSE) です。
- セルフホスティングが可能で、デプロイが容易です。
- [Docker](https://join-lemmy.org/docs/en/administration/install_docker.html) と [Ansible](https://join-lemmy.org/docs/en/administration/install_ansible.html) が付属しています。
- クリーンでモバイルフレンドリーなインターフェイス。
- サインアップに必要なのは、最低限のユーザー名とパスワードのみ!
- ユーザーアバター対応
- ライブ更新のコメントスレッド
- 古い Reddit のような完全な投票スコア `(+/-)`.
- ライト、ダーク、ソラライズなどのテーマがあります。
- オートコンプリートをサポートする絵文字。`:` と入力することでスタート
- ユーザータグは `@` で、コミュニティタグは `!` で入力できます。
- 投稿とコメントの両方で、画像のアップロードが可能です。
- 投稿は、タイトルと自己テキスト、URL、またはそれ以外の任意の組み合わせで構成できます。
- コメントの返信や、タグ付けされたときに、通知します。
- 通知はメールで送ることができます。
- プライベートメッセージのサポート
- i18n / 国際化のサポート
- `All`、`Subscribed`、`Inbox`、`User`、`Community` の RSS / Atom フィードを提供します。
- クロスポストのサポート。
- 新しい投稿を作成する際の _類似投稿検索_。質問/回答コミュニティに最適です。
- モデレーション機能。
- モデレーションのログを公開。
- コミュニティのトップページにスティッキー・ポストを貼ることができます。
- サイト管理者、コミュニティモデレーターの両方が、他のモデレーターを任命することができます。
- 投稿やコメントのロック、削除、復元が可能。
- コミュニティやサイトの利用を禁止したり、禁止を解除したりすることができます。
- サイトとコミュニティを他者に譲渡することができます。
- すべての投稿とコメントを削除し、データを完全に消去することができます。
- NSFW 投稿/コミュニティサポート
- 高いパフォーマンス。
- サーバーは Rust で書かれています。
- フロントエンドは `~80kB` gzipped です。
- arm64 / Raspberry Pi をサポートします。
## インストール
- [Docker](https://join-lemmy.org/docs/en/administration/install_docker.html)
- [Ansible](https://join-lemmy.org/docs/en/administration/install_ansible.html)
## Lemmy プロジェクト
### アプリ
- [lemmy-ui - Lemmy の公式ウェブアプリ](https://github.com/LemmyNet/lemmy-ui)
- [lemmyBB -phpBB をベースにした Lemmy フォーラム UI](https://github.com/LemmyNet/lemmyBB)
- [Jerboa - Lemmy の開発者が作った Android ネイティブアプリ](https://github.com/dessalines/jerboa)
- [Mlem - iOS 用 Lemmy クライアント](https://github.com/buresdv/Mlem)
### ライブラリ
- [lemmy-js-client](https://github.com/LemmyNet/lemmy-js-client)
- [lemmy-rust-client](https://github.com/LemmyNet/lemmy/tree/main/crates/api_common)
- [go-lemmy](https://gitea.arsenm.dev/Arsen6331/go-lemmy)
- [Dart API client](https://github.com/LemmurOrg/lemmy_api_client)
- [Lemmy-Swift-Client](https://github.com/rrainn/Lemmy-Swift-Client)
- [Reddit -> Lemmy Importer](https://github.com/rileynull/RedditLemmyImporter)
- [lemmy-bot - Lemmy のボットを簡単に作るための Typescript ライブラリ](https://github.com/SleeplessOne1917/lemmy-bot)
- [Lemmy の Reddit API ラッパー](https://github.com/derivator/tafkars)
- [Pythörhead - Lemmy API と統合するための Python パッケージ](https://pypi.org/project/pythorhead/)
## サポート / 寄付
Lemmy はフリーでオープンソースのソフトウェアです。つまり、広告やマネタイズ、ベンチャーキャピタルは一切ありません。あなたの寄付は、直接プロジェクトのフルタイム開発をサポートします。
- [Liberapay でのサポート](https://liberapay.com/Lemmy)。
- [Patreon でのサポート](https://www.patreon.com/dessalines)。
- [OpenCollective でのサポート](https://opencollective.com/lemmy)。
- [スポンサーのリスト](https://join-lemmy.org/donate)。
### 暗号通貨
- bitcoin: `1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK`
- ethereum: `0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01`
- monero: `41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV`
- cardano: `addr1q858t89l2ym6xmrugjs0af9cslfwvnvsh2xxp6x4dcez7pf5tushkp4wl7zxfhm2djp6gq60dk4cmc7seaza5p3slx0sakjutm`
## コントリビュート
- [コントリビュート手順](https://join-lemmy.org/docs/en/contributors/01-overview.html)
- [Docker 開発](https://join-lemmy.org/docs/en/contributors/03-docker-development.html)
- [Local 開発](https://join-lemmy.org/docs/en/contributors/02-local-development.html)
### 翻訳について
- 翻訳を手伝いたい方は、[Weblate](https://weblate.join-lemmy.org/projects/lemmy/) を見てみてください。また、[ドキュメントを翻訳する](https://github.com/LemmyNet/lemmy-docs#adding-a-new-language)ことでも支援できます。
## お問い合わせ
- [Mastodon](https://mastodon.social/@LemmyDev)
- [Lemmy サポートフォーラム](https://lemmy.ml/c/lemmy_support)
## コードのミラー
- [GitHub](https://github.com/LemmyNet/lemmy)
- [Gitea](https://git.join-lemmy.org/LemmyNet/lemmy)
- [Codeberg](https://codeberg.org/LemmyNet/lemmy)
## クレジット
ロゴは Andy Cuccaro (@andycuccaro) が CC-BY-SA 4.0 ライセンスで作成しました。

View file

@ -13,10 +13,11 @@
<p align="center">
<a href="../README.md">English</a> |
<a href="README.ru.md">Español</a> |
<a href="README.es.md">Español</a> |
<span>Русский</span> |
<a href="README.zh.hans.md">汉语</a> |
<a href="README.zh.hant.md">漢語</a>
<a href="README.zh.hant.md">漢語</a> |
<a href="README.ja.md">日本語</a>
</p>
<p align="center">

View file

@ -16,7 +16,8 @@
<a href="README.es.md">Español</a> |
<a href="README.ru.md">Русский</a> |
<span>汉语</span> |
<a href="README.zh.hant.md">漢語</a>
<a href="README.zh.hant.md">漢語</a> |
<a href="README.ja.md">日本語</a>
</p>
<p align="center">

View file

@ -17,7 +17,8 @@
<a href="README.es.md">Español</a> |
<a href="README.ru.md">Русский</a> |
<a href="README.zh.hans.md">汉语</a> |
<span>漢語</span>
<span>漢語</span> |
<a href="README.ja.md">日本語</a>
</p>
<p align="center">

View file

@ -17,9 +17,7 @@ cargo clippy --workspace --fix --allow-staged --allow-dirty --tests --all-target
-D clippy::get_first \
-D clippy::explicit_into_iter_loop \
-D clippy::explicit_iter_loop \
-D clippy::needless_collect
cargo clippy --workspace --features console -- \
-D clippy::needless_collect \
-D clippy::unwrap_used \
-D clippy::indexing_slicing

View file

@ -163,7 +163,7 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> {
let prom_api_metrics = PrometheusMetricsBuilder::new("lemmy_api")
.registry(default_registry().clone())
.build()
.unwrap();
.expect("Should always be buildable");
// Create Http server with websocket support
HttpServer::new(move || {

View file

@ -1,3 +1,5 @@
// TODO: should really not unwrap everywhere here....
#![allow(clippy::unwrap_used)]
use actix_web::{rt::System, web, App, HttpResponse, HttpServer, Responder};
use lemmy_api_common::context::LemmyContext;
use lemmy_utils::settings::structs::PrometheusConfig;

View file

@ -401,6 +401,9 @@ fn update_instance_software(conn: &mut PgConnection, user_agent: &str) -> LemmyR
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
#![allow(clippy::indexing_slicing)]
use lemmy_routes::nodeinfo::NodeInfo;
use reqwest::Client;