Fixing a few view's saved columns to use the optional datetime. (#5402)

- Also adds some comments for them, since its a nullable string
  in the generated types.
This commit is contained in:
Dessalines 2025-02-07 07:51:32 -05:00 committed by GitHub
parent 865f0734ba
commit f0b00ccf94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 31 additions and 17 deletions

View file

@ -293,7 +293,7 @@ impl InboxCombinedQuery {
post_aggregates::comments,
)
.nullable(),
post_actions::saved.nullable().is_not_null(),
post_actions::saved.nullable(),
post_actions::read.nullable().is_not_null(),
post_actions::hidden.nullable().is_not_null(),
post_actions::like_score.nullable(),
@ -305,7 +305,7 @@ impl InboxCombinedQuery {
community::all_columns.nullable(),
comment::all_columns.nullable(),
comment_aggregates::all_columns.nullable(),
comment_actions::saved.nullable().is_not_null(),
comment_actions::saved.nullable(),
comment_actions::like_score.nullable(),
CommunityFollower::select_subscribed_type(),
person::all_columns,

View file

@ -281,7 +281,7 @@ impl ReportCombinedQuery {
post_aggregates::comments,
)
.nullable(),
post_actions::saved.nullable().is_not_null(),
post_actions::saved.nullable(),
post_actions::read.nullable().is_not_null(),
post_actions::hidden.nullable().is_not_null(),
post_actions::like_score.nullable(),
@ -289,7 +289,7 @@ impl ReportCombinedQuery {
comment_report::all_columns.nullable(),
comment::all_columns.nullable(),
comment_aggregates::all_columns.nullable(),
comment_actions::saved.nullable().is_not_null(),
comment_actions::saved.nullable(),
comment_actions::like_score.nullable(),
// Private-message-specific
private_message_report::all_columns.nullable(),

View file

@ -135,7 +135,7 @@ impl CommentView {
creator_is_moderator: self.creator_is_moderator,
creator_is_admin: self.creator_is_admin,
subscribed: self.subscribed,
saved: self.saved.is_some(),
saved: self.saved,
creator_blocked: self.creator_blocked,
my_vote: self.my_vote,
}

View file

@ -136,7 +136,7 @@ impl CommentReportView {
local_user::admin.nullable().is_not_null(),
person_actions::blocked.nullable().is_not_null(),
CommunityFollower::select_subscribed_type(),
comment_actions::saved.nullable().is_not_null(),
comment_actions::saved.nullable(),
comment_actions::like_score.nullable(),
aliases::person2.fields(person::all_columns).nullable(),
))

View file

@ -120,7 +120,7 @@ impl PostReportView {
.is_not_null(),
local_user::admin.nullable().is_not_null(),
CommunityFollower::select_subscribed_type(),
post_actions::saved.nullable().is_not_null(),
post_actions::saved.nullable(),
post_actions::read.nullable().is_not_null(),
post_actions::hidden.nullable().is_not_null(),
person_actions::blocked.nullable().is_not_null(),

View file

@ -103,7 +103,9 @@ pub struct CommentReportView {
pub creator_is_admin: bool,
pub creator_blocked: bool,
pub subscribed: SubscribedType,
pub saved: bool,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the comment was saved.
pub saved: Option<DateTime<Utc>>,
#[cfg_attr(feature = "full", ts(optional))]
pub my_vote: Option<i16>,
#[cfg_attr(feature = "full", ts(optional))]
@ -182,6 +184,7 @@ pub struct CommentView {
comment_actions::saved.nullable()
)
)]
/// The time when the comment was saved.
pub saved: Option<DateTime<Utc>>,
#[cfg_attr(feature = "full",
diesel(
@ -215,7 +218,9 @@ pub struct CommentSlimView {
pub creator_is_moderator: bool,
pub creator_is_admin: bool,
pub subscribed: SubscribedType,
pub saved: bool,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the comment was saved.
pub saved: Option<DateTime<Utc>>,
pub creator_blocked: bool,
#[cfg_attr(feature = "full", ts(optional))]
pub my_vote: Option<i16>,
@ -269,7 +274,9 @@ pub struct PostReportView {
pub creator_is_moderator: bool,
pub creator_is_admin: bool,
pub subscribed: SubscribedType,
pub saved: bool,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the post was saved.
pub saved: Option<DateTime<Utc>>,
pub read: bool,
pub hidden: bool,
pub creator_blocked: bool,
@ -327,6 +334,7 @@ pub struct PostView {
pub counts: PostAggregates,
pub subscribed: SubscribedType,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the post was saved.
pub saved: Option<DateTime<Utc>>,
pub read: bool,
pub hidden: bool,
@ -436,7 +444,7 @@ pub struct ReportCombinedViewInternal {
pub post: Option<Post>,
pub post_counts: Option<PostAggregates>,
pub post_unread_comments: Option<i64>,
pub post_saved: bool,
pub post_saved: Option<DateTime<Utc>>,
pub post_read: bool,
pub post_hidden: bool,
pub my_post_vote: Option<i16>,
@ -444,7 +452,7 @@ pub struct ReportCombinedViewInternal {
pub comment_report: Option<CommentReport>,
pub comment: Option<Comment>,
pub comment_counts: Option<CommentAggregates>,
pub comment_saved: bool,
pub comment_saved: Option<DateTime<Utc>>,
pub my_comment_vote: Option<i16>,
// Private-message-specific
pub private_message_report: Option<PrivateMessageReport>,
@ -623,7 +631,9 @@ pub struct PersonCommentMentionView {
pub creator_is_moderator: bool,
pub creator_is_admin: bool,
pub subscribed: SubscribedType,
pub saved: bool,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the comment was saved.
pub saved: Option<DateTime<Utc>>,
pub creator_blocked: bool,
#[cfg_attr(feature = "full", ts(optional))]
pub my_vote: Option<i16>,
@ -649,7 +659,9 @@ pub struct PersonPostMentionView {
pub creator_is_moderator: bool,
pub creator_is_admin: bool,
pub subscribed: SubscribedType,
pub saved: bool,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the post was saved.
pub saved: Option<DateTime<Utc>>,
pub read: bool,
pub hidden: bool,
pub creator_blocked: bool,
@ -678,7 +690,9 @@ pub struct CommentReplyView {
pub creator_is_moderator: bool,
pub creator_is_admin: bool,
pub subscribed: SubscribedType,
pub saved: bool,
#[cfg_attr(feature = "full", ts(optional))]
/// The time when the comment was saved.
pub saved: Option<DateTime<Utc>>,
pub creator_blocked: bool,
#[cfg_attr(feature = "full", ts(optional))]
pub my_vote: Option<i16>,
@ -752,7 +766,7 @@ pub struct InboxCombinedViewInternal {
pub person_post_mention: Option<PersonPostMention>,
pub post_counts: Option<PostAggregates>,
pub post_unread_comments: Option<i64>,
pub post_saved: bool,
pub post_saved: Option<DateTime<Utc>>,
pub post_read: bool,
pub post_hidden: bool,
pub my_post_vote: Option<i16>,
@ -765,7 +779,7 @@ pub struct InboxCombinedViewInternal {
pub community: Option<Community>,
pub comment: Option<Comment>,
pub comment_counts: Option<CommentAggregates>,
pub comment_saved: bool,
pub comment_saved: Option<DateTime<Utc>>,
pub my_comment_vote: Option<i16>,
pub subscribed: SubscribedType,
pub item_creator: Person,