-
-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/custom emoji and tagline views #4580
Merged
dessalines
merged 38 commits into
LemmyNet:main
from
fvanzee:feature/custom-emoji-and-tagline-views
Sep 19, 2024
Merged
Changes from 30 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
fd27523
Add custom_emoji list route
b4a8615
Add tagline list route
10a8f01
Apply linting
17e2834
Remove unecessary TaglineView
486c746
Add category filter for custom emoji
a1a7e2c
Add create tagline endpoint
ab93806
Add update tagline endpoint
e536d39
Add delete tagline endpoint
5358908
Format through lint.sh
2b1fdf1
Remove custom_emojis and taglines from site resource
f1b993f
Get random tagline on site requets
144c112
Impl Crud for Tagline
5342a22
Move tagline endpoints under /admin
bab417a
Impl Crud for CustomEmoji
ead5151
Remove delete from tagline and custom emoji impls
abdfc90
Check markdown for tagline
b2b8c43
Validate markdown on tagline
55be9a1
Merge branch 'main' into feature/custom-emoji-and-tagline-views
SleeplessOne1917 7759602
Make content fields non optional
6ffcc1f
Use process_markdown instead of process_markdown_opt
5cf15a4
Merge branch 'main' into feature/custom-emoji-and-tagline-views
SleeplessOne1917 7ce89fb
Consolidate Tagline error types
fvanzee 8c7b300
Remove unecessary clone
fvanzee 562c909
Updat misleading comments
fvanzee 6935acb
Remove local_site_id from tagline and custom_emoji
fvanzee 999e984
Update TaglineInserForm and TaglineUpdateForm
fvanzee 1f629cc
Add ignore_page_limits for custom emojis
fvanzee 4771085
Update custom_emoji_view
fvanzee 920adcc
Merge branch 'main' into feature/custom-emoji-and-tagline-views
fvanzee e96d0be
Merge remote-tracking branch 'origin/main' into custom_emoji_dess
dessalines 004b1b2
Removing pointless get_all fn.
dessalines e09e54e
remove tagline length checks
Nutomic 215ebf7
make fields of TaglineInsertForm and TaglineUpdateForm mandatory
Nutomic 2de4503
move emoji order statement
Nutomic 18a4cf9
add comment for GetSiteResponse.tagline
Nutomic e4e18fe
Merge remote-tracking branch 'origin/main' into custom_emoji_dess
dessalines 8076dd8
Adding a default_comment_sort_type column for local_site and local_us…
dessalines afe5ff6
Simplify tests using default (#5026)
Nutomic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use lemmy_db_schema::{newtypes::TaglineId, source::tagline::Tagline}; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_with::skip_serializing_none; | ||
#[cfg(feature = "full")] | ||
use ts_rs::TS; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Create a tagline | ||
pub struct CreateTagline { | ||
pub content: String, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Update a tagline | ||
pub struct UpdateTagline { | ||
pub id: TaglineId, | ||
pub content: String, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Delete a tagline | ||
pub struct DeleteTagline { | ||
pub id: TaglineId, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
pub struct TaglineResponse { | ||
pub tagline: Tagline, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// A response for taglines. | ||
pub struct ListTaglinesResponse { | ||
pub taglines: Vec<Tagline>, | ||
} | ||
|
||
#[skip_serializing_none] | ||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)] | ||
#[cfg_attr(feature = "full", derive(TS))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
/// Fetches a list of taglines. | ||
pub struct ListTaglines { | ||
pub page: Option<i64>, | ||
pub limit: Option<i64>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use actix_web::web::{Data, Json, Query}; | ||
use lemmy_api_common::{ | ||
context::LemmyContext, | ||
custom_emoji::{ListCustomEmojis, ListCustomEmojisResponse}, | ||
}; | ||
use lemmy_db_views::structs::{CustomEmojiView, LocalUserView}; | ||
use lemmy_utils::error::LemmyError; | ||
|
||
#[tracing::instrument(skip(context))] | ||
pub async fn list_custom_emojis( | ||
data: Query<ListCustomEmojis>, | ||
local_user_view: Option<LocalUserView>, | ||
context: Data<LemmyContext>, | ||
) -> Result<Json<ListCustomEmojisResponse>, LemmyError> { | ||
let custom_emojis = CustomEmojiView::list( | ||
&mut context.pool(), | ||
&data.category, | ||
data.page, | ||
data.limit, | ||
data.ignore_page_limits.unwrap_or(false), | ||
) | ||
.await?; | ||
|
||
Ok(Json(ListCustomEmojisResponse { custom_emojis })) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod create; | ||
pub mod delete; | ||
pub mod list; | ||
pub mod update; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ pub mod custom_emoji; | |
pub mod post; | ||
pub mod private_message; | ||
pub mod site; | ||
pub mod tagline; | ||
pub mod user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makotech222 look into your emoji library, because these may need a search term, optional category, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a category search parameter. This column is also already indexed