mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 11:13:51 +00:00
Rename timestamp fields to _at
(#5761)
* Adding migration for renaming timestamps to at * Running format. * Updating code to _at * Fix replaceable schema * Fixing scheduled tasks. * Fixing and cleaning up api tests. * Fixing cargo shear.
This commit is contained in:
parent
0ba6b01195
commit
398c9ec967
142 changed files with 1436 additions and 987 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -3415,12 +3415,9 @@ dependencies = [
|
|||
"extism-convert",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_post",
|
||||
"serde",
|
||||
"serde_with",
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"eslint-plugin-prettier": "^5.4.0",
|
||||
"jest": "^29.5.0",
|
||||
"joi": "^17.13.3",
|
||||
"lemmy-js-client": "1.0.0-search-and-resolve.1",
|
||||
"lemmy-js-client": "1.0.0-rename-timestamp-to-at.4",
|
||||
"prettier": "^3.5.3",
|
||||
"ts-jest": "^29.3.2",
|
||||
"tsoa": "^6.6.0",
|
||||
|
|
|
@ -36,8 +36,8 @@ importers:
|
|||
specifier: ^17.13.3
|
||||
version: 17.13.3
|
||||
lemmy-js-client:
|
||||
specifier: 1.0.0-search-and-resolve.1
|
||||
version: 1.0.0-search-and-resolve.1
|
||||
specifier: 1.0.0-rename-timestamp-to-at.4
|
||||
version: 1.0.0-rename-timestamp-to-at.4
|
||||
prettier:
|
||||
specifier: ^3.5.3
|
||||
version: 3.5.3
|
||||
|
@ -1594,8 +1594,8 @@ packages:
|
|||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
lemmy-js-client@1.0.0-search-and-resolve.1:
|
||||
resolution: {integrity: sha512-HRbti+FmZEMdSu1gbpcmT/GwsH2MeLq60dXcAXaYa5j0QOlFuUy2TejO01vqqJva7EZ4YIJPZS+pbQ4Y/Y/V2A==}
|
||||
lemmy-js-client@1.0.0-rename-timestamp-to-at.4:
|
||||
resolution: {integrity: sha512-tEp92LODxqLIyru7qaMFVuXEmsusSDzG2V7QYctBYGfbJzsoUEogtuI9Gla5MlL6lT9l/hOLSv/ujqxdS0FLAg==}
|
||||
|
||||
leven@3.1.0:
|
||||
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
|
||||
|
@ -4404,7 +4404,7 @@ snapshots:
|
|||
|
||||
kleur@3.0.3: {}
|
||||
|
||||
lemmy-js-client@1.0.0-search-and-resolve.1:
|
||||
lemmy-js-client@1.0.0-rename-timestamp-to-at.4:
|
||||
dependencies:
|
||||
'@tsoa/runtime': 6.6.0
|
||||
transitivePeerDependencies:
|
||||
|
|
|
@ -44,6 +44,7 @@ import {
|
|||
CommentView,
|
||||
CommunityView,
|
||||
DistinguishComment,
|
||||
LemmyError,
|
||||
PersonCommentMentionView,
|
||||
ReportCombinedView,
|
||||
SaveUserSettings,
|
||||
|
@ -71,8 +72,10 @@ function assertCommentFederation(
|
|||
expect(commentOne?.comment.content).toBe(commentTwo?.comment.content);
|
||||
expect(commentOne?.creator.name).toBe(commentTwo?.creator.name);
|
||||
expect(commentOne?.community.ap_id).toBe(commentTwo?.community.ap_id);
|
||||
expect(commentOne?.comment.published).toBe(commentTwo?.comment.published);
|
||||
expect(commentOne?.comment.updated).toBe(commentOne?.comment.updated);
|
||||
expect(commentOne?.comment.published_at).toBe(
|
||||
commentTwo?.comment.published_at,
|
||||
);
|
||||
expect(commentOne?.comment.updated_at).toBe(commentOne?.comment.updated_at);
|
||||
expect(commentOne?.comment.deleted).toBe(commentOne?.comment.deleted);
|
||||
expect(commentOne?.comment.removed).toBe(commentOne?.comment.removed);
|
||||
}
|
||||
|
@ -87,7 +90,7 @@ test("Create a comment", async () => {
|
|||
// Make sure that comment is liked on beta
|
||||
let betaComment = await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.score === 1,
|
||||
c => c?.comment.score === 1,
|
||||
);
|
||||
expect(betaComment).toBeDefined();
|
||||
expect(betaComment?.community.local).toBe(true);
|
||||
|
@ -98,7 +101,7 @@ test("Create a comment", async () => {
|
|||
|
||||
test("Create a comment in a non-existent post", async () => {
|
||||
await expect(createComment(alpha, -1)).rejects.toStrictEqual(
|
||||
Error("not_found"),
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -121,7 +124,7 @@ test("Update a comment", async () => {
|
|||
// Make sure that post is updated on beta
|
||||
let betaCommentUpdated = await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.content === "A jest test federated comment update",
|
||||
c => c?.comment.content === "A jest test federated comment update",
|
||||
);
|
||||
assertCommentFederation(betaCommentUpdated, updateCommentRes.comment_view);
|
||||
});
|
||||
|
@ -132,9 +135,7 @@ test("Delete a comment", async () => {
|
|||
let commentRes = await createComment(alpha, post.post_view.post.id);
|
||||
|
||||
// Find the comment on beta (home of community)
|
||||
let betaComment = (
|
||||
await resolveComment(beta, commentRes.comment_view.comment)
|
||||
).comment;
|
||||
let betaComment = await resolveComment(beta, commentRes.comment_view.comment);
|
||||
if (!betaComment) {
|
||||
throw "Missing beta comment before delete";
|
||||
}
|
||||
|
@ -161,13 +162,13 @@ test("Delete a comment", async () => {
|
|||
// Make sure that comment is deleted on beta
|
||||
await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.deleted === true,
|
||||
c => c?.comment.deleted === true,
|
||||
);
|
||||
|
||||
// Make sure that comment is deleted on gamma after delete
|
||||
await waitUntil(
|
||||
() => resolveComment(gamma, commentRes.comment_view.comment),
|
||||
c => c.comment.deleted === true,
|
||||
c => c?.comment.deleted === true,
|
||||
);
|
||||
|
||||
// Test undeleting the comment
|
||||
|
@ -181,7 +182,7 @@ test("Delete a comment", async () => {
|
|||
// Make sure that comment is undeleted on beta
|
||||
let betaComment2 = await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.deleted === false,
|
||||
c => c?.comment.deleted === false,
|
||||
);
|
||||
assertCommentFederation(betaComment2, undeleteCommentRes.comment_view);
|
||||
});
|
||||
|
@ -192,7 +193,7 @@ test.skip("Remove a comment from admin and community on the same instance", asyn
|
|||
// Get the id for beta
|
||||
let betaCommentId = (
|
||||
await resolveComment(beta, commentRes.comment_view.comment)
|
||||
).comment.id;
|
||||
)?.comment.id;
|
||||
|
||||
if (!betaCommentId) {
|
||||
throw "beta comment id is missing";
|
||||
|
@ -282,7 +283,7 @@ test("Unlike a comment", async () => {
|
|||
|
||||
let gammaComment1 = await waitUntil(
|
||||
() => resolveComment(gamma, commentRes.comment_view.comment),
|
||||
c => c.comment.score === 1,
|
||||
c => c?.comment.score === 1,
|
||||
);
|
||||
expect(gammaComment1).toBeDefined();
|
||||
expect(gammaComment1?.community.local).toBe(false);
|
||||
|
@ -295,7 +296,7 @@ test("Unlike a comment", async () => {
|
|||
// Make sure that comment is unliked on beta
|
||||
let betaComment = await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.score === 0,
|
||||
c => c?.comment.score === 0,
|
||||
);
|
||||
expect(betaComment).toBeDefined();
|
||||
expect(betaComment?.community.local).toBe(true);
|
||||
|
@ -306,7 +307,7 @@ test("Unlike a comment", async () => {
|
|||
// This is testing replication from remote-home-remote (alpha-beta-gamma)
|
||||
let gammaComment = await waitUntil(
|
||||
() => resolveComment(gamma, commentRes.comment_view.comment),
|
||||
c => c.comment.score === 0,
|
||||
c => c?.comment.score === 0,
|
||||
);
|
||||
expect(gammaComment).toBeDefined();
|
||||
expect(gammaComment?.community.local).toBe(false);
|
||||
|
@ -318,7 +319,7 @@ test("Federated comment like", async () => {
|
|||
let commentRes = await createComment(alpha, postOnAlphaRes.post_view.post.id);
|
||||
await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.score === 1,
|
||||
c => c?.comment.score === 1,
|
||||
);
|
||||
// Find the comment on beta
|
||||
let betaComment = await resolveComment(beta, commentRes.comment_view.comment);
|
||||
|
@ -343,7 +344,7 @@ test("Reply to a comment from another instance, get notification", async () => {
|
|||
|
||||
let betaCommunity = await waitUntil(
|
||||
() => resolveBetaCommunity(alpha),
|
||||
c => !!c.community.instance_id,
|
||||
c => !!c?.community.instance_id,
|
||||
);
|
||||
if (!betaCommunity) {
|
||||
throw "Missing beta community";
|
||||
|
@ -356,7 +357,7 @@ test("Reply to a comment from another instance, get notification", async () => {
|
|||
// find that comment id on beta
|
||||
let betaComment = await waitUntil(
|
||||
() => resolveComment(beta, commentRes.comment_view.comment),
|
||||
c => c.comment.score === 1,
|
||||
c => c?.comment.score === 1,
|
||||
);
|
||||
|
||||
if (!betaComment) {
|
||||
|
@ -378,10 +379,11 @@ test("Reply to a comment from another instance, get notification", async () => {
|
|||
expect(replyRes.comment_view.comment.score).toBe(1);
|
||||
|
||||
// Make sure that reply comment is seen on alpha
|
||||
let alphaComment = await waitUntil(
|
||||
let commentSearch = await waitUntil(
|
||||
() => resolveComment(alpha, replyRes.comment_view.comment),
|
||||
c => c.comment.score === 1,
|
||||
c => c?.comment.score === 1,
|
||||
);
|
||||
let alphaComment = commentSearch!;
|
||||
let postComments = await waitUntil(
|
||||
() => getComments(alpha, postOnAlphaRes.post_view.post.id),
|
||||
pc => pc.comments.length >= 2,
|
||||
|
@ -557,13 +559,13 @@ test("A and G subscribe to B (center) A posts, G mentions B, it gets announced t
|
|||
beta,
|
||||
alphaCommunity.community.ap_id,
|
||||
);
|
||||
await followCommunity(beta, true, betaCommunity.community.id);
|
||||
await followCommunity(beta, true, betaCommunity!.community.id);
|
||||
|
||||
let alphaPost = await createPost(alpha, alphaCommunity.community.id);
|
||||
expect(alphaPost.post_view.community.local).toBe(true);
|
||||
|
||||
// Make sure gamma sees it
|
||||
let gammaPost = (await resolvePost(gamma, alphaPost.post_view.post))!;
|
||||
let gammaPost = await resolvePost(gamma, alphaPost.post_view.post);
|
||||
|
||||
if (!gammaPost) {
|
||||
throw "Missing gamma post";
|
||||
|
@ -627,11 +629,11 @@ test("Check that activity from another instance is sent to third instance", asyn
|
|||
expect(gammaFollow.community_view.community.name).toBe("main");
|
||||
await waitUntil(
|
||||
() => resolveBetaCommunity(alpha),
|
||||
c => c.community_actions?.follow_state === "Accepted",
|
||||
c => c?.community_actions?.follow_state === "Accepted",
|
||||
);
|
||||
await waitUntil(
|
||||
() => resolveBetaCommunity(gamma),
|
||||
c => c.community_actions?.follow_state === "Accepted",
|
||||
c => c?.community_actions?.follow_state === "Accepted",
|
||||
);
|
||||
|
||||
// Create a post on beta
|
||||
|
@ -771,14 +773,15 @@ test("Report a comment", async () => {
|
|||
.comment;
|
||||
expect(commentRes).toBeDefined();
|
||||
|
||||
let alphaComment = (await resolveComment(alpha, commentRes)).comment;
|
||||
let alphaComment = await resolveComment(alpha, commentRes);
|
||||
if (!alphaComment) {
|
||||
throw "Missing alpha comment";
|
||||
}
|
||||
|
||||
const reason = randomString(10);
|
||||
let alphaReport = (await reportComment(alpha, alphaComment.id, reason))
|
||||
.comment_report_view.comment_report;
|
||||
let alphaReport = (
|
||||
await reportComment(alpha, alphaComment.comment.id, reason)
|
||||
).comment_report_view.comment_report;
|
||||
|
||||
let betaReport = (
|
||||
(await waitUntil(
|
||||
|
@ -863,13 +866,13 @@ test("Fetch a deeply nested comment", async () => {
|
|||
lastComment!.comment_view.comment,
|
||||
);
|
||||
|
||||
expect(betaComment!.comment).toBeDefined();
|
||||
expect(betaComment?.comment).toBeDefined();
|
||||
expect(betaComment?.post).toBeDefined();
|
||||
});
|
||||
|
||||
test("Distinguish comment", async () => {
|
||||
const community = await resolveBetaCommunity(beta);
|
||||
let post = await createPost(beta, community!.community.id);
|
||||
const community = (await resolveBetaCommunity(beta))?.community;
|
||||
let post = await createPost(beta, community!.id);
|
||||
let commentRes = await createComment(beta, post.post_view.post.id);
|
||||
const form: DistinguishComment = {
|
||||
comment_id: commentRes.comment_view.comment.id,
|
||||
|
|
|
@ -42,6 +42,7 @@ import {
|
|||
CommunityReportView,
|
||||
EditCommunity,
|
||||
GetPosts,
|
||||
LemmyError,
|
||||
ReportCombinedView,
|
||||
ResolveCommunityReport,
|
||||
Search,
|
||||
|
@ -62,8 +63,8 @@ function assertCommunityFederation(
|
|||
);
|
||||
expect(communityOne?.community.icon).toBe(communityTwo?.community.icon);
|
||||
expect(communityOne?.community.banner).toBe(communityTwo?.community.banner);
|
||||
expect(communityOne?.community.published).toBe(
|
||||
communityTwo?.community.published,
|
||||
expect(communityOne?.community.published_at).toBe(
|
||||
communityTwo?.community.published_at,
|
||||
);
|
||||
expect(communityOne?.community.nsfw).toBe(communityTwo?.community.nsfw);
|
||||
expect(communityOne?.community.removed).toBe(communityTwo?.community.removed);
|
||||
|
@ -77,7 +78,7 @@ test("Create community", async () => {
|
|||
// A dupe check
|
||||
let prevName = communityRes.community_view.community.name;
|
||||
await expect(createCommunity(alpha, prevName)).rejects.toStrictEqual(
|
||||
Error("community_already_exists"),
|
||||
new LemmyError("community_already_exists"),
|
||||
);
|
||||
|
||||
// Cache the community on beta, make sure it has the other fields
|
||||
|
@ -201,7 +202,7 @@ test("Report a community", async () => {
|
|||
alphaCommunity.community_view.community.ap_id,
|
||||
);
|
||||
let betaReport = (
|
||||
await reportCommunity(beta, betaCommunity.community.id, randomString(10))
|
||||
await reportCommunity(beta, betaCommunity!.community.id, randomString(10))
|
||||
).community_report_view.community_report;
|
||||
expect(betaReport).toBeDefined();
|
||||
|
||||
|
@ -290,7 +291,7 @@ test("Admin actions in remote community are not federated to origin", async () =
|
|||
await followCommunity(gamma, true, gammaCommunity.community.id);
|
||||
gammaCommunity = await waitUntil(
|
||||
() => resolveCommunity(gamma, communityRes.community.ap_id),
|
||||
g => g.community_actions?.follow_state == "Accepted",
|
||||
g => g?.community_actions?.follow_state == "Accepted",
|
||||
);
|
||||
if (!gammaCommunity) {
|
||||
throw "Missing gamma community";
|
||||
|
@ -299,7 +300,7 @@ test("Admin actions in remote community are not federated to origin", async () =
|
|||
let gammaPost = (await createPost(gamma, gammaCommunity.community.id))
|
||||
.post_view;
|
||||
expect(gammaPost.post.id).toBeDefined();
|
||||
expect(gammaPost.creator_community_actions?.received_ban).toBeUndefined();
|
||||
expect(gammaPost.creator_community_actions?.received_ban_at).toBeUndefined();
|
||||
|
||||
// admin of beta decides to ban gamma from community
|
||||
let betaCommunity = await resolveCommunity(
|
||||
|
@ -314,6 +315,7 @@ test("Admin actions in remote community are not federated to origin", async () =
|
|||
throw "Missing banned user 1";
|
||||
}
|
||||
let bannedUserInfo2 = await resolvePerson(beta, bannedUserInfo1.ap_id);
|
||||
|
||||
if (!bannedUserInfo2) {
|
||||
throw "Missing banned user 2";
|
||||
}
|
||||
|
@ -328,12 +330,12 @@ test("Admin actions in remote community are not federated to origin", async () =
|
|||
|
||||
// ban doesn't federate to community's origin instance alpha
|
||||
let alphaPost = await resolvePost(alpha, gammaPost.post);
|
||||
expect(alphaPost?.creator_community_actions?.received_ban).toBeUndefined();
|
||||
expect(alphaPost?.creator_community_actions?.received_ban_at).toBeUndefined();
|
||||
|
||||
// and neither to gamma
|
||||
let gammaPost2 = await getPost(gamma, gammaPost.post.id);
|
||||
expect(
|
||||
gammaPost2.post_view.creator_community_actions?.received_ban,
|
||||
gammaPost2.post_view.creator_community_actions?.received_ban_at,
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -417,7 +419,7 @@ test("Get community for different casing on domain", async () => {
|
|||
// A dupe check
|
||||
let prevName = communityRes.community_view.community.name;
|
||||
await expect(createCommunity(alpha, prevName)).rejects.toStrictEqual(
|
||||
Error("community_already_exists"),
|
||||
new LemmyError("community_already_exists"),
|
||||
);
|
||||
|
||||
// Cache the community on beta, make sure it has the other fields
|
||||
|
@ -439,7 +441,7 @@ test("User blocks instance, communities are hidden", async () => {
|
|||
|
||||
// fetch post to alpha
|
||||
let alphaPost = await resolvePost(alpha, postRes.post_view.post);
|
||||
expect(alphaPost.post).toBeDefined();
|
||||
expect(alphaPost?.post).toBeDefined();
|
||||
|
||||
// post should be included in listing
|
||||
let listing = await getPosts(alpha, "All");
|
||||
|
@ -447,7 +449,7 @@ test("User blocks instance, communities are hidden", async () => {
|
|||
expect(listing_ids).toContain(postRes.post_view.post.ap_id);
|
||||
|
||||
// block the beta instance
|
||||
await userBlockInstance(alpha, alphaPost.community.instance_id, true);
|
||||
await userBlockInstance(alpha, alphaPost!.community.instance_id, true);
|
||||
|
||||
// after blocking, post should not be in listing
|
||||
let listing2 = await getPosts(alpha, "All");
|
||||
|
@ -455,7 +457,7 @@ test("User blocks instance, communities are hidden", async () => {
|
|||
expect(listing_ids2.indexOf(postRes.post_view.post.ap_id)).toBe(-1);
|
||||
|
||||
// unblock instance again
|
||||
await userBlockInstance(alpha, alphaPost.community.instance_id, false);
|
||||
await userBlockInstance(alpha, alphaPost!.community.instance_id, false);
|
||||
|
||||
// post should be included in listing
|
||||
let listing3 = await getPosts(alpha, "All");
|
||||
|
@ -469,14 +471,14 @@ test.skip("Community follower count is federated", async () => {
|
|||
let community = await createCommunity(beta);
|
||||
let communityActorId = community.community_view.community.ap_id;
|
||||
let resolved = await resolveCommunity(alpha, communityActorId);
|
||||
if (!resolved.community) {
|
||||
if (!resolved?.community) {
|
||||
throw "Missing beta community";
|
||||
}
|
||||
|
||||
await followCommunity(alpha, true, resolved.community.id);
|
||||
let followed = await waitUntil(
|
||||
() => resolveCommunity(alpha, communityActorId),
|
||||
c => c.community_actions?.follow_state == "Accepted",
|
||||
c => c?.community_actions?.follow_state == "Accepted",
|
||||
);
|
||||
|
||||
// Make sure there is 1 subscriber
|
||||
|
@ -484,14 +486,14 @@ test.skip("Community follower count is federated", async () => {
|
|||
|
||||
// Follow the community from gamma
|
||||
resolved = await resolveCommunity(gamma, communityActorId);
|
||||
if (!resolved.community) {
|
||||
if (!resolved?.community) {
|
||||
throw "Missing beta community";
|
||||
}
|
||||
|
||||
await followCommunity(gamma, true, resolved.community.id);
|
||||
followed = await waitUntil(
|
||||
() => resolveCommunity(gamma, communityActorId),
|
||||
c => c.community_actions?.follow_state == "Accepted",
|
||||
c => c?.community_actions?.follow_state == "Accepted",
|
||||
);
|
||||
|
||||
// Make sure there are 2 subscribers
|
||||
|
@ -499,18 +501,15 @@ test.skip("Community follower count is federated", async () => {
|
|||
|
||||
// Follow the community from delta
|
||||
resolved = await resolveCommunity(delta, communityActorId);
|
||||
if (!resolved.community) {
|
||||
if (!resolved?.community) {
|
||||
throw "Missing beta community";
|
||||
}
|
||||
|
||||
await followCommunity(delta, true, resolved.community.id);
|
||||
followed = await waitUntil(
|
||||
() => resolveCommunity(delta, communityActorId),
|
||||
c => c.community_actions?.follow_state == "Accepted",
|
||||
c => c?.community_actions?.follow_state == "Accepted",
|
||||
);
|
||||
|
||||
// Make sure there are 3 subscribers
|
||||
expect(followed?.community?.subscribers).toBe(3);
|
||||
});
|
||||
|
||||
test("Dont receive community activities after unsubscribe", async () => {
|
||||
|
@ -589,7 +588,7 @@ test("Fetch community, includes posts", async () => {
|
|||
|
||||
let resolvedCommunity = await waitUntil(
|
||||
() => resolveCommunity(beta, communityRes.community_view.community.ap_id),
|
||||
c => c.community.id != undefined,
|
||||
c => c?.community.id != undefined,
|
||||
);
|
||||
let betaCommunity = resolvedCommunity;
|
||||
expect(betaCommunity?.community.ap_id).toBe(
|
||||
|
@ -615,12 +614,12 @@ test("Content in local-only community doesn't federate", async () => {
|
|||
// cant resolve the community from another instance
|
||||
await expect(
|
||||
resolveCommunity(beta, communityRes.ap_id),
|
||||
).rejects.toStrictEqual(Error("not_found"));
|
||||
).rejects.toStrictEqual(new LemmyError("not_found"));
|
||||
|
||||
// create a post, also cant resolve it
|
||||
let postRes = await createPost(alpha, communityRes.id);
|
||||
await expect(resolvePost(beta, postRes.post_view.post)).rejects.toStrictEqual(
|
||||
Error("not_found"),
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -631,14 +630,14 @@ test("Remote mods can edit communities", async () => {
|
|||
beta,
|
||||
communityRes.community_view.community.ap_id,
|
||||
);
|
||||
if (!betaCommunity.community) {
|
||||
if (!betaCommunity?.community) {
|
||||
throw "Missing beta community";
|
||||
}
|
||||
let betaOnAlpha = await resolvePerson(alpha, "lemmy_beta@lemmy-beta:8551");
|
||||
|
||||
let form: AddModToCommunity = {
|
||||
community_id: communityRes.community_view.community.id,
|
||||
person_id: betaOnAlpha.person.id as number,
|
||||
person_id: betaOnAlpha?.person.id as number,
|
||||
added: true,
|
||||
};
|
||||
alpha.addModToCommunity(form);
|
||||
|
@ -670,7 +669,7 @@ test("Community name with non-ascii chars", async () => {
|
|||
beta,
|
||||
communityRes.community_view.community.ap_id,
|
||||
);
|
||||
expect(betaCommunity1.community.name).toBe(name);
|
||||
expect(betaCommunity1?.community.name).toBe(name);
|
||||
|
||||
let alphaCommunity2 = await getCommunityByName(alpha, name);
|
||||
expect(alphaCommunity2.community_view.community.name).toBe(name);
|
||||
|
@ -679,7 +678,7 @@ test("Community name with non-ascii chars", async () => {
|
|||
let betaCommunity2 = await getCommunityByName(beta, fediName);
|
||||
expect(betaCommunity2.community_view.community.name).toBe(name);
|
||||
|
||||
let postRes = await createPost(beta, betaCommunity1.community.id);
|
||||
let postRes = await createPost(beta, betaCommunity1!.community.id);
|
||||
|
||||
let form: GetPosts = {
|
||||
community_name: fediName,
|
||||
|
|
|
@ -21,8 +21,8 @@ afterAll(unfollows);
|
|||
test("Follow local community", async () => {
|
||||
let user = await registerUser(beta, betaUrl);
|
||||
|
||||
let community = await resolveBetaCommunity(user)!;
|
||||
let follow = await followCommunity(user, true, community.community.id);
|
||||
let community = await resolveBetaCommunity(user);
|
||||
let follow = await followCommunity(user, true, community!.community.id);
|
||||
|
||||
// Make sure the follow response went through
|
||||
expect(follow.community_view.community.local).toBe(true);
|
||||
|
@ -30,22 +30,22 @@ test("Follow local community", async () => {
|
|||
"Accepted",
|
||||
);
|
||||
expect(follow.community_view.community.subscribers).toBe(
|
||||
community.community.subscribers + 1,
|
||||
community!.community.subscribers + 1,
|
||||
);
|
||||
expect(follow.community_view.community.subscribers_local).toBe(
|
||||
community.community.subscribers_local + 1,
|
||||
community!.community.subscribers_local + 1,
|
||||
);
|
||||
|
||||
// Test an unfollow
|
||||
let unfollow = await followCommunity(user, false, community.community.id);
|
||||
let unfollow = await followCommunity(user, false, community!.community.id);
|
||||
expect(
|
||||
unfollow.community_view.community_actions?.follow_state,
|
||||
).toBeUndefined();
|
||||
expect(unfollow.community_view.community.subscribers).toBe(
|
||||
community.community.subscribers,
|
||||
community?.community.subscribers,
|
||||
);
|
||||
expect(unfollow.community_view.community.subscribers_local).toBe(
|
||||
community.community.subscribers_local,
|
||||
community?.community.subscribers_local,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -54,7 +54,7 @@ test("Follow federated community", async () => {
|
|||
await delay(2000); // if this is the second test run, we don't have a way to wait for the correct number of subscribers
|
||||
const betaCommunityInitial = await waitUntil(
|
||||
() => resolveBetaCommunity(alpha),
|
||||
c => !!c.community && c.community?.subscribers >= 1,
|
||||
c => !!c?.community && c.community.subscribers >= 1,
|
||||
);
|
||||
if (!betaCommunityInitial) {
|
||||
throw "Missing beta community";
|
||||
|
@ -67,7 +67,7 @@ test("Follow federated community", async () => {
|
|||
expect(follow.community_view.community_actions?.follow_state).toBe("Pending");
|
||||
const betaCommunity = await waitUntil(
|
||||
() => resolveBetaCommunity(alpha),
|
||||
c => c.community_actions?.follow_state === "Accepted",
|
||||
c => c?.community_actions?.follow_state === "Accepted",
|
||||
);
|
||||
|
||||
// Make sure the follow response went through
|
||||
|
@ -80,7 +80,7 @@ test("Follow federated community", async () => {
|
|||
|
||||
// check that unfollow was federated
|
||||
let communityOnBeta1 = await resolveBetaCommunity(beta);
|
||||
expect(communityOnBeta1.community.subscribers).toBe(
|
||||
expect(communityOnBeta1?.community.subscribers).toBe(
|
||||
betaCommunityInitial.community.subscribers + 1,
|
||||
);
|
||||
|
||||
|
@ -114,10 +114,11 @@ test("Follow federated community", async () => {
|
|||
// check that unfollow was federated
|
||||
let communityOnBeta2 = await waitUntil(
|
||||
() => resolveBetaCommunity(beta),
|
||||
c => c.community.subscribers === betaCommunityInitial.community.subscribers,
|
||||
c =>
|
||||
c?.community.subscribers === betaCommunityInitial.community.subscribers,
|
||||
);
|
||||
expect(communityOnBeta2.community.subscribers).toBe(
|
||||
expect(communityOnBeta2?.community.subscribers).toBe(
|
||||
betaCommunityInitial.community.subscribers,
|
||||
);
|
||||
expect(communityOnBeta2.community.subscribers_local).toBe(1);
|
||||
expect(communityOnBeta2?.community.subscribers_local).toBe(1);
|
||||
});
|
||||
|
|
|
@ -146,7 +146,7 @@ test("Purge post, linked image removed", async () => {
|
|||
expect(content.length).toBeGreaterThan(0);
|
||||
|
||||
let community = await resolveBetaCommunity(user);
|
||||
let post = await createPost(user, community.community.id, upload.image_url);
|
||||
let post = await createPost(user, community!.community.id, upload.image_url);
|
||||
expect(post.post_view.post.url).toBe(upload.image_url);
|
||||
expect(post.post_view.image_details).toBeDefined();
|
||||
|
||||
|
@ -191,12 +191,12 @@ test("Images in remote image post are proxied if setting enabled", async () => {
|
|||
expect(post.thumbnail_url?.includes(".jpg")).toBeTruthy();
|
||||
|
||||
let epsilonPostRes = await resolvePost(epsilon, postRes.post_view.post);
|
||||
expect(epsilonPostRes.post).toBeDefined();
|
||||
expect(epsilonPostRes?.post).toBeDefined();
|
||||
|
||||
// Fetch the post again, the metadata should be backgrounded now
|
||||
// Wait for the metadata to get fetched, since this is backgrounded now
|
||||
let epsilonPostRes2 = await waitUntil(
|
||||
() => getPost(epsilon, epsilonPostRes.post.id),
|
||||
() => getPost(epsilon, epsilonPostRes!.post.id),
|
||||
p => p.post_view.post.thumbnail_url != undefined,
|
||||
);
|
||||
const epsilonPost = epsilonPostRes2.post_view.post;
|
||||
|
@ -238,10 +238,10 @@ test("Thumbnail of remote image link is proxied if setting enabled", async () =>
|
|||
expect(post.thumbnail_url?.includes(".png")).toBeTruthy();
|
||||
|
||||
let epsilonPostRes = await resolvePost(epsilon, postRes.post_view.post);
|
||||
expect(epsilonPostRes.post).toBeDefined();
|
||||
expect(epsilonPostRes?.post).toBeDefined();
|
||||
|
||||
let epsilonPostRes2 = await waitUntil(
|
||||
() => getPost(epsilon, epsilonPostRes.post.id),
|
||||
() => getPost(epsilon, epsilonPostRes!.post.id),
|
||||
p => p.post_view.post.thumbnail_url != undefined,
|
||||
);
|
||||
const epsilonPost = epsilonPostRes2.post_view.post;
|
||||
|
@ -263,7 +263,7 @@ test("No image proxying if setting is disabled", async () => {
|
|||
beta,
|
||||
community.community_view.community.ap_id,
|
||||
);
|
||||
await followCommunity(beta, true, betaCommunity.community.id);
|
||||
await followCommunity(beta, true, betaCommunity!.community.id);
|
||||
|
||||
const upload_form: UploadImage = {
|
||||
image: Buffer.from("test"),
|
||||
|
|
|
@ -54,6 +54,7 @@ import {
|
|||
ReportCombinedView,
|
||||
ResolveObject,
|
||||
ResolvePostReport,
|
||||
LemmyError,
|
||||
} from "lemmy-js-client";
|
||||
|
||||
let betaCommunity: CommunityView | undefined;
|
||||
|
@ -66,7 +67,7 @@ beforeAll(async () => {
|
|||
// Hack: Force outgoing federation queue for beta to be created on epsilon,
|
||||
// otherwise report test fails
|
||||
let person = await resolvePerson(epsilon, "@lemmy_beta@lemmy-beta:8551");
|
||||
expect(person.person).toBeDefined();
|
||||
expect(person?.person).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(unfollows);
|
||||
|
@ -98,7 +99,7 @@ async function assertPostFederation(
|
|||
expect(postOne?.post.embed_title).toBe(postTwo?.post.embed_title);
|
||||
expect(postOne?.post.embed_description).toBe(postTwo?.post.embed_description);
|
||||
expect(postOne?.post.embed_video_url).toBe(postTwo?.post.embed_video_url);
|
||||
expect(postOne?.post.published).toBe(postTwo?.post.published);
|
||||
expect(postOne?.post.published_at).toBe(postTwo?.post.published_at);
|
||||
expect(postOne?.community.ap_id).toBe(postTwo?.community.ap_id);
|
||||
expect(postOne?.post.locked).toBe(postTwo?.post.locked);
|
||||
expect(postOne?.post.removed).toBe(postTwo?.post.removed);
|
||||
|
@ -144,12 +145,12 @@ test("Create a post", async () => {
|
|||
// Delta only follows beta, so it should not see an alpha ap_id
|
||||
await expect(
|
||||
resolvePost(delta, postRes.post_view.post),
|
||||
).rejects.toStrictEqual(Error("not_found"));
|
||||
).rejects.toStrictEqual(new LemmyError("not_found"));
|
||||
|
||||
// Epsilon has alpha blocked, it should not see the alpha post
|
||||
await expect(
|
||||
resolvePost(epsilon, postRes.post_view.post),
|
||||
).rejects.toStrictEqual(Error("not_found"));
|
||||
).rejects.toStrictEqual(new LemmyError("not_found"));
|
||||
|
||||
// remove blocked instance
|
||||
block_instance_params.block = false;
|
||||
|
@ -157,7 +158,9 @@ test("Create a post", async () => {
|
|||
});
|
||||
|
||||
test("Create a post in a non-existent community", async () => {
|
||||
await expect(createPost(alpha, -2)).rejects.toStrictEqual(Error("not_found"));
|
||||
await expect(createPost(alpha, -2)).rejects.toStrictEqual(
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
});
|
||||
|
||||
test("Unlike a post", async () => {
|
||||
|
@ -208,7 +211,7 @@ test("Update a post", async () => {
|
|||
|
||||
// Make sure lemmy beta cannot update the post
|
||||
await expect(editPost(beta, betaPost.post)).rejects.toStrictEqual(
|
||||
Error("no_post_edit_allowed"),
|
||||
new LemmyError("no_post_edit_allowed"),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -282,7 +285,7 @@ test("Lock a post", async () => {
|
|||
await followCommunity(alpha, true, betaCommunity.community.id);
|
||||
await waitUntil(
|
||||
() => resolveBetaCommunity(alpha),
|
||||
c => c.community_actions?.follow_state == "Accepted",
|
||||
c => c?.community_actions?.follow_state == "Accepted",
|
||||
);
|
||||
|
||||
let postRes = await createPost(alpha, betaCommunity.community.id);
|
||||
|
@ -302,7 +305,7 @@ test("Lock a post", async () => {
|
|||
// user account because admins/mods can comment in locked posts.
|
||||
let user = await registerUser(alpha, alphaUrl);
|
||||
await expect(createComment(user, alphaPost1.post.id)).rejects.toStrictEqual(
|
||||
Error("locked"),
|
||||
new LemmyError("locked"),
|
||||
);
|
||||
|
||||
// Unlock a post
|
||||
|
@ -359,7 +362,7 @@ test("Delete a post", async () => {
|
|||
|
||||
// Make sure lemmy beta cannot delete the post
|
||||
await expect(deletePost(beta, true, betaPost2.post)).rejects.toStrictEqual(
|
||||
Error("no_post_edit_allowed"),
|
||||
new LemmyError("no_post_edit_allowed"),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -370,7 +373,7 @@ test("Remove a post from admin and community on different instance", async () =>
|
|||
|
||||
let gammaCommunity = (
|
||||
await resolveCommunity(gamma, betaCommunity.community.ap_id)
|
||||
).community;
|
||||
)?.community;
|
||||
if (!gammaCommunity) {
|
||||
throw "Missing gamma community";
|
||||
}
|
||||
|
@ -410,7 +413,7 @@ test("Remove a post from admin and community on same instance", async () => {
|
|||
gamma,
|
||||
betaCommunity.community.ap_id,
|
||||
);
|
||||
let postRes = await createPost(gamma, gammaCommunity.community.id);
|
||||
let postRes = await createPost(gamma, gammaCommunity!.community.id);
|
||||
expect(postRes.post_view.post).toBeDefined();
|
||||
// Get the id for beta
|
||||
let betaPost = await waitForPost(beta, postRes.post_view.post);
|
||||
|
@ -499,9 +502,11 @@ test("Enforce site ban federation for local user", async () => {
|
|||
// alpha ban should be federated to beta
|
||||
let alphaUserOnBeta1 = await waitUntil(
|
||||
() => resolvePerson(beta, alphaUserActorId!),
|
||||
res => res.home_instance_actions?.received_ban != null,
|
||||
res => res?.home_instance_actions?.received_ban_at != null,
|
||||
);
|
||||
expect(alphaUserOnBeta1.home_instance_actions?.received_ban).toBeDefined();
|
||||
expect(
|
||||
alphaUserOnBeta1?.home_instance_actions?.received_ban_at,
|
||||
).toBeDefined();
|
||||
|
||||
// existing alpha post should be removed on beta
|
||||
let betaBanRes = await waitUntil(
|
||||
|
@ -557,9 +562,11 @@ test("Enforce site ban federation for federated user", async () => {
|
|||
await followBeta(alphaUserHttp);
|
||||
|
||||
let alphaUserOnBeta2 = await resolvePerson(beta, alphaUserActorId!);
|
||||
expect(alphaUserOnBeta2.local_instance_actions?.received_ban).toBeUndefined();
|
||||
expect(
|
||||
alphaUserOnBeta2?.local_instance_actions?.received_ban_at,
|
||||
).toBeUndefined();
|
||||
|
||||
if (!alphaUserOnBeta2.person) {
|
||||
if (!alphaUserOnBeta2?.person) {
|
||||
throw "Missing alpha person";
|
||||
}
|
||||
|
||||
|
@ -590,7 +597,7 @@ test("Enforce site ban federation for federated user", async () => {
|
|||
|
||||
// User should not be shown to be banned from alpha
|
||||
let alphaPerson2 = (await getMyUser(alphaUserHttp)).local_user_view;
|
||||
expect(alphaPerson2.instance_actions?.received_ban).toBeUndefined();
|
||||
expect(alphaPerson2.instance_actions?.received_ban_at).toBeUndefined();
|
||||
|
||||
// but the ban should be indicated by beta community on alpha
|
||||
let communityWithBan = await getCommunity(
|
||||
|
@ -598,13 +605,13 @@ test("Enforce site ban federation for federated user", async () => {
|
|||
betaCommunity.community.id,
|
||||
);
|
||||
expect(
|
||||
communityWithBan.community_view.instance_actions?.received_ban,
|
||||
communityWithBan.community_view.instance_actions?.received_ban_at,
|
||||
).toBeDefined();
|
||||
|
||||
// post to beta community is rejected
|
||||
await expect(
|
||||
createPost(alphaUserHttp, betaCommunity.community.id),
|
||||
).rejects.toStrictEqual(Error("site_ban"));
|
||||
).rejects.toStrictEqual(new LemmyError("site_ban"));
|
||||
|
||||
await unfollowRemotes(alpha);
|
||||
});
|
||||
|
@ -643,16 +650,16 @@ test("Enforce community ban for federated user", async () => {
|
|||
);
|
||||
expect(removePostRes.post_view.post.removed).toBe(true);
|
||||
expect(
|
||||
removePostRes.post_view.creator_community_actions?.received_ban,
|
||||
removePostRes.post_view.creator_community_actions?.received_ban_at,
|
||||
).toBeDefined();
|
||||
expect(
|
||||
removePostRes.community_view.community_actions?.received_ban,
|
||||
removePostRes.community_view.community_actions?.received_ban_at,
|
||||
).toBeDefined();
|
||||
|
||||
// Alpha tries to make post on beta, but it fails because of ban
|
||||
await expect(
|
||||
createPost(alpha, betaCommunity.community.id),
|
||||
).rejects.toStrictEqual(Error("person_is_banned_from_community"));
|
||||
).rejects.toStrictEqual(new LemmyError("person_is_banned_from_community"));
|
||||
|
||||
// Unban alpha
|
||||
let unBanAlpha = await banPersonFromCommunity(
|
||||
|
@ -681,7 +688,7 @@ test("Enforce community ban for federated user", async () => {
|
|||
// Make sure that post makes it to beta community
|
||||
let postRes4 = await waitForPost(beta, postRes3.post_view.post);
|
||||
expect(postRes4.post).toBeDefined();
|
||||
expect(postRes4.creator_community_actions?.received_ban).toBeUndefined();
|
||||
expect(postRes4.creator_community_actions?.received_ban_at).toBeUndefined();
|
||||
|
||||
await unfollowRemotes(alpha);
|
||||
});
|
||||
|
@ -704,7 +711,7 @@ test("Report a post", async () => {
|
|||
// Create post from alpha
|
||||
let alphaCommunity = await resolveBetaCommunity(alpha);
|
||||
await followBeta(alpha);
|
||||
let alphaPost = await createPost(alpha, alphaCommunity.community.id);
|
||||
let alphaPost = await createPost(alpha, alphaCommunity!.community.id);
|
||||
expect(alphaPost.post_view.post).toBeDefined();
|
||||
|
||||
// add remote mod on epsilon
|
||||
|
@ -716,8 +723,8 @@ test("Report a post", async () => {
|
|||
"@lemmy_epsilon@lemmy-epsilon:8581",
|
||||
);
|
||||
let mod_params: AddModToCommunity = {
|
||||
community_id: betaCommunity.community.id,
|
||||
person_id: epsilonUser.person.id,
|
||||
community_id: betaCommunity!.community.id,
|
||||
person_id: epsilonUser!.person.id,
|
||||
added: true,
|
||||
};
|
||||
let res = await beta.addModToCommunity(mod_params);
|
||||
|
@ -726,7 +733,7 @@ test("Report a post", async () => {
|
|||
// Send report from gamma
|
||||
let gammaPost = await resolvePost(gamma, alphaPost.post_view.post);
|
||||
let gammaReport = (
|
||||
await reportPost(gamma, gammaPost.post.id, randomString(10))
|
||||
await reportPost(gamma, gammaPost!.post.id, randomString(10))
|
||||
).post_report_view.post_report;
|
||||
expect(gammaReport).toBeDefined();
|
||||
|
||||
|
@ -829,9 +836,13 @@ test("Fetch post via redirect", async () => {
|
|||
let form: ResolveObject = {
|
||||
q,
|
||||
};
|
||||
let gammaPost = (await gamma.resolveObject(form)).results[0] as PostView;
|
||||
let gammaPost = await gamma
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Post" ? a : undefined));
|
||||
|
||||
expect(gammaPost).toBeDefined();
|
||||
expect(gammaPost.post.ap_id).toBe(alphaPost.post_view.post.ap_id);
|
||||
expect(gammaPost?.post.ap_id).toBe(alphaPost.post_view.post.ap_id);
|
||||
await unfollowRemotes(alpha);
|
||||
});
|
||||
|
||||
|
@ -850,7 +861,7 @@ test("Block post that contains banned URL", async () => {
|
|||
|
||||
expect(
|
||||
createPost(epsilon, betaCommunity.community.id, "https://evil.com"),
|
||||
).rejects.toStrictEqual(Error("blocked_url"));
|
||||
).rejects.toStrictEqual(new LemmyError("blocked_url"));
|
||||
|
||||
// Later tests need this to be empty
|
||||
editSiteForm.blocked_urls = [];
|
||||
|
@ -863,18 +874,22 @@ test("Fetch post with redirect", async () => {
|
|||
|
||||
// beta fetches from alpha as usual
|
||||
let betaPost = await resolvePost(beta, alphaPost.post_view.post);
|
||||
expect(betaPost.post).toBeDefined();
|
||||
expect(betaPost?.post).toBeDefined();
|
||||
|
||||
// gamma fetches from beta, and gets redirected to alpha
|
||||
let gammaPost = await resolvePost(gamma, betaPost.post);
|
||||
expect(gammaPost.post).toBeDefined();
|
||||
let gammaPost = await resolvePost(gamma, betaPost!.post);
|
||||
expect(gammaPost?.post).toBeDefined();
|
||||
|
||||
// fetch remote object from local url, which redirects to the original url
|
||||
let form: ResolveObject = {
|
||||
q: `http://lemmy-gamma:8561/post/${gammaPost.post.id}`,
|
||||
q: `http://lemmy-gamma:8561/post/${gammaPost?.post.id}`,
|
||||
};
|
||||
let gammaPost2 = (await gamma.resolveObject(form)).results[0] as PostView;
|
||||
expect(gammaPost2.post).toBeDefined();
|
||||
let gammaPost2 = await gamma
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Post" ? a : undefined));
|
||||
|
||||
expect(gammaPost2?.post).toBeDefined();
|
||||
});
|
||||
|
||||
test("Mention beta from alpha post body", async () => {
|
||||
|
@ -919,12 +934,12 @@ test("Rewrite markdown links", async () => {
|
|||
const community = await resolveBetaCommunity(beta);
|
||||
|
||||
// create a post
|
||||
let postRes1 = await createPost(beta, community.community.id);
|
||||
let postRes1 = await createPost(beta, community!.community.id);
|
||||
|
||||
// link to this post in markdown
|
||||
let postRes2 = await createPost(
|
||||
beta,
|
||||
community.community.id,
|
||||
community!.community.id,
|
||||
"https://example.com/",
|
||||
`[link](${postRes1.post_view.post.ap_id})`,
|
||||
);
|
||||
|
@ -935,8 +950,8 @@ test("Rewrite markdown links", async () => {
|
|||
const alphaPost2 = await resolvePost(alpha, postRes2.post_view.post);
|
||||
|
||||
// remote markdown link is replaced with local link
|
||||
expect(alphaPost2.post.body).toBe(
|
||||
`[link](http://lemmy-alpha:8541/post/${alphaPost1.post.id})`,
|
||||
expect(alphaPost2?.post.body).toBe(
|
||||
`[link](http://lemmy-alpha:8541/post/${alphaPost1?.post.id})`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -965,22 +980,23 @@ test("Don't allow NSFW posts on instances that disable it", async () => {
|
|||
// Gamma reject resolving the post
|
||||
await expect(
|
||||
resolvePost(gamma, updatePost.post_view.post),
|
||||
).rejects.toStrictEqual(Error("not_found"));
|
||||
).rejects.toStrictEqual(new LemmyError("not_found"));
|
||||
|
||||
// Local users can't create NSFW post on Gamma
|
||||
let gammaCommunity = (
|
||||
await resolveCommunity(gamma, betaCommunity.community.ap_id)
|
||||
).community;
|
||||
let gammaCommunity = await resolveCommunity(
|
||||
gamma,
|
||||
betaCommunity.community.ap_id,
|
||||
);
|
||||
if (!gammaCommunity) {
|
||||
throw "Missing gamma community";
|
||||
}
|
||||
let gammaPost = await createPost(gamma, gammaCommunity.id);
|
||||
let gammaPost = await createPost(gamma, gammaCommunity.community.id);
|
||||
let form2: EditPost = {
|
||||
nsfw: true,
|
||||
post_id: gammaPost.post_view.post.id,
|
||||
};
|
||||
await expect(gamma.editPost(form2)).rejects.toStrictEqual(
|
||||
Error("nsfw_not_allowed"),
|
||||
new LemmyError("nsfw_not_allowed"),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -1003,7 +1019,9 @@ test("Plugin test", async () => {
|
|||
randomString(10),
|
||||
"Java",
|
||||
),
|
||||
).rejects.toStrictEqual(Error("plugin_error"));
|
||||
).rejects.toStrictEqual(
|
||||
new LemmyError("plugin_error", "We dont talk about Java"),
|
||||
);
|
||||
});
|
||||
|
||||
function checkPostReportName(rcv: ReportCombinedView, report: PostReport) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
jest.setTimeout(120000);
|
||||
|
||||
import { FollowCommunity, LemmyHttp } from "lemmy-js-client";
|
||||
import { FollowCommunity, LemmyError, LemmyHttp } from "lemmy-js-client";
|
||||
import {
|
||||
alpha,
|
||||
setupLogins,
|
||||
|
@ -140,20 +140,20 @@ test("Only followers can view and interact with private community content", asyn
|
|||
const user = await registerUser(beta, betaUrl);
|
||||
const betaCommunity = (
|
||||
await resolveCommunity(user, community.community_view.community.ap_id)
|
||||
).community;
|
||||
)?.community;
|
||||
await expect(resolvePost(user, post0.post_view.post)).rejects.toStrictEqual(
|
||||
Error("not_found"),
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
await expect(
|
||||
resolveComment(user, comment.comment_view.comment),
|
||||
).rejects.toStrictEqual(Error("not_found"));
|
||||
await expect(createPost(user, betaCommunity.id)).rejects.toStrictEqual(
|
||||
Error("not_found"),
|
||||
).rejects.toStrictEqual(new LemmyError("not_found"));
|
||||
await expect(createPost(user, betaCommunity!.id)).rejects.toStrictEqual(
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
|
||||
// follow the community and approve
|
||||
const follow_form: FollowCommunity = {
|
||||
community_id: betaCommunity.id,
|
||||
community_id: betaCommunity!.id,
|
||||
follow: true,
|
||||
};
|
||||
await user.followCommunity(follow_form);
|
||||
|
@ -170,7 +170,7 @@ test("Only followers can view and interact with private community content", asyn
|
|||
);
|
||||
expect(resolvedComment?.comment.id).toBeDefined();
|
||||
|
||||
const post1 = await createPost(user, betaCommunity.id);
|
||||
const post1 = await createPost(user, betaCommunity!.id);
|
||||
expect(post1.post_view).toBeDefined();
|
||||
const like = await likeComment(user, 1, resolvedComment!.comment);
|
||||
expect(like.comment_view.comment_actions?.like_score).toBe(1);
|
||||
|
@ -186,11 +186,11 @@ test("Reject follower", async () => {
|
|||
const user = await registerUser(beta, betaUrl);
|
||||
const betaCommunity1 = (
|
||||
await resolveCommunity(user, community.community_view.community.ap_id)
|
||||
).community;
|
||||
)?.community;
|
||||
|
||||
// follow the community and reject
|
||||
const follow_form: FollowCommunity = {
|
||||
community_id: betaCommunity1.id,
|
||||
community_id: betaCommunity1!.id,
|
||||
follow: true,
|
||||
};
|
||||
const follow = await user.followCommunity(follow_form);
|
||||
|
@ -211,7 +211,7 @@ test("Reject follower", async () => {
|
|||
expect(approve.success).toBe(true);
|
||||
|
||||
await waitUntil(
|
||||
() => getCommunity(user, betaCommunity1.id),
|
||||
() => getCommunity(user, betaCommunity1!.id),
|
||||
c => c.community_view.community_actions?.follow_state === undefined,
|
||||
);
|
||||
});
|
||||
|
@ -236,9 +236,10 @@ test("Follow a private community and receive activities", async () => {
|
|||
await beta.followCommunity(follow_form_beta);
|
||||
await approveFollower(alpha, alphaCommunityId);
|
||||
|
||||
const gammaCommunityId = (
|
||||
await resolveCommunity(gamma, community.community_view.community.ap_id)
|
||||
).community.id;
|
||||
const gammaCommunityId = (await resolveCommunity(
|
||||
gamma,
|
||||
community.community_view.community.ap_id,
|
||||
))!.community.id;
|
||||
const follow_form_gamma: FollowCommunity = {
|
||||
community_id: gammaCommunityId,
|
||||
follow: true,
|
||||
|
@ -289,9 +290,10 @@ test("Fetch remote content in private community", async () => {
|
|||
expect(community.community_view.community.visibility).toBe("Private");
|
||||
const alphaCommunityId = community.community_view.community.id;
|
||||
|
||||
const betaCommunityId = (
|
||||
await resolveCommunity(beta, community.community_view.community.ap_id)
|
||||
).community.id;
|
||||
const betaCommunityId = (await resolveCommunity(
|
||||
beta,
|
||||
community.community_view.community.ap_id,
|
||||
))!.community.id;
|
||||
const follow_form_beta: FollowCommunity = {
|
||||
community_id: betaCommunityId,
|
||||
follow: true,
|
||||
|
@ -320,9 +322,10 @@ test("Fetch remote content in private community", async () => {
|
|||
);
|
||||
|
||||
// create gamma user
|
||||
const gammaCommunityId = (
|
||||
await resolveCommunity(gamma, community.community_view.community.ap_id)
|
||||
).community.id;
|
||||
const gammaCommunityId = (await resolveCommunity(
|
||||
gamma,
|
||||
community.community_view.community.ap_id,
|
||||
))!.community.id;
|
||||
const follow_form: FollowCommunity = {
|
||||
community_id: gammaCommunityId,
|
||||
follow: true,
|
||||
|
@ -330,7 +333,7 @@ test("Fetch remote content in private community", async () => {
|
|||
|
||||
// cannot fetch post yet
|
||||
await expect(resolvePost(gamma, post.post_view.post)).rejects.toStrictEqual(
|
||||
Error("not_found"),
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
// follow community and approve
|
||||
await gamma.followCommunity(follow_form);
|
||||
|
@ -342,7 +345,7 @@ test("Fetch remote content in private community", async () => {
|
|||
() => resolvePost(gamma, post.post_view.post),
|
||||
p => p?.post.id != undefined,
|
||||
);
|
||||
expect(resolvedPost.post.ap_id).toBe(post.post_view.post.ap_id);
|
||||
expect(resolvedPost?.post.ap_id).toBe(post.post_view.post.ap_id);
|
||||
const resolvedComment = await waitUntil(
|
||||
() => resolveComment(gamma, comment.comment_view.comment),
|
||||
p => p?.comment.id != undefined,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
jest.setTimeout(120000);
|
||||
import { PrivateMessageView } from "lemmy-js-client";
|
||||
import { LemmyError, PrivateMessageView } from "lemmy-js-client";
|
||||
import {
|
||||
alpha,
|
||||
beta,
|
||||
|
@ -132,7 +132,7 @@ test("Create a private message report", async () => {
|
|||
pmRes.private_message_view.private_message.id,
|
||||
"a reason",
|
||||
),
|
||||
).rejects.toStrictEqual(Error("couldnt_create_report"));
|
||||
).rejects.toStrictEqual(new LemmyError("couldnt_create_report"));
|
||||
|
||||
// This one should pass
|
||||
let reason = "another reason";
|
||||
|
|
|
@ -29,8 +29,8 @@ import {
|
|||
InboxDataType,
|
||||
GetModlogResponse,
|
||||
GetModlog,
|
||||
CommentView,
|
||||
CommunityView,
|
||||
CommentView,
|
||||
PersonView,
|
||||
} from "lemmy-js-client";
|
||||
import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
|
||||
|
@ -312,25 +312,28 @@ export async function lockPost(
|
|||
export async function resolvePost(
|
||||
api: LemmyHttp,
|
||||
post: Post,
|
||||
): Promise<PostView> {
|
||||
): Promise<PostView | undefined> {
|
||||
let form: ResolveObject = {
|
||||
q: post.ap_id,
|
||||
};
|
||||
let res = await api.resolveObject(form);
|
||||
return res.results[0] as PostView;
|
||||
return api
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Post" ? a : undefined));
|
||||
}
|
||||
|
||||
export async function searchPostLocal(
|
||||
api: LemmyHttp,
|
||||
post: Post,
|
||||
): Promise<PostView> {
|
||||
): Promise<PostView | undefined> {
|
||||
let form: Search = {
|
||||
search_term: post.name,
|
||||
type_: "Posts",
|
||||
listing_type: "All",
|
||||
};
|
||||
let res = await api.search(form);
|
||||
return res.results[0] as PostView;
|
||||
let first = res.results.at(0);
|
||||
return first?.type_ == "Post" ? first : undefined;
|
||||
}
|
||||
|
||||
/// wait for a post to appear locally without pulling it
|
||||
|
@ -339,7 +342,10 @@ export async function waitForPost(
|
|||
post: Post,
|
||||
checker: (t: PostView | undefined) => boolean = p => !!p,
|
||||
) {
|
||||
return waitUntil<PostView>(() => searchPostLocal(api, post), checker);
|
||||
return waitUntil(
|
||||
() => searchPostLocal(api, post),
|
||||
checker,
|
||||
) as Promise<PostView>;
|
||||
}
|
||||
|
||||
export async function getPost(
|
||||
|
@ -387,45 +393,53 @@ export async function listInbox(
|
|||
export async function resolveComment(
|
||||
api: LemmyHttp,
|
||||
comment: Comment,
|
||||
): Promise<CommentView> {
|
||||
): Promise<CommentView | undefined> {
|
||||
let form: ResolveObject = {
|
||||
q: comment.ap_id,
|
||||
};
|
||||
let res = await api.resolveObject(form);
|
||||
return res.results[0] as CommentView;
|
||||
return api
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Comment" ? a : undefined));
|
||||
}
|
||||
|
||||
export async function resolveBetaCommunity(
|
||||
api: LemmyHttp,
|
||||
): Promise<CommunityView> {
|
||||
): Promise<CommunityView | undefined> {
|
||||
// Use short-hand search url
|
||||
let form: ResolveObject = {
|
||||
q: "!main@lemmy-beta:8551",
|
||||
};
|
||||
let res = await api.resolveObject(form);
|
||||
return res.results[0] as CommunityView;
|
||||
return api
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Community" ? a : undefined));
|
||||
}
|
||||
|
||||
export async function resolveCommunity(
|
||||
api: LemmyHttp,
|
||||
q: string,
|
||||
): Promise<CommunityView> {
|
||||
): Promise<CommunityView | undefined> {
|
||||
let form: ResolveObject = {
|
||||
q,
|
||||
};
|
||||
let res = await api.resolveObject(form);
|
||||
return res.results[0] as CommunityView;
|
||||
return api
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Community" ? a : undefined));
|
||||
}
|
||||
|
||||
export async function resolvePerson(
|
||||
api: LemmyHttp,
|
||||
apShortname: string,
|
||||
): Promise<PersonView> {
|
||||
): Promise<PersonView | undefined> {
|
||||
let form: ResolveObject = {
|
||||
q: apShortname,
|
||||
};
|
||||
let res = await api.resolveObject(form);
|
||||
return res.results[0] as PersonView;
|
||||
return api
|
||||
.resolveObject(form)
|
||||
.then(a => a.results.at(0))
|
||||
.then(a => (a?.type_ == "Person" ? a : undefined));
|
||||
}
|
||||
|
||||
export async function banPersonFromSite(
|
||||
|
|
|
@ -27,6 +27,7 @@ import {
|
|||
} from "./shared";
|
||||
import {
|
||||
EditSite,
|
||||
LemmyError,
|
||||
LemmyHttp,
|
||||
SaveUserSettings,
|
||||
UploadImage,
|
||||
|
@ -45,7 +46,7 @@ function assertUserFederation(userOne?: PersonView, userTwo?: PersonView) {
|
|||
expect(userOne?.person.ap_id).toBe(userTwo?.person.ap_id);
|
||||
expect(userOne?.person.avatar).toBe(userTwo?.person.avatar);
|
||||
expect(userOne?.person.banner).toBe(userTwo?.person.banner);
|
||||
expect(userOne?.person.published).toBe(userTwo?.person.published);
|
||||
expect(userOne?.person.published_at).toBe(userTwo?.person.published_at);
|
||||
}
|
||||
|
||||
test("Create user", async () => {
|
||||
|
@ -102,9 +103,11 @@ test("Delete user", async () => {
|
|||
expect(remoteComment).toBeDefined();
|
||||
|
||||
await deleteUser(user);
|
||||
await expect(getMyUser(user)).rejects.toStrictEqual(Error("incorrect_login"));
|
||||
await expect(getMyUser(user)).rejects.toStrictEqual(
|
||||
new LemmyError("incorrect_login"),
|
||||
);
|
||||
await expect(getPersonDetails(user, person_id)).rejects.toStrictEqual(
|
||||
Error("not_found"),
|
||||
new LemmyError("not_found"),
|
||||
);
|
||||
|
||||
// check that posts and comments are marked as deleted on other instances.
|
||||
|
@ -125,7 +128,7 @@ test("Delete user", async () => {
|
|||
).toBe(true);
|
||||
await expect(
|
||||
getPersonDetails(user, remoteComment.creator_id),
|
||||
).rejects.toStrictEqual(Error("not_found"));
|
||||
).rejects.toStrictEqual(new LemmyError("not_found"));
|
||||
});
|
||||
|
||||
test("Requests with invalid auth should be treated as unauthenticated", async () => {
|
||||
|
@ -134,7 +137,7 @@ test("Requests with invalid auth should be treated as unauthenticated", async ()
|
|||
fetchFunction,
|
||||
});
|
||||
await expect(getMyUser(invalid_auth)).rejects.toStrictEqual(
|
||||
Error("incorrect_login"),
|
||||
new LemmyError("incorrect_login"),
|
||||
);
|
||||
let site = await getSite(invalid_auth);
|
||||
expect(site.site_view).toBeDefined();
|
||||
|
|
|
@ -30,7 +30,7 @@ pub async fn ban_from_community(
|
|||
local_user_view: LocalUserView,
|
||||
) -> LemmyResult<Json<BanFromCommunityResponse>> {
|
||||
let banned_person_id = data.person_id;
|
||||
let expires = check_expire_time(data.expires)?;
|
||||
let expires_at = check_expire_time(data.expires_at)?;
|
||||
let local_instance_id = local_user_view.person.instance_id;
|
||||
let community = Community::read(&mut context.pool(), data.community_id).await?;
|
||||
|
||||
|
@ -50,7 +50,7 @@ pub async fn ban_from_community(
|
|||
}
|
||||
|
||||
let community_user_ban_form = CommunityPersonBanForm {
|
||||
ban_expires: Some(expires),
|
||||
ban_expires_at: Some(expires_at),
|
||||
..CommunityPersonBanForm::new(data.community_id, data.person_id)
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ pub async fn ban_from_community(
|
|||
community_id: tx_data.community_id,
|
||||
reason: tx_data.reason.clone(),
|
||||
banned: Some(tx_data.ban),
|
||||
expires,
|
||||
expires_at,
|
||||
};
|
||||
|
||||
ModBanFromCommunity::create(&mut conn.into(), &form).await?;
|
||||
|
|
|
@ -51,7 +51,7 @@ pub async fn update_community_tag(
|
|||
// Update the tag
|
||||
let tag_form = TagUpdateForm {
|
||||
display_name: Some(data.display_name.clone()),
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ pub async fn delete_community_tag(
|
|||
|
||||
// Soft delete the tag
|
||||
let tag_form = TagUpdateForm {
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
deleted: Some(true),
|
||||
..Default::default()
|
||||
};
|
||||
|
|
|
@ -42,9 +42,13 @@ pub async fn ban_from_site(
|
|||
is_valid_body_field(reason, false)?;
|
||||
}
|
||||
|
||||
let expires = check_expire_time(data.expires)?;
|
||||
let expires_at = check_expire_time(data.expires_at)?;
|
||||
|
||||
let form = InstanceBanForm::new(data.person_id, local_user_view.person.instance_id, expires);
|
||||
let form = InstanceBanForm::new(
|
||||
data.person_id,
|
||||
local_user_view.person.instance_id,
|
||||
expires_at,
|
||||
);
|
||||
if data.ban {
|
||||
InstanceActions::ban(&mut context.pool(), &form).await?;
|
||||
} else {
|
||||
|
@ -70,7 +74,7 @@ pub async fn ban_from_site(
|
|||
other_person_id: data.person_id,
|
||||
reason: data.reason.clone(),
|
||||
banned: Some(data.ban),
|
||||
expires,
|
||||
expires_at,
|
||||
instance_id: local_user_view.person.instance_id,
|
||||
};
|
||||
|
||||
|
@ -91,7 +95,7 @@ pub async fn ban_from_site(
|
|||
reason: data.reason.clone(),
|
||||
remove_or_restore_data: data.remove_or_restore_data,
|
||||
ban: data.ban,
|
||||
expires: data.expires,
|
||||
expires_at: data.expires_at,
|
||||
},
|
||||
&context,
|
||||
)?;
|
||||
|
|
|
@ -11,7 +11,7 @@ pub async fn donation_dialog_shown(
|
|||
local_user_view: LocalUserView,
|
||||
) -> LemmyResult<Json<SuccessResponse>> {
|
||||
let form = LocalUserUpdateForm {
|
||||
last_donation_notification: Some(Utc::now()),
|
||||
last_donation_notification_at: Some(Utc::now()),
|
||||
..Default::default()
|
||||
};
|
||||
LocalUser::update(&mut context.pool(), local_user_view.local_user.id, &form).await?;
|
||||
|
|
|
@ -31,7 +31,7 @@ pub async fn admin_allow_instance(
|
|||
.id;
|
||||
let form = FederationAllowListForm {
|
||||
instance_id,
|
||||
updated: None,
|
||||
updated_at: None,
|
||||
};
|
||||
if data.allow {
|
||||
FederationAllowList::allow(&mut context.pool(), &form).await?;
|
||||
|
|
|
@ -31,8 +31,8 @@ pub async fn admin_block_instance(
|
|||
.id;
|
||||
let form = FederationBlockListForm {
|
||||
instance_id,
|
||||
expires: data.expires,
|
||||
updated: None,
|
||||
expires_at: data.expires_at,
|
||||
updated_at: None,
|
||||
};
|
||||
|
||||
if data.block {
|
||||
|
|
|
@ -46,7 +46,7 @@ pub async fn purge_person(
|
|||
reason: data.reason.clone(),
|
||||
remove_or_restore_data: Some(true),
|
||||
ban: true,
|
||||
expires: None,
|
||||
expires_at: None,
|
||||
},
|
||||
&context,
|
||||
)?;
|
||||
|
|
|
@ -8,7 +8,7 @@ pub use lemmy_db_schema::{
|
|||
},
|
||||
};
|
||||
pub use lemmy_db_schema_file::enums::FederationMode;
|
||||
pub use lemmy_db_views_api_misc::{ResolveObject, ResolveObjectResponse, UserBlockInstanceParams};
|
||||
pub use lemmy_db_views_api_misc::{ResolveObject, UserBlockInstanceParams};
|
||||
pub use lemmy_db_views_readable_federation_state::ReadableFederationState;
|
||||
pub use lemmy_db_views_site::api::{
|
||||
FederatedInstances,
|
||||
|
|
|
@ -70,7 +70,7 @@ pub async fn update_comment(
|
|||
let mut form = CommentUpdateForm {
|
||||
content,
|
||||
language_id: Some(language_id),
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
..Default::default()
|
||||
};
|
||||
form = plugin_hook_before("before_update_local_comment", form).await?;
|
||||
|
|
|
@ -80,7 +80,7 @@ pub async fn update_community(
|
|||
nsfw: data.nsfw,
|
||||
posting_restricted_to_mods: data.posting_restricted_to_mods,
|
||||
visibility: data.visibility,
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ pub async fn update_oauth_provider(
|
|||
account_linking_enabled: data.account_linking_enabled,
|
||||
enabled: data.enabled,
|
||||
use_pkce: data.use_pkce,
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
};
|
||||
|
||||
let update_result =
|
||||
|
|
|
@ -117,8 +117,8 @@ pub async fn create_post(
|
|||
)
|
||||
.await?;
|
||||
|
||||
let scheduled_publish_time =
|
||||
convert_published_time(data.scheduled_publish_time, &local_user_view, &context).await?;
|
||||
let scheduled_publish_time_at =
|
||||
convert_published_time(data.scheduled_publish_time_at, &local_user_view, &context).await?;
|
||||
let mut post_form = PostInsertForm {
|
||||
url,
|
||||
body,
|
||||
|
@ -126,7 +126,7 @@ pub async fn create_post(
|
|||
nsfw,
|
||||
language_id: Some(language_id),
|
||||
federation_pending: Some(community_use_pending(community, &context).await),
|
||||
scheduled_publish_time,
|
||||
scheduled_publish_time_at,
|
||||
..PostInsertForm::new(
|
||||
data.name.trim().to_string(),
|
||||
local_user_view.person.id,
|
||||
|
@ -152,7 +152,7 @@ pub async fn create_post(
|
|||
}
|
||||
|
||||
let community_id = community.id;
|
||||
let federate_post = if scheduled_publish_time.is_none() {
|
||||
let federate_post = if scheduled_publish_time_at.is_none() {
|
||||
send_webmention(inserted_post.clone(), community);
|
||||
|post| Some(SendActivityData::CreatePost(post))
|
||||
} else {
|
||||
|
|
|
@ -132,14 +132,14 @@ pub async fn update_post(
|
|||
.await?;
|
||||
|
||||
// handle changes to scheduled_publish_time
|
||||
let scheduled_publish_time = match (
|
||||
orig_post.post.scheduled_publish_time,
|
||||
data.scheduled_publish_time,
|
||||
let scheduled_publish_time_at = match (
|
||||
orig_post.post.scheduled_publish_time_at,
|
||||
data.scheduled_publish_time_at,
|
||||
) {
|
||||
// schedule time can be changed if post is still scheduled (and not published yet)
|
||||
(Some(_), Some(_)) => {
|
||||
Some(convert_published_time(data.scheduled_publish_time, &local_user_view, &context).await?)
|
||||
}
|
||||
(Some(_), Some(_)) => Some(
|
||||
convert_published_time(data.scheduled_publish_time_at, &local_user_view, &context).await?,
|
||||
),
|
||||
// post was scheduled, gets changed to publish immediately
|
||||
(Some(_), None) => Some(None),
|
||||
// unchanged
|
||||
|
@ -153,8 +153,8 @@ pub async fn update_post(
|
|||
alt_text,
|
||||
nsfw: data.nsfw,
|
||||
language_id: Some(language_id),
|
||||
updated: Some(Some(Utc::now())),
|
||||
scheduled_publish_time,
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
scheduled_publish_time_at,
|
||||
..Default::default()
|
||||
};
|
||||
post_form = plugin_hook_before("before_update_local_post", post_form).await?;
|
||||
|
@ -178,8 +178,8 @@ pub async fn update_post(
|
|||
|
||||
// send out federation/webmention if necessary
|
||||
match (
|
||||
orig_post.post.scheduled_publish_time,
|
||||
data.scheduled_publish_time,
|
||||
orig_post.post.scheduled_publish_time_at,
|
||||
data.scheduled_publish_time_at,
|
||||
) {
|
||||
// schedule was removed, send create activity and webmention
|
||||
(Some(_), None) => {
|
||||
|
|
|
@ -42,7 +42,7 @@ pub async fn update_private_message(
|
|||
let private_message_id = data.private_message_id;
|
||||
let mut form = PrivateMessageUpdateForm {
|
||||
content: Some(content),
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
..Default::default()
|
||||
};
|
||||
form = plugin_hook_before("before_update_local_private_message", form).await?;
|
||||
|
|
|
@ -94,7 +94,7 @@ pub async fn create_site(
|
|||
default_comment_sort_type: data.default_comment_sort_type,
|
||||
legal_information: diesel_string_update(data.legal_information.as_deref()),
|
||||
application_email_admins: data.application_email_admins,
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
slur_filter_regex: diesel_string_update(data.slur_filter_regex.as_deref()),
|
||||
actor_name_max_length: data.actor_name_max_length,
|
||||
federation_enabled: data.federation_enabled,
|
||||
|
|
|
@ -78,7 +78,7 @@ pub async fn update_site(
|
|||
sidebar,
|
||||
description: diesel_string_update(data.description.as_deref()),
|
||||
content_warning: diesel_string_update(data.content_warning.as_deref()),
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -101,7 +101,7 @@ pub async fn update_site(
|
|||
default_comment_sort_type: data.default_comment_sort_type,
|
||||
legal_information: diesel_string_update(data.legal_information.as_deref()),
|
||||
application_email_admins: data.application_email_admins,
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
slur_filter_regex: diesel_string_update(data.slur_filter_regex.as_deref()),
|
||||
actor_name_max_length: data.actor_name_max_length,
|
||||
federation_enabled: data.federation_enabled,
|
||||
|
|
|
@ -27,7 +27,7 @@ pub async fn update_tagline(
|
|||
|
||||
let tagline_form = TaglineUpdateForm {
|
||||
content,
|
||||
updated: Some(Some(Utc::now())),
|
||||
updated_at: Some(Some(Utc::now())),
|
||||
};
|
||||
|
||||
let tagline = Tagline::update(&mut context.pool(), data.id, &tagline_form).await?;
|
||||
|
|
|
@ -91,7 +91,7 @@ pub enum SendActivityData {
|
|||
reason: Option<String>,
|
||||
remove_or_restore_data: Option<bool>,
|
||||
ban: bool,
|
||||
expires: Option<i64>,
|
||||
expires_at: Option<i64>,
|
||||
},
|
||||
CreatePrivateMessage(PrivateMessageView),
|
||||
UpdatePrivateMessage(PrivateMessageView),
|
||||
|
|
|
@ -128,7 +128,7 @@ impl ActivityHandler for BlockUser {
|
|||
|
||||
async fn receive(self, context: &Data<LemmyContext>) -> LemmyResult<()> {
|
||||
insert_received_activity(&self.id, context).await?;
|
||||
let expires = self.end_time;
|
||||
let expires_at = self.end_time;
|
||||
let mod_person = self.actor.dereference(context).await?;
|
||||
let blocked_person = self.object.dereference(context).await?;
|
||||
let target = self.target.dereference(context).await?;
|
||||
|
@ -136,7 +136,7 @@ impl ActivityHandler for BlockUser {
|
|||
let pool = &mut context.pool();
|
||||
match target {
|
||||
SiteOrCommunity::Site(site) => {
|
||||
let form = InstanceBanForm::new(blocked_person.id, site.instance_id, expires);
|
||||
let form = InstanceBanForm::new(blocked_person.id, site.instance_id, expires_at);
|
||||
InstanceActions::ban(pool, &form).await?;
|
||||
|
||||
if self.remove_data.unwrap_or(false) {
|
||||
|
@ -155,14 +155,14 @@ impl ActivityHandler for BlockUser {
|
|||
other_person_id: blocked_person.id,
|
||||
reason,
|
||||
banned: Some(true),
|
||||
expires,
|
||||
expires_at,
|
||||
instance_id: site.instance_id,
|
||||
};
|
||||
ModBan::create(&mut context.pool(), &form).await?;
|
||||
}
|
||||
SiteOrCommunity::Community(community) => {
|
||||
let community_user_ban_form = CommunityPersonBanForm {
|
||||
ban_expires: Some(expires),
|
||||
ban_expires_at: Some(expires_at),
|
||||
..CommunityPersonBanForm::new(community.id, blocked_person.id)
|
||||
};
|
||||
CommunityActions::ban(&mut context.pool(), &community_user_ban_form).await?;
|
||||
|
@ -190,7 +190,7 @@ impl ActivityHandler for BlockUser {
|
|||
community_id: community.id,
|
||||
reason,
|
||||
banned: Some(true),
|
||||
expires,
|
||||
expires_at,
|
||||
};
|
||||
ModBanFromCommunity::create(&mut context.pool(), &form).await?;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ pub(crate) async fn send_ban_from_community(
|
|||
let community: ApubCommunity = Community::read(&mut context.pool(), community_id)
|
||||
.await?
|
||||
.into();
|
||||
let expires = check_expire_time(data.expires)?;
|
||||
let expires_at = check_expire_time(data.expires_at)?;
|
||||
|
||||
if data.ban {
|
||||
BlockUser::send(
|
||||
|
@ -177,7 +177,7 @@ pub(crate) async fn send_ban_from_community(
|
|||
&mod_.into(),
|
||||
data.remove_or_restore_data.unwrap_or(false),
|
||||
data.reason.clone(),
|
||||
expires,
|
||||
expires_at,
|
||||
&context,
|
||||
)
|
||||
.await
|
||||
|
|
|
@ -97,14 +97,14 @@ impl ActivityHandler for UndoBlockUser {
|
|||
|
||||
async fn receive(self, context: &Data<LemmyContext>) -> LemmyResult<()> {
|
||||
insert_received_activity(&self.id, context).await?;
|
||||
let expires = self.object.end_time;
|
||||
let expires_at = self.object.end_time;
|
||||
let mod_person = self.actor.dereference(context).await?;
|
||||
let blocked_person = self.object.object.dereference(context).await?;
|
||||
let pool = &mut context.pool();
|
||||
match self.object.target.dereference(context).await? {
|
||||
SiteOrCommunity::Site(site) => {
|
||||
verify_is_public(&self.to, &self.cc)?;
|
||||
let form = InstanceBanForm::new(blocked_person.id, site.instance_id, expires);
|
||||
let form = InstanceBanForm::new(blocked_person.id, site.instance_id, expires_at);
|
||||
InstanceActions::unban(pool, &form).await?;
|
||||
|
||||
if self.restore_data.unwrap_or(false) {
|
||||
|
@ -123,7 +123,7 @@ impl ActivityHandler for UndoBlockUser {
|
|||
other_person_id: blocked_person.id,
|
||||
reason: self.object.summary,
|
||||
banned: Some(false),
|
||||
expires,
|
||||
expires_at,
|
||||
instance_id: site.instance_id,
|
||||
};
|
||||
ModBan::create(&mut context.pool(), &form).await?;
|
||||
|
@ -152,7 +152,7 @@ impl ActivityHandler for UndoBlockUser {
|
|||
community_id: community.id,
|
||||
reason: self.object.summary,
|
||||
banned: Some(false),
|
||||
expires,
|
||||
expires_at,
|
||||
};
|
||||
ModBanFromCommunity::create(&mut context.pool(), &form).await?;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ pub async fn match_outgoing_activities(
|
|||
reason,
|
||||
remove_or_restore_data,
|
||||
ban,
|
||||
expires,
|
||||
expires_at,
|
||||
} => {
|
||||
send_ban_from_site(
|
||||
moderator,
|
||||
|
@ -308,7 +308,7 @@ pub async fn match_outgoing_activities(
|
|||
reason,
|
||||
remove_or_restore_data,
|
||||
ban,
|
||||
expires,
|
||||
expires_at,
|
||||
context,
|
||||
)
|
||||
.await
|
||||
|
|
|
@ -122,8 +122,8 @@ impl Object for ApubComment {
|
|||
media_type: Some(MediaTypeMarkdownOrHtml::Html),
|
||||
source: Some(Source::new(self.content.clone())),
|
||||
in_reply_to,
|
||||
published: Some(self.published),
|
||||
updated: self.updated,
|
||||
published: Some(self.published_at),
|
||||
updated: self.updated_at,
|
||||
tag: maa.tags,
|
||||
distinguished: Some(self.distinguished),
|
||||
language,
|
||||
|
@ -208,8 +208,8 @@ impl Object for ApubComment {
|
|||
post_id: post.id,
|
||||
content,
|
||||
removed: None,
|
||||
published: note.published,
|
||||
updated: note.updated,
|
||||
published_at: note.published,
|
||||
updated_at: note.updated,
|
||||
deleted: Some(false),
|
||||
ap_id: Some(note.id.into()),
|
||||
distinguished: note.distinguished,
|
||||
|
|
|
@ -129,8 +129,8 @@ impl Object for ApubCommunity {
|
|||
endpoints: None,
|
||||
public_key: self.public_key(),
|
||||
language,
|
||||
published: Some(self.published),
|
||||
updated: self.updated,
|
||||
published: Some(self.published_at),
|
||||
updated: self.updated_at,
|
||||
posting_restricted_to_mods: Some(self.posting_restricted_to_mods),
|
||||
attributed_to: Some(AttributedTo::Lemmy(
|
||||
generate_moderators_url(&self.ap_id)?.into(),
|
||||
|
@ -180,8 +180,8 @@ impl Object for ApubCommunity {
|
|||
.map(|_| true);
|
||||
|
||||
let form = CommunityInsertForm {
|
||||
published: group.published,
|
||||
updated: group.updated,
|
||||
published_at: group.published,
|
||||
updated_at: group.updated,
|
||||
deleted: Some(false),
|
||||
nsfw: Some(group.sensitive.unwrap_or(false)),
|
||||
ap_id: Some(group.id.clone().into()),
|
||||
|
|
|
@ -106,8 +106,8 @@ impl Object for ApubSite {
|
|||
public_key: self.public_key(),
|
||||
language,
|
||||
content_warning: self.content_warning.clone(),
|
||||
published: self.published,
|
||||
updated: self.updated,
|
||||
published: self.published_at,
|
||||
updated: self.updated_at,
|
||||
};
|
||||
Ok(instance)
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ impl Object for ApubSite {
|
|||
let site_form = SiteInsertForm {
|
||||
name: apub.name.clone(),
|
||||
sidebar,
|
||||
updated: apub.updated,
|
||||
updated_at: apub.updated,
|
||||
icon,
|
||||
banner,
|
||||
description: apub.summary,
|
||||
|
|
|
@ -106,11 +106,11 @@ impl Object for ApubPerson {
|
|||
icon: self.avatar.clone().map(ImageObject::new),
|
||||
image: self.banner.clone().map(ImageObject::new),
|
||||
matrix_user_id: self.matrix_user_id.clone(),
|
||||
published: Some(self.published),
|
||||
published: Some(self.published_at),
|
||||
outbox: generate_outbox_url(&self.ap_id)?.into(),
|
||||
endpoints: None,
|
||||
public_key: self.public_key(),
|
||||
updated: self.updated,
|
||||
updated: self.updated_at,
|
||||
inbox: self.inbox_url.clone().into(),
|
||||
};
|
||||
Ok(person)
|
||||
|
@ -155,8 +155,8 @@ impl Object for ApubPerson {
|
|||
deleted: Some(false),
|
||||
avatar,
|
||||
banner,
|
||||
published: person.published,
|
||||
updated: person.updated,
|
||||
published_at: person.published,
|
||||
updated_at: person.updated,
|
||||
ap_id: Some(person.id.into()),
|
||||
bio,
|
||||
local: Some(false),
|
||||
|
|
|
@ -149,8 +149,8 @@ impl Object for ApubPost {
|
|||
image: self.thumbnail_url.clone().map(ImageObject::new),
|
||||
sensitive: Some(self.nsfw),
|
||||
language,
|
||||
published: Some(self.published),
|
||||
updated: self.updated,
|
||||
published: Some(self.published_at),
|
||||
updated: self.updated_at,
|
||||
in_reply_to: None,
|
||||
tag: vec![hashtag],
|
||||
};
|
||||
|
@ -284,8 +284,8 @@ impl Object for ApubPost {
|
|||
url: url.map(Into::into),
|
||||
body,
|
||||
alt_text,
|
||||
published: page.published,
|
||||
updated: page.updated,
|
||||
published_at: page.published,
|
||||
updated_at: page.updated,
|
||||
deleted: Some(false),
|
||||
nsfw,
|
||||
ap_id: Some(page.id.clone().into()),
|
||||
|
|
|
@ -105,8 +105,8 @@ impl Object for ApubPrivateMessage {
|
|||
content: markdown_to_html(&self.content),
|
||||
media_type: Some(MediaTypeHtml::Html),
|
||||
source: Some(Source::new(self.content.clone())),
|
||||
published: Some(self.published),
|
||||
updated: self.updated,
|
||||
published: Some(self.published_at),
|
||||
updated: self.updated_at,
|
||||
};
|
||||
Ok(note)
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ impl Object for ApubPrivateMessage {
|
|||
creator_id: creator.id,
|
||||
recipient_id: recipient.id,
|
||||
content,
|
||||
published: note.published,
|
||||
updated: note.updated,
|
||||
published_at: note.published,
|
||||
updated_at: note.updated,
|
||||
deleted: Some(false),
|
||||
read: None,
|
||||
ap_id: Some(note.id.into()),
|
||||
|
|
|
@ -118,7 +118,7 @@ async fn try_main() -> LemmyResult<()> {
|
|||
post::creator_id,
|
||||
post::community_id,
|
||||
post::featured_community,
|
||||
post::published,
|
||||
post::published_at,
|
||||
))
|
||||
.execute(conn)
|
||||
.await?;
|
||||
|
@ -184,8 +184,8 @@ fn site() -> LemmyResult<Site> {
|
|||
id: Default::default(),
|
||||
name: String::new(),
|
||||
sidebar: None,
|
||||
published: Default::default(),
|
||||
updated: None,
|
||||
published_at: Default::default(),
|
||||
updated_at: None,
|
||||
icon: None,
|
||||
banner: None,
|
||||
description: None,
|
||||
|
|
|
@ -47,7 +47,7 @@ impl Comment {
|
|||
.set((
|
||||
comment::content.eq(DELETED_REPLACEMENT_TEXT),
|
||||
comment::deleted.eq(true),
|
||||
comment::updated.eq(Utc::now()),
|
||||
comment::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.get_results::<Self>(conn)
|
||||
.await
|
||||
|
@ -63,7 +63,7 @@ impl Comment {
|
|||
diesel::update(comment::table.filter(comment::creator_id.eq(creator_id)))
|
||||
.set((
|
||||
comment::removed.eq(removed),
|
||||
comment::updated.eq(Utc::now()),
|
||||
comment::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.get_results::<Self>(conn)
|
||||
.await
|
||||
|
@ -153,7 +153,7 @@ impl Comment {
|
|||
insert_into(comment::table)
|
||||
.values(comment_form)
|
||||
.on_conflict(comment::ap_id)
|
||||
.filter_target(coalesce(comment::updated, comment::published).lt(timestamp))
|
||||
.filter_target(coalesce(comment::updated_at, comment::published_at).lt(timestamp))
|
||||
.do_update()
|
||||
.set(comment_form)
|
||||
.get_result::<Self>(conn)
|
||||
|
@ -196,7 +196,7 @@ impl Comment {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
diesel::update(comment::table.find(comment_id))
|
||||
.set(comment::hot_rank.eq(hot_rank(comment::score, comment::published)))
|
||||
.set(comment::hot_rank.eq(hot_rank(comment::score, comment::published_at)))
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntUpdateComment)
|
||||
|
@ -268,7 +268,7 @@ impl Likeable for CommentActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(comment_actions::table.find((person_id, comment_id)))
|
||||
.set_null(comment_actions::like_score)
|
||||
.set_null(comment_actions::liked)
|
||||
.set_null(comment_actions::liked_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntLikeComment)
|
||||
|
@ -292,7 +292,7 @@ impl Saveable for CommentActions {
|
|||
async fn unsave(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(comment_actions::table.find((form.person_id, form.comment_id)))
|
||||
.set_null(comment_actions::saved)
|
||||
.set_null(comment_actions::saved_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntSaveComment)
|
||||
|
@ -378,8 +378,8 @@ mod tests {
|
|||
removed: false,
|
||||
deleted: false,
|
||||
path: Ltree(format!("0.{}", inserted_comment.id)),
|
||||
published: inserted_comment.published,
|
||||
updated: None,
|
||||
published_at: inserted_comment.published_at,
|
||||
updated_at: None,
|
||||
ap_id: Url::parse(&format!(
|
||||
"https://lemmy-alpha/comment/{}",
|
||||
inserted_comment.id
|
||||
|
@ -416,7 +416,7 @@ mod tests {
|
|||
// Comment Saved
|
||||
let comment_saved_form = CommentSavedForm::new(inserted_person.id, inserted_comment.id);
|
||||
let inserted_comment_saved = CommentActions::save(pool, &comment_saved_form).await?;
|
||||
assert!(inserted_comment_saved.saved.is_some());
|
||||
assert!(inserted_comment_saved.saved_at.is_some());
|
||||
|
||||
let comment_update_form = CommentUpdateForm {
|
||||
content: Some("A test comment".into()),
|
||||
|
|
|
@ -47,7 +47,7 @@ impl Reportable for CommentReport {
|
|||
.set((
|
||||
comment_report::resolved.eq(true),
|
||||
comment_report::resolver_id.eq(by_resolver_id),
|
||||
comment_report::updated.eq(Utc::now()),
|
||||
comment_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -71,7 +71,7 @@ impl Reportable for CommentReport {
|
|||
.set((
|
||||
comment_report::resolved.eq(true),
|
||||
comment_report::resolver_id.eq(resolver_id),
|
||||
comment_report::updated.eq(Utc::now()),
|
||||
comment_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -88,7 +88,7 @@ impl Reportable for CommentReport {
|
|||
.set((
|
||||
comment_report::resolved.eq(true),
|
||||
comment_report::resolver_id.eq(by_resolver_id),
|
||||
comment_report::updated.eq(Utc::now()),
|
||||
comment_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -110,7 +110,7 @@ impl Reportable for CommentReport {
|
|||
.set((
|
||||
comment_report::resolved.eq(false),
|
||||
comment_report::resolver_id.eq(by_resolver_id),
|
||||
comment_report::updated.eq(Utc::now()),
|
||||
comment_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
|
|
@ -104,7 +104,7 @@ impl Joinable for CommunityActions {
|
|||
async fn leave(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(community_actions::table.find((form.person_id, form.community_id)))
|
||||
.set_null(community_actions::became_moderator)
|
||||
.set_null(community_actions::became_moderator_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CommunityModeratorAlreadyExists)
|
||||
|
@ -132,7 +132,7 @@ impl Community {
|
|||
let community_ = insert_into(community::table)
|
||||
.values(form)
|
||||
.on_conflict(community::ap_id)
|
||||
.filter_target(coalesce(community::updated, community::published).lt(timestamp))
|
||||
.filter_target(coalesce(community::updated_at, community::published_at).lt(timestamp))
|
||||
.do_update()
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
|
@ -316,7 +316,7 @@ impl CommunityActions {
|
|||
uplete::new(
|
||||
community_actions::table.filter(community_actions::community_id.eq(for_community_id)),
|
||||
)
|
||||
.set_null(community_actions::became_moderator)
|
||||
.set_null(community_actions::became_moderator_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)
|
||||
|
@ -328,7 +328,7 @@ impl CommunityActions {
|
|||
) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(community_actions::table.filter(community_actions::person_id.eq(for_person_id)))
|
||||
.set_null(community_actions::became_moderator)
|
||||
.set_null(community_actions::became_moderator_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)
|
||||
|
@ -340,7 +340,7 @@ impl CommunityActions {
|
|||
) -> LemmyResult<Vec<CommunityId>> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
community_actions::table
|
||||
.filter(community_actions::became_moderator.is_not_null())
|
||||
.filter(community_actions::became_moderator_at.is_not_null())
|
||||
.filter(community_actions::person_id.eq(for_person_id))
|
||||
.select(community_actions::community_id)
|
||||
.load::<CommunityId>(conn)
|
||||
|
@ -363,10 +363,10 @@ impl CommunityActions {
|
|||
persons.dedup();
|
||||
|
||||
let res = community_actions::table
|
||||
.filter(community_actions::became_moderator.is_not_null())
|
||||
.filter(community_actions::became_moderator_at.is_not_null())
|
||||
.filter(community_actions::community_id.eq(for_community_id))
|
||||
.filter(community_actions::person_id.eq_any(persons))
|
||||
.order_by(community_actions::became_moderator)
|
||||
.order_by(community_actions::became_moderator_at)
|
||||
.select(community_actions::person_id)
|
||||
// This does a limit 1 select first
|
||||
.first::<PersonId>(conn)
|
||||
|
@ -388,7 +388,7 @@ impl CommunityActions {
|
|||
) -> LemmyResult<()> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
let find_action = community_actions::table
|
||||
.filter(community_actions::followed.is_not_null())
|
||||
.filter(community_actions::followed_at.is_not_null())
|
||||
.filter(community_actions::community_id.eq(remote_community_id));
|
||||
select(exists(find_action))
|
||||
.get_result::<bool>(conn)
|
||||
|
@ -406,7 +406,7 @@ impl CommunityActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
let find_action = community_actions::table
|
||||
.find((follower_id, community_id))
|
||||
.filter(community_actions::followed.is_not_null());
|
||||
.filter(community_actions::followed_at.is_not_null());
|
||||
diesel::update(find_action)
|
||||
.set((
|
||||
community_actions::follow_state.eq(CommunityFollowerState::Accepted),
|
||||
|
@ -431,7 +431,7 @@ impl CommunityActions {
|
|||
.try_get_with(person_id, async move {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
community_actions::table
|
||||
.filter(community_actions::followed.is_not_null())
|
||||
.filter(community_actions::followed_at.is_not_null())
|
||||
.filter(community_actions::person_id.eq(person_id))
|
||||
.inner_join(community::table.on(community::id.eq(community_actions::community_id)))
|
||||
.order_by(community::users_active_month.desc())
|
||||
|
@ -467,8 +467,8 @@ impl Bannable for CommunityActions {
|
|||
async fn unban(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(community_actions::table.find((form.person_id, form.community_id)))
|
||||
.set_null(community_actions::received_ban)
|
||||
.set_null(community_actions::ban_expires)
|
||||
.set_null(community_actions::received_ban_at)
|
||||
.set_null(community_actions::ban_expires_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CommunityUserAlreadyBanned)
|
||||
|
@ -518,7 +518,7 @@ impl Followable for CommunityActions {
|
|||
) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(community_actions::table.find((person_id, community_id)))
|
||||
.set_null(community_actions::followed)
|
||||
.set_null(community_actions::followed_at)
|
||||
.set_null(community_actions::follow_state)
|
||||
.set_null(community_actions::follow_approver_id)
|
||||
.get_result(conn)
|
||||
|
@ -556,7 +556,7 @@ impl Blockable for CommunityActions {
|
|||
community_block_form.person_id,
|
||||
community_block_form.community_id,
|
||||
)))
|
||||
.set_null(community_actions::blocked)
|
||||
.set_null(community_actions::blocked_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CommunityBlockAlreadyExists)
|
||||
|
@ -570,7 +570,7 @@ impl Blockable for CommunityActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
let find_action = community_actions::table
|
||||
.find((person_id, community_id))
|
||||
.filter(community_actions::blocked.is_not_null());
|
||||
.filter(community_actions::blocked_at.is_not_null());
|
||||
|
||||
select(not(exists(find_action)))
|
||||
.get_result::<bool>(conn)
|
||||
|
@ -585,13 +585,13 @@ impl Blockable for CommunityActions {
|
|||
) -> LemmyResult<Vec<Self::ObjectType>> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
community_actions::table
|
||||
.filter(community_actions::blocked.is_not_null())
|
||||
.filter(community_actions::blocked_at.is_not_null())
|
||||
.inner_join(community::table)
|
||||
.select(community::all_columns)
|
||||
.filter(community_actions::person_id.eq(person_id))
|
||||
.filter(community::deleted.eq(false))
|
||||
.filter(community::removed.eq(false))
|
||||
.order_by(community_actions::blocked)
|
||||
.order_by(community_actions::blocked_at)
|
||||
.load::<Community>(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)
|
||||
|
@ -722,13 +722,13 @@ mod tests {
|
|||
nsfw: false,
|
||||
removed: false,
|
||||
deleted: false,
|
||||
published: inserted_community.published,
|
||||
updated: None,
|
||||
published_at: inserted_community.published_at,
|
||||
updated_at: None,
|
||||
ap_id: inserted_community.ap_id.clone(),
|
||||
local: true,
|
||||
private_key: None,
|
||||
public_key: "pubkey".to_owned(),
|
||||
last_refreshed_at: inserted_community.published,
|
||||
last_refreshed_at: inserted_community.published_at,
|
||||
icon: None,
|
||||
banner: None,
|
||||
followers_url: inserted_community.followers_url.clone(),
|
||||
|
@ -772,7 +772,7 @@ mod tests {
|
|||
CommunityModeratorForm::new(inserted_community.id, inserted_bobby.id);
|
||||
|
||||
let inserted_bobby_moderator = CommunityActions::join(pool, &bobby_moderator_form).await?;
|
||||
assert!(inserted_bobby_moderator.became_moderator.is_some());
|
||||
assert!(inserted_bobby_moderator.became_moderator_at.is_some());
|
||||
|
||||
let artemis_moderator_form =
|
||||
CommunityModeratorForm::new(inserted_community.id, inserted_artemis.id);
|
||||
|
@ -817,8 +817,8 @@ mod tests {
|
|||
let inserted_community_person_ban =
|
||||
CommunityActions::ban(pool, &community_person_ban_form).await?;
|
||||
|
||||
assert!(inserted_community_person_ban.received_ban.is_some());
|
||||
assert!(inserted_community_person_ban.ban_expires.is_none());
|
||||
assert!(inserted_community_person_ban.received_ban_at.is_some());
|
||||
assert!(inserted_community_person_ban.ban_expires_at.is_none());
|
||||
let read_community = Community::read(pool, inserted_community.id).await?;
|
||||
|
||||
let update_community_form = CommunityUpdateForm {
|
||||
|
|
|
@ -47,7 +47,7 @@ impl Reportable for CommunityReport {
|
|||
.set((
|
||||
community_report::resolved.eq(true),
|
||||
community_report::resolver_id.eq(by_resolver_id),
|
||||
community_report::updated.eq(Utc::now()),
|
||||
community_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -71,7 +71,7 @@ impl Reportable for CommunityReport {
|
|||
.set((
|
||||
community_report::resolved.eq(true),
|
||||
community_report::resolver_id.eq(resolver_id),
|
||||
community_report::updated.eq(Utc::now()),
|
||||
community_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -88,7 +88,7 @@ impl Reportable for CommunityReport {
|
|||
.set((
|
||||
community_report::resolved.eq(true),
|
||||
community_report::resolver_id.eq(by_resolver_id),
|
||||
community_report::updated.eq(Utc::now()),
|
||||
community_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -110,7 +110,7 @@ impl Reportable for CommunityReport {
|
|||
.set((
|
||||
community_report::resolved.eq(false),
|
||||
community_report::resolver_id.eq(by_resolver_id),
|
||||
community_report::updated.eq(Utc::now()),
|
||||
community_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
use crate::{
|
||||
newtypes::LocalUserId,
|
||||
source::email_verification::{EmailVerification, EmailVerificationForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{
|
||||
dsl::{now, IntervalDsl},
|
||||
insert_into,
|
||||
sql_types::Timestamptz,
|
||||
ExpressionMethods,
|
||||
IntoSql,
|
||||
QueryDsl,
|
||||
utils::{get_conn, now, DbPool},
|
||||
};
|
||||
use diesel::{dsl::IntervalDsl, insert_into, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::email_verification::dsl::{
|
||||
email_verification,
|
||||
local_user_id,
|
||||
published,
|
||||
verification_token,
|
||||
};
|
||||
use lemmy_db_schema_file::schema::email_verification;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl EmailVerification {
|
||||
pub async fn create(pool: &mut DbPool<'_>, form: &EmailVerificationForm) -> LemmyResult<Self> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(email_verification)
|
||||
insert_into(email_verification::table)
|
||||
.values(form)
|
||||
.get_result(conn)
|
||||
.await
|
||||
|
@ -32,9 +20,9 @@ impl EmailVerification {
|
|||
|
||||
pub async fn read_for_token(pool: &mut DbPool<'_>, token: &str) -> LemmyResult<Self> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
email_verification
|
||||
.filter(verification_token.eq(token))
|
||||
.filter(published.gt(now.into_sql::<Timestamptz>() - 7.days()))
|
||||
email_verification::table
|
||||
.filter(email_verification::verification_token.eq(token))
|
||||
.filter(email_verification::published_at.gt(now() - 7.days()))
|
||||
.first(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)
|
||||
|
@ -44,9 +32,11 @@ impl EmailVerification {
|
|||
local_user_id_: LocalUserId,
|
||||
) -> LemmyResult<usize> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
diesel::delete(email_verification.filter(local_user_id.eq(local_user_id_)))
|
||||
.execute(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::Deleted)
|
||||
diesel::delete(
|
||||
email_verification::table.filter(email_verification::local_user_id.eq(local_user_id_)),
|
||||
)
|
||||
.execute(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::Deleted)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ mod tests {
|
|||
.iter()
|
||||
.map(|i| FederationAllowListForm {
|
||||
instance_id: i.id,
|
||||
updated: None,
|
||||
updated_at: None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ impl FederationQueueState {
|
|||
.unwrap_or(FederationQueueState {
|
||||
instance_id,
|
||||
fail_count: 0,
|
||||
last_retry: None,
|
||||
last_retry_at: None,
|
||||
last_successful_id: None, // this value is set to the most current id for new instances
|
||||
last_successful_published_time: None,
|
||||
last_successful_published_time_at: None,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ impl Instance {
|
|||
None => {
|
||||
// Instance not in database yet, insert it
|
||||
let form = InstanceForm {
|
||||
updated: Some(Utc::now()),
|
||||
updated_at: Some(Utc::now()),
|
||||
..InstanceForm::new(domain_)
|
||||
};
|
||||
insert_into(instance::table)
|
||||
|
@ -148,7 +148,7 @@ impl Instance {
|
|||
pool: &mut DbPool<'_>,
|
||||
) -> LemmyResult<Vec<(Self, bool, bool)>> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
let is_dead_expr = coalesce(instance::updated, instance::published).lt(now() - 3.days());
|
||||
let is_dead_expr = coalesce(instance::updated_at, instance::published_at).lt(now() - 3.days());
|
||||
// this needs to be done in two steps because the meaning of the "blocked" column depends on the
|
||||
// existence of any value at all in the allowlist. (so a normal join wouldn't work)
|
||||
let use_allowlist = federation_allowlist::table
|
||||
|
@ -227,7 +227,7 @@ impl Blockable for InstanceActions {
|
|||
async fn unblock(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(instance_actions::table.find((form.person_id, form.instance_id)))
|
||||
.set_null(instance_actions::blocked)
|
||||
.set_null(instance_actions::blocked_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::InstanceBlockAlreadyExists)
|
||||
|
@ -241,7 +241,7 @@ impl Blockable for InstanceActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
let find_action = instance_actions::table
|
||||
.find((person_id, instance_id))
|
||||
.filter(instance_actions::blocked.is_not_null());
|
||||
.filter(instance_actions::blocked_at.is_not_null());
|
||||
select(not(exists(find_action)))
|
||||
.get_result::<bool>(conn)
|
||||
.await?
|
||||
|
@ -255,11 +255,11 @@ impl Blockable for InstanceActions {
|
|||
) -> LemmyResult<Vec<Self::ObjectType>> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
instance_actions::table
|
||||
.filter(instance_actions::blocked.is_not_null())
|
||||
.filter(instance_actions::blocked_at.is_not_null())
|
||||
.inner_join(instance::table)
|
||||
.select(instance::all_columns)
|
||||
.filter(instance_actions::person_id.eq(person_id))
|
||||
.order_by(instance_actions::blocked)
|
||||
.order_by(instance_actions::blocked_at)
|
||||
.load::<Instance>(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)
|
||||
|
@ -277,7 +277,7 @@ impl InstanceActions {
|
|||
instance_actions::table
|
||||
.filter(instance_actions::person_id.eq(person_id))
|
||||
.filter(instance_actions::instance_id.eq(instance_id))
|
||||
.filter(instance_actions::received_ban.is_not_null()),
|
||||
.filter(instance_actions::received_ban_at.is_not_null()),
|
||||
))
|
||||
.get_result::<bool>(conn)
|
||||
.await?;
|
||||
|
@ -308,8 +308,8 @@ impl Bannable for InstanceActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
Ok(
|
||||
uplete::new(instance_actions::table.find((form.person_id, form.instance_id)))
|
||||
.set_null(instance_actions::received_ban)
|
||||
.set_null(instance_actions::ban_expires)
|
||||
.set_null(instance_actions::received_ban_at)
|
||||
.set_null(instance_actions::ban_expires_at)
|
||||
.get_result(conn)
|
||||
.await?,
|
||||
)
|
||||
|
|
|
@ -64,6 +64,6 @@ impl LocalSiteRateLimitUpdateForm {
|
|||
&& self.comment_per_second.is_none()
|
||||
&& self.search.is_none()
|
||||
&& self.search_per_second.is_none()
|
||||
&& self.updated.is_none()
|
||||
&& self.updated_at.is_none()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,10 @@ impl LocalSiteUrlBlocklist {
|
|||
|
||||
let forms = url_blocklist
|
||||
.into_iter()
|
||||
.map(|url| LocalSiteUrlBlocklistForm { url, updated: None })
|
||||
.map(|url| LocalSiteUrlBlocklistForm {
|
||||
url,
|
||||
updated_at: None,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
insert_into(local_site_url_blocklist::table)
|
||||
|
|
|
@ -122,7 +122,7 @@ impl LocalUser {
|
|||
// - The accepted_application is false
|
||||
let old_denied_registrations = registration_application::table
|
||||
.filter(registration_application::admin_id.is_not_null())
|
||||
.filter(registration_application::published.lt(now() - 1.week()))
|
||||
.filter(registration_application::published_at.lt(now() - 1.week()))
|
||||
.select(registration_application::local_user_id);
|
||||
|
||||
// Delete based on join logic is here:
|
||||
|
@ -172,7 +172,7 @@ impl LocalUser {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
let followed_communities = community_actions::table
|
||||
.filter(community_actions::followed.is_not_null())
|
||||
.filter(community_actions::followed_at.is_not_null())
|
||||
.filter(community_actions::person_id.eq(person_id_))
|
||||
.inner_join(community::table)
|
||||
.select(community::ap_id)
|
||||
|
@ -180,7 +180,7 @@ impl LocalUser {
|
|||
.await?;
|
||||
|
||||
let saved_posts = post_actions::table
|
||||
.filter(post_actions::saved.is_not_null())
|
||||
.filter(post_actions::saved_at.is_not_null())
|
||||
.filter(post_actions::person_id.eq(person_id_))
|
||||
.inner_join(post::table)
|
||||
.select(post::ap_id)
|
||||
|
@ -188,7 +188,7 @@ impl LocalUser {
|
|||
.await?;
|
||||
|
||||
let saved_comments = comment_actions::table
|
||||
.filter(comment_actions::saved.is_not_null())
|
||||
.filter(comment_actions::saved_at.is_not_null())
|
||||
.filter(comment_actions::person_id.eq(person_id_))
|
||||
.inner_join(comment::table)
|
||||
.select(comment::ap_id)
|
||||
|
@ -196,7 +196,7 @@ impl LocalUser {
|
|||
.await?;
|
||||
|
||||
let blocked_communities = community_actions::table
|
||||
.filter(community_actions::blocked.is_not_null())
|
||||
.filter(community_actions::blocked_at.is_not_null())
|
||||
.filter(community_actions::person_id.eq(person_id_))
|
||||
.inner_join(community::table)
|
||||
.select(community::ap_id)
|
||||
|
@ -204,7 +204,7 @@ impl LocalUser {
|
|||
.await?;
|
||||
|
||||
let blocked_users = person_actions::table
|
||||
.filter(person_actions::blocked.is_not_null())
|
||||
.filter(person_actions::blocked_at.is_not_null())
|
||||
.filter(person_actions::person_id.eq(person_id_))
|
||||
.inner_join(person::table.on(person_actions::target_id.eq(person::id)))
|
||||
.select(person::ap_id)
|
||||
|
@ -212,7 +212,7 @@ impl LocalUser {
|
|||
.await?;
|
||||
|
||||
let blocked_instances = instance_actions::table
|
||||
.filter(instance_actions::blocked.is_not_null())
|
||||
.filter(instance_actions::blocked_at.is_not_null())
|
||||
.filter(instance_actions::person_id.eq(person_id_))
|
||||
.inner_join(instance::table)
|
||||
.select(instance::domain)
|
||||
|
@ -281,10 +281,10 @@ impl LocalUser {
|
|||
.select(local_user::person_id);
|
||||
|
||||
let mods = community_actions::table
|
||||
.filter(community_actions::became_moderator.is_not_null())
|
||||
.filter(community_actions::became_moderator_at.is_not_null())
|
||||
.filter(community_actions::community_id.eq(for_community_id))
|
||||
.filter(community_actions::person_id.eq_any(&persons))
|
||||
.order_by(community_actions::became_moderator)
|
||||
.order_by(community_actions::became_moderator_at)
|
||||
.select(community_actions::person_id);
|
||||
|
||||
let res = admins.union_all(mods).get_results::<PersonId>(conn).await?;
|
||||
|
|
|
@ -466,7 +466,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
reason: None,
|
||||
removed: true,
|
||||
published: inserted_mod_remove_post.published,
|
||||
published_at: inserted_mod_remove_post.published_at,
|
||||
};
|
||||
|
||||
// lock post
|
||||
|
@ -485,7 +485,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
locked: true,
|
||||
reason: None,
|
||||
published: inserted_mod_lock_post.published,
|
||||
published_at: inserted_mod_lock_post.published_at,
|
||||
};
|
||||
|
||||
// feature post
|
||||
|
@ -504,7 +504,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
featured: false,
|
||||
is_featured_community: true,
|
||||
published: inserted_mod_feature_post.published,
|
||||
published_at: inserted_mod_feature_post.published_at,
|
||||
};
|
||||
|
||||
// comment
|
||||
|
@ -525,7 +525,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
reason: None,
|
||||
removed: true,
|
||||
published: inserted_mod_remove_comment.published,
|
||||
published_at: inserted_mod_remove_comment.published_at,
|
||||
};
|
||||
|
||||
// community
|
||||
|
@ -546,7 +546,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
reason: None,
|
||||
removed: true,
|
||||
published: inserted_mod_remove_community.published,
|
||||
published_at: inserted_mod_remove_community.published_at,
|
||||
};
|
||||
|
||||
// ban from community
|
||||
|
@ -557,7 +557,7 @@ mod tests {
|
|||
community_id: inserted_community.id,
|
||||
reason: None,
|
||||
banned: None,
|
||||
expires: None,
|
||||
expires_at: None,
|
||||
};
|
||||
let inserted_mod_ban_from_community =
|
||||
ModBanFromCommunity::create(pool, &mod_ban_from_community_form).await?;
|
||||
|
@ -570,8 +570,8 @@ mod tests {
|
|||
other_person_id: inserted_person.id,
|
||||
reason: None,
|
||||
banned: true,
|
||||
expires: None,
|
||||
published: inserted_mod_ban_from_community.published,
|
||||
expires_at: None,
|
||||
published_at: inserted_mod_ban_from_community.published_at,
|
||||
};
|
||||
|
||||
// ban
|
||||
|
@ -581,7 +581,7 @@ mod tests {
|
|||
other_person_id: inserted_person.id,
|
||||
reason: None,
|
||||
banned: None,
|
||||
expires: None,
|
||||
expires_at: None,
|
||||
instance_id: inserted_instance.id,
|
||||
};
|
||||
let inserted_mod_ban = ModBan::create(pool, &mod_ban_form).await?;
|
||||
|
@ -592,8 +592,8 @@ mod tests {
|
|||
other_person_id: inserted_person.id,
|
||||
reason: None,
|
||||
banned: true,
|
||||
expires: None,
|
||||
published: inserted_mod_ban.published,
|
||||
expires_at: None,
|
||||
published_at: inserted_mod_ban.published_at,
|
||||
instance_id: inserted_instance.id,
|
||||
};
|
||||
|
||||
|
@ -613,7 +613,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
other_person_id: inserted_person.id,
|
||||
removed: false,
|
||||
published: inserted_mod_add_community.published,
|
||||
published_at: inserted_mod_add_community.published_at,
|
||||
};
|
||||
|
||||
// mod add
|
||||
|
@ -630,7 +630,7 @@ mod tests {
|
|||
mod_person_id: inserted_mod.id,
|
||||
other_person_id: inserted_person.id,
|
||||
removed: false,
|
||||
published: inserted_mod_add.published,
|
||||
published_at: inserted_mod_add.published_at,
|
||||
};
|
||||
|
||||
Comment::delete(pool, inserted_comment.id).await?;
|
||||
|
|
|
@ -36,7 +36,7 @@ impl PasswordResetRequest {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
delete(password_reset_request::table)
|
||||
.filter(password_reset_request::token.eq(token_))
|
||||
.filter(password_reset_request::published.gt(now.into_sql::<Timestamptz>() - 1.days()))
|
||||
.filter(password_reset_request::published_at.gt(now.into_sql::<Timestamptz>() - 1.days()))
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::Deleted)
|
||||
|
@ -93,8 +93,8 @@ mod tests {
|
|||
read_password_reset_request.token
|
||||
);
|
||||
assert_eq!(
|
||||
inserted_password_reset_request.published,
|
||||
read_password_reset_request.published
|
||||
inserted_password_reset_request.published_at,
|
||||
read_password_reset_request.published_at
|
||||
);
|
||||
|
||||
// Cannot reuse same token again
|
||||
|
|
|
@ -106,7 +106,7 @@ impl Person {
|
|||
let not_banned_local_user_id = local_user::table
|
||||
.left_join(instance_actions_join)
|
||||
.filter(local_user::person_id.eq(person_id))
|
||||
.filter(instance_actions::received_ban.nullable().is_null())
|
||||
.filter(instance_actions::received_ban_at.nullable().is_null())
|
||||
.select(local_user::id)
|
||||
.first::<LocalUserId>(conn)
|
||||
.await
|
||||
|
@ -127,7 +127,7 @@ impl Person {
|
|||
person::bio.eq::<Option<String>>(None),
|
||||
person::matrix_user_id.eq::<Option<String>>(None),
|
||||
person::deleted.eq(true),
|
||||
person::updated.eq(Utc::now()),
|
||||
person::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
|
@ -251,7 +251,7 @@ impl Followable for PersonActions {
|
|||
) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(person_actions::table.find((person_id, target_id)))
|
||||
.set_null(person_actions::followed)
|
||||
.set_null(person_actions::followed_at)
|
||||
.set_null(person_actions::follow_pending)
|
||||
.get_result(conn)
|
||||
.await
|
||||
|
@ -280,7 +280,7 @@ impl Blockable for PersonActions {
|
|||
async fn unblock(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(person_actions::table.find((form.person_id, form.target_id)))
|
||||
.set_null(person_actions::blocked)
|
||||
.set_null(person_actions::blocked_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::PersonBlockAlreadyExists)
|
||||
|
@ -294,7 +294,7 @@ impl Blockable for PersonActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
let find_action = person_actions::table
|
||||
.find((person_id, recipient_id))
|
||||
.filter(person_actions::blocked.is_not_null());
|
||||
.filter(person_actions::blocked_at.is_not_null());
|
||||
|
||||
select(not(exists(find_action)))
|
||||
.get_result::<bool>(conn)
|
||||
|
@ -311,7 +311,7 @@ impl Blockable for PersonActions {
|
|||
let target_person_alias = diesel::alias!(person as person1);
|
||||
|
||||
person_actions::table
|
||||
.filter(person_actions::blocked.is_not_null())
|
||||
.filter(person_actions::blocked_at.is_not_null())
|
||||
.inner_join(person::table.on(person_actions::person_id.eq(person::id)))
|
||||
.inner_join(
|
||||
target_person_alias.on(person_actions::target_id.eq(target_person_alias.field(person::id))),
|
||||
|
@ -319,7 +319,7 @@ impl Blockable for PersonActions {
|
|||
.select(target_person_alias.fields(person::all_columns))
|
||||
.filter(person_actions::person_id.eq(person_id))
|
||||
.filter(target_person_alias.field(person::deleted).eq(false))
|
||||
.order_by(person_actions::blocked)
|
||||
.order_by(person_actions::blocked_at)
|
||||
.load::<Person>(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::NotFound)
|
||||
|
@ -333,7 +333,7 @@ impl PersonActions {
|
|||
) -> LemmyResult<Vec<Person>> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
person_actions::table
|
||||
.filter(person_actions::followed.is_not_null())
|
||||
.filter(person_actions::followed_at.is_not_null())
|
||||
.inner_join(person::table.on(person_actions::person_id.eq(person::id)))
|
||||
.filter(person_actions::target_id.eq(for_person_id))
|
||||
.select(person::all_columns)
|
||||
|
@ -380,15 +380,15 @@ mod tests {
|
|||
avatar: None,
|
||||
banner: None,
|
||||
deleted: false,
|
||||
published: inserted_person.published,
|
||||
updated: None,
|
||||
published_at: inserted_person.published_at,
|
||||
updated_at: None,
|
||||
ap_id: inserted_person.ap_id.clone(),
|
||||
bio: None,
|
||||
local: true,
|
||||
bot_account: false,
|
||||
private_key: None,
|
||||
public_key: "pubkey".to_owned(),
|
||||
last_refreshed_at: inserted_person.published,
|
||||
last_refreshed_at: inserted_person.published_at,
|
||||
inbox_url: inserted_person.inbox_url.clone(),
|
||||
matrix_user_id: None,
|
||||
instance_id: inserted_instance.id,
|
||||
|
|
|
@ -91,7 +91,7 @@ impl Post {
|
|||
insert_into(post::table)
|
||||
.values(form)
|
||||
.on_conflict(post::ap_id)
|
||||
.filter_target(coalesce(post::updated, post::published).lt(timestamp))
|
||||
.filter_target(coalesce(post::updated_at, post::published_at).lt(timestamp))
|
||||
.do_update()
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
|
@ -109,7 +109,7 @@ impl Post {
|
|||
.filter(post::deleted.eq(false))
|
||||
.filter(post::removed.eq(false))
|
||||
.filter(post::featured_community.eq(true))
|
||||
.then_order_by(post::published.desc())
|
||||
.then_order_by(post::published_at.desc())
|
||||
.limit(FETCH_LIMIT_MAX.try_into()?)
|
||||
.load::<Self>(conn)
|
||||
.await
|
||||
|
@ -121,12 +121,12 @@ impl Post {
|
|||
) -> LemmyResult<Vec<(DbUrl, chrono::DateTime<Utc>)>> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
post::table
|
||||
.select((post::ap_id, coalesce(post::updated, post::published)))
|
||||
.select((post::ap_id, coalesce(post::updated_at, post::published_at)))
|
||||
.filter(post::local.eq(true))
|
||||
.filter(post::deleted.eq(false))
|
||||
.filter(post::removed.eq(false))
|
||||
.filter(post::published.ge(Utc::now().naive_utc() - SITEMAP_DAYS))
|
||||
.order(post::published.desc())
|
||||
.filter(post::published_at.ge(Utc::now().naive_utc() - SITEMAP_DAYS))
|
||||
.order(post::published_at.desc())
|
||||
.limit(SITEMAP_LIMIT)
|
||||
.load::<(DbUrl, chrono::DateTime<Utc>)>(conn)
|
||||
.await
|
||||
|
@ -145,7 +145,7 @@ impl Post {
|
|||
post::url.eq(Option::<&str>::None),
|
||||
post::body.eq(DELETED_REPLACEMENT_TEXT),
|
||||
post::deleted.eq(true),
|
||||
post::updated.eq(Utc::now()),
|
||||
post::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.get_results::<Self>(conn)
|
||||
.await
|
||||
|
@ -180,7 +180,7 @@ impl Post {
|
|||
|
||||
update(post::table)
|
||||
.filter(post::id.eq_any(post_ids.clone()))
|
||||
.set((post::removed.eq(removed), post::updated.eq(Utc::now())))
|
||||
.set((post::removed.eq(removed), post::updated_at.eq(Utc::now())))
|
||||
.get_results::<Self>(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntUpdatePost)
|
||||
|
@ -198,7 +198,7 @@ impl Post {
|
|||
let object_id: DbUrl = object_id.into();
|
||||
post::table
|
||||
.filter(post::ap_id.eq(object_id))
|
||||
.filter(post::scheduled_publish_time.is_null())
|
||||
.filter(post::scheduled_publish_time_at.is_null())
|
||||
.first(conn)
|
||||
.await
|
||||
.optional()
|
||||
|
@ -229,8 +229,8 @@ impl Post {
|
|||
.inner_join(person::table)
|
||||
.inner_join(community::table)
|
||||
// find all posts which have scheduled_publish_time that is in the future
|
||||
.filter(post::scheduled_publish_time.is_not_null())
|
||||
.filter(coalesce(post::scheduled_publish_time, now()).gt(now()))
|
||||
.filter(post::scheduled_publish_time_at.is_not_null())
|
||||
.filter(coalesce(post::scheduled_publish_time_at, now()).gt(now()))
|
||||
// make sure the post and community are still around
|
||||
.filter(not(post::deleted.or(post::removed)))
|
||||
.filter(not(community::removed.or(community::deleted)))
|
||||
|
@ -258,11 +258,11 @@ impl Post {
|
|||
|
||||
diesel::update(post::table.find(post_id))
|
||||
.set((
|
||||
post::hot_rank.eq(hot_rank(post::score, post::published)),
|
||||
post::hot_rank_active.eq(hot_rank(post::score, post::newest_comment_time_necro)),
|
||||
post::hot_rank.eq(hot_rank(post::score, post::published_at)),
|
||||
post::hot_rank_active.eq(hot_rank(post::score, post::newest_comment_time_necro_at)),
|
||||
post::scaled_rank.eq(scaled_rank(
|
||||
post::score,
|
||||
post::published,
|
||||
post::published_at,
|
||||
interactions_month,
|
||||
)),
|
||||
))
|
||||
|
@ -312,7 +312,7 @@ impl Likeable for PostActions {
|
|||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(post_actions::table.find((person_id, post_id)))
|
||||
.set_null(post_actions::like_score)
|
||||
.set_null(post_actions::liked)
|
||||
.set_null(post_actions::liked_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntLikePost)
|
||||
|
@ -336,7 +336,7 @@ impl Saveable for PostActions {
|
|||
async fn unsave(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<uplete::Count> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
uplete::new(post_actions::table.find((form.person_id, form.post_id)))
|
||||
.set_null(post_actions::saved)
|
||||
.set_null(post_actions::saved_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntSavePost)
|
||||
|
@ -358,7 +358,7 @@ impl Readable for PostActions {
|
|||
.filter(post_actions::post_id.eq(form.post_id))
|
||||
.filter(post_actions::person_id.eq(form.person_id)),
|
||||
)
|
||||
.set_null(post_actions::read)
|
||||
.set_null(post_actions::read_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntMarkPostAsRead)
|
||||
|
@ -371,7 +371,7 @@ impl Readable for PostActions {
|
|||
.values(forms)
|
||||
.on_conflict((post_actions::person_id, post_actions::post_id))
|
||||
.do_update()
|
||||
.set(post_actions::read.eq(now().nullable()))
|
||||
.set(post_actions::read_at.eq(now().nullable()))
|
||||
.execute(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntMarkPostAsRead)
|
||||
|
@ -401,7 +401,7 @@ impl Hideable for PostActions {
|
|||
.filter(post_actions::post_id.eq(form.post_id))
|
||||
.filter(post_actions::person_id.eq(form.person_id)),
|
||||
)
|
||||
.set_null(post_actions::hidden)
|
||||
.set_null(post_actions::hidden_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntHidePost)
|
||||
|
@ -438,7 +438,7 @@ impl ReadComments for PostActions {
|
|||
.filter(post_actions::person_id.eq(person_id)),
|
||||
)
|
||||
.set_null(post_actions::read_comments_amount)
|
||||
.set_null(post_actions::read_comments)
|
||||
.set_null(post_actions::read_comments_at)
|
||||
.get_result(conn)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntUpdateReadComments)
|
||||
|
@ -545,7 +545,7 @@ mod tests {
|
|||
let inserted_post2 = Post::create(pool, &new_post2).await?;
|
||||
|
||||
let new_scheduled_post = PostInsertForm {
|
||||
scheduled_publish_time: Some(DateTime::from_timestamp_nanos(i64::MAX)),
|
||||
scheduled_publish_time_at: Some(DateTime::from_timestamp_nanos(i64::MAX)),
|
||||
..PostInsertForm::new("beans".into(), inserted_person.id, inserted_community.id)
|
||||
};
|
||||
let inserted_scheduled_post = Post::create(pool, &new_scheduled_post).await?;
|
||||
|
@ -558,12 +558,12 @@ mod tests {
|
|||
alt_text: None,
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
published: inserted_post.published,
|
||||
published_at: inserted_post.published_at,
|
||||
removed: false,
|
||||
locked: false,
|
||||
nsfw: false,
|
||||
deleted: false,
|
||||
updated: None,
|
||||
updated_at: None,
|
||||
embed_title: None,
|
||||
embed_description: None,
|
||||
embed_video_url: None,
|
||||
|
@ -574,7 +574,7 @@ mod tests {
|
|||
featured_community: false,
|
||||
featured_local: false,
|
||||
url_content_type: None,
|
||||
scheduled_publish_time: None,
|
||||
scheduled_publish_time_at: None,
|
||||
comments: 0,
|
||||
controversy_rank: 0.0,
|
||||
downvotes: 0,
|
||||
|
@ -582,8 +582,8 @@ mod tests {
|
|||
score: 1,
|
||||
hot_rank: RANK_DEFAULT,
|
||||
hot_rank_active: RANK_DEFAULT,
|
||||
newest_comment_time: inserted_post.published,
|
||||
newest_comment_time_necro: inserted_post.published,
|
||||
newest_comment_time_at: inserted_post.published_at,
|
||||
newest_comment_time_necro_at: inserted_post.published_at,
|
||||
report_count: 0,
|
||||
scaled_rank: RANK_DEFAULT,
|
||||
unresolved_report_count: 0,
|
||||
|
@ -600,7 +600,7 @@ mod tests {
|
|||
let post_saved_form = PostSavedForm::new(inserted_post.id, inserted_person.id);
|
||||
|
||||
let inserted_post_saved = PostActions::save(pool, &post_saved_form).await?;
|
||||
assert!(inserted_post_saved.saved.is_some());
|
||||
assert!(inserted_post_saved.saved_at.is_some());
|
||||
|
||||
// Mark 2 posts as read
|
||||
let post_read_form_1 = PostReadForm::new(inserted_post.id, inserted_person.id);
|
||||
|
|
|
@ -39,7 +39,7 @@ impl Reportable for PostReport {
|
|||
.set((
|
||||
post_report::resolved.eq(true),
|
||||
post_report::resolver_id.eq(by_resolver_id),
|
||||
post_report::updated.eq(Utc::now()),
|
||||
post_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -63,7 +63,7 @@ impl Reportable for PostReport {
|
|||
.set((
|
||||
post_report::resolved.eq(true),
|
||||
post_report::resolver_id.eq(resolver_id),
|
||||
post_report::updated.eq(Utc::now()),
|
||||
post_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -80,7 +80,7 @@ impl Reportable for PostReport {
|
|||
.set((
|
||||
post_report::resolved.eq(true),
|
||||
post_report::resolver_id.eq(by_resolver_id),
|
||||
post_report::updated.eq(Utc::now()),
|
||||
post_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -97,7 +97,7 @@ impl Reportable for PostReport {
|
|||
.set((
|
||||
post_report::resolved.eq(false),
|
||||
post_report::resolver_id.eq(by_resolver_id),
|
||||
post_report::updated.eq(Utc::now()),
|
||||
post_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
|
|
@ -53,7 +53,9 @@ impl PrivateMessage {
|
|||
insert_into(private_message::table)
|
||||
.values(form)
|
||||
.on_conflict(private_message::ap_id)
|
||||
.filter_target(coalesce(private_message::updated, private_message::published).lt(timestamp))
|
||||
.filter_target(
|
||||
coalesce(private_message::updated_at, private_message::published_at).lt(timestamp),
|
||||
)
|
||||
.do_update()
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
|
@ -104,7 +106,7 @@ impl PrivateMessage {
|
|||
diesel::update(private_message::table.filter(private_message::creator_id.eq(for_creator_id)))
|
||||
.set((
|
||||
private_message::removed.eq(removed),
|
||||
private_message::updated.eq(Utc::now()),
|
||||
private_message::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.get_results::<Self>(conn)
|
||||
.await
|
||||
|
@ -160,8 +162,8 @@ mod tests {
|
|||
recipient_id: inserted_recipient.id,
|
||||
deleted: false,
|
||||
read: false,
|
||||
updated: None,
|
||||
published: inserted_private_message.published,
|
||||
updated_at: None,
|
||||
published_at: inserted_private_message.published_at,
|
||||
ap_id: Url::parse(&format!(
|
||||
"https://lemmy-alpha/private_message/{}",
|
||||
inserted_private_message.id
|
||||
|
|
|
@ -11,12 +11,7 @@ use diesel::{
|
|||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::private_message_report::dsl::{
|
||||
private_message_report,
|
||||
resolved,
|
||||
resolver_id,
|
||||
updated,
|
||||
};
|
||||
use lemmy_db_schema_file::schema::private_message_report;
|
||||
use lemmy_utils::error::{FederationError, LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl Reportable for PrivateMessageReport {
|
||||
|
@ -26,7 +21,7 @@ impl Reportable for PrivateMessageReport {
|
|||
|
||||
async fn report(pool: &mut DbPool<'_>, form: &Self::Form) -> LemmyResult<Self> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(private_message_report)
|
||||
insert_into(private_message_report::table)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
|
@ -39,11 +34,11 @@ impl Reportable for PrivateMessageReport {
|
|||
by_resolver_id: PersonId,
|
||||
) -> LemmyResult<usize> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
update(private_message_report.find(report_id))
|
||||
update(private_message_report::table.find(report_id))
|
||||
.set((
|
||||
resolved.eq(true),
|
||||
resolver_id.eq(by_resolver_id),
|
||||
updated.eq(Utc::now()),
|
||||
private_message_report::resolved.eq(true),
|
||||
private_message_report::resolver_id.eq(by_resolver_id),
|
||||
private_message_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
@ -73,11 +68,11 @@ impl Reportable for PrivateMessageReport {
|
|||
by_resolver_id: PersonId,
|
||||
) -> LemmyResult<usize> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
update(private_message_report.find(report_id))
|
||||
update(private_message_report::table.find(report_id))
|
||||
.set((
|
||||
resolved.eq(false),
|
||||
resolver_id.eq(by_resolver_id),
|
||||
updated.eq(Utc::now()),
|
||||
private_message_report::resolved.eq(false),
|
||||
private_message_report::resolver_id.eq(by_resolver_id),
|
||||
private_message_report::updated_at.eq(Utc::now()),
|
||||
))
|
||||
.execute(conn)
|
||||
.await
|
||||
|
|
|
@ -49,7 +49,7 @@ impl Tagline {
|
|||
let limit = limit_fetch(limit)?;
|
||||
let query = tagline::table.limit(limit).into_boxed();
|
||||
let paginated_query = paginate(query, SortDirection::Desc, cursor_data, None, page_back)
|
||||
.then_order_by(key::published)
|
||||
.then_order_by(key::published_at)
|
||||
.then_order_by(key::id);
|
||||
|
||||
paginated_query
|
||||
|
|
|
@ -187,8 +187,8 @@ pub type Person1AliasAllColumnsTuple = (
|
|||
AliasedField<aliases::Person1, person::name>,
|
||||
AliasedField<aliases::Person1, person::display_name>,
|
||||
AliasedField<aliases::Person1, person::avatar>,
|
||||
AliasedField<aliases::Person1, person::published>,
|
||||
AliasedField<aliases::Person1, person::updated>,
|
||||
AliasedField<aliases::Person1, person::published_at>,
|
||||
AliasedField<aliases::Person1, person::updated_at>,
|
||||
AliasedField<aliases::Person1, person::ap_id>,
|
||||
AliasedField<aliases::Person1, person::bio>,
|
||||
AliasedField<aliases::Person1, person::local>,
|
||||
|
@ -214,8 +214,8 @@ pub type Person2AliasAllColumnsTuple = (
|
|||
AliasedField<aliases::Person2, person::name>,
|
||||
AliasedField<aliases::Person2, person::display_name>,
|
||||
AliasedField<aliases::Person2, person::avatar>,
|
||||
AliasedField<aliases::Person2, person::published>,
|
||||
AliasedField<aliases::Person2, person::updated>,
|
||||
AliasedField<aliases::Person2, person::published_at>,
|
||||
AliasedField<aliases::Person2, person::updated_at>,
|
||||
AliasedField<aliases::Person2, person::ap_id>,
|
||||
AliasedField<aliases::Person2, person::bio>,
|
||||
AliasedField<aliases::Person2, person::local>,
|
||||
|
@ -239,13 +239,13 @@ pub type Person2AliasAllColumnsTuple = (
|
|||
pub type CreatorCommunityActionsAllColumnsTuple = (
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::community_id>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::person_id>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::followed>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::followed_at>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::follow_state>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::follow_approver_id>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::blocked>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::became_moderator>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::received_ban>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::ban_expires>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::blocked_at>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::became_moderator_at>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::received_ban_at>,
|
||||
AliasedField<aliases::CreatorCommunityActions, community_actions::ban_expires_at>,
|
||||
);
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -253,9 +253,9 @@ pub type CreatorCommunityActionsAllColumnsTuple = (
|
|||
pub type CreatorHomeInstanceActionsAllColumnsTuple = (
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::person_id>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::instance_id>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::blocked>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::received_ban>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::ban_expires>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::blocked_at>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::received_ban_at>,
|
||||
AliasedField<aliases::CreatorHomeInstanceActions, instance_actions::ban_expires_at>,
|
||||
);
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -263,7 +263,7 @@ pub type CreatorHomeInstanceActionsAllColumnsTuple = (
|
|||
pub type CreatorLocalInstanceActionsAllColumnsTuple = (
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::person_id>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::instance_id>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::blocked>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::received_ban>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::ban_expires>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::blocked_at>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::received_ban_at>,
|
||||
AliasedField<aliases::CreatorLocalInstanceActions, instance_actions::ban_expires_at>,
|
||||
);
|
||||
|
|
|
@ -61,7 +61,7 @@ pub struct SentActivity {
|
|||
pub ap_id: DbUrl,
|
||||
pub data: Value,
|
||||
pub sensitive: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub send_inboxes: Vec<Option<DbUrl>>,
|
||||
pub send_community_followers_of: Option<CommunityId>,
|
||||
pub send_all_instances: bool,
|
||||
|
@ -89,5 +89,5 @@ pub struct SentActivityForm {
|
|||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
pub struct ReceivedActivity {
|
||||
pub ap_id: DbUrl,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use uuid::Uuid;
|
|||
pub struct CaptchaAnswer {
|
||||
pub uuid: Uuid,
|
||||
pub answer: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
|
|
|
@ -25,7 +25,7 @@ use serde_with::skip_serializing_none;
|
|||
/// A combined inbox table.
|
||||
pub struct InboxCombined {
|
||||
pub id: InboxCombinedId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub comment_reply_id: Option<CommentReplyId>,
|
||||
pub person_comment_mention_id: Option<PersonCommentMentionId>,
|
||||
pub person_post_mention_id: Option<PersonPostMentionId>,
|
||||
|
|
|
@ -36,7 +36,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// A combined modlog table.
|
||||
pub struct ModlogCombined {
|
||||
pub id: ModlogCombinedId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub admin_allow_instance_id: Option<AdminAllowInstanceId>,
|
||||
pub admin_block_instance_id: Option<AdminBlockInstanceId>,
|
||||
pub admin_purge_comment_id: Option<AdminPurgeCommentId>,
|
||||
|
|
|
@ -19,7 +19,7 @@ use serde_with::skip_serializing_none;
|
|||
/// A combined table for a persons contents (posts and comments)
|
||||
pub struct PersonContentCombined {
|
||||
pub id: PersonContentCombinedId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub post_id: Option<PostId>,
|
||||
pub comment_id: Option<CommentId>,
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use serde_with::skip_serializing_none;
|
|||
/// A combined person_liked table.
|
||||
pub struct PersonLikedCombined {
|
||||
pub id: PersonLikedCombinedId,
|
||||
pub liked: DateTime<Utc>,
|
||||
pub liked_at: DateTime<Utc>,
|
||||
pub like_score: i16,
|
||||
pub person_id: PersonId,
|
||||
pub post_id: Option<PostId>,
|
||||
|
|
|
@ -19,7 +19,7 @@ use serde_with::skip_serializing_none;
|
|||
/// A combined person_saved table.
|
||||
pub struct PersonSavedCombined {
|
||||
pub id: PersonSavedCombinedId,
|
||||
pub saved: DateTime<Utc>,
|
||||
pub saved_at: DateTime<Utc>,
|
||||
pub person_id: PersonId,
|
||||
pub post_id: Option<PostId>,
|
||||
pub comment_id: Option<CommentId>,
|
||||
|
|
|
@ -25,7 +25,7 @@ use serde_with::skip_serializing_none;
|
|||
/// A combined reports table.
|
||||
pub struct ReportCombined {
|
||||
pub id: ReportCombinedId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub post_report_id: Option<PostReportId>,
|
||||
pub comment_report_id: Option<CommentReportId>,
|
||||
pub private_message_report_id: Option<PrivateMessageReportId>,
|
||||
|
|
|
@ -19,7 +19,7 @@ use serde_with::skip_serializing_none;
|
|||
/// A combined table for a search (posts, comments, communities, persons)
|
||||
pub struct SearchCombined {
|
||||
pub id: SearchCombinedId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub score: i64,
|
||||
pub post_id: Option<PostId>,
|
||||
pub comment_id: Option<CommentId>,
|
||||
|
|
|
@ -37,9 +37,9 @@ pub struct Comment {
|
|||
pub content: String,
|
||||
/// Whether the comment has been removed.
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// Whether the comment has been deleted by its creator.
|
||||
pub deleted: bool,
|
||||
/// The federated activity id / ap_id.
|
||||
|
@ -86,9 +86,9 @@ pub struct CommentInsertForm {
|
|||
#[new(default)]
|
||||
pub removed: Option<bool>,
|
||||
#[new(default)]
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub deleted: Option<bool>,
|
||||
#[new(default)]
|
||||
|
@ -110,7 +110,7 @@ pub struct CommentUpdateForm {
|
|||
pub content: Option<String>,
|
||||
pub removed: Option<bool>,
|
||||
// Don't use a default Utc::now here, because the create function does a lot of comment updates
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
pub deleted: Option<bool>,
|
||||
pub ap_id: Option<DbUrl>,
|
||||
pub local: Option<bool>,
|
||||
|
@ -148,10 +148,10 @@ pub struct CommentActions {
|
|||
pub like_score: Option<i16>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the comment was liked.
|
||||
pub liked: Option<DateTime<Utc>>,
|
||||
pub liked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the comment was saved.
|
||||
pub saved: Option<DateTime<Utc>>,
|
||||
pub saved_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
|
@ -165,7 +165,7 @@ pub struct CommentLikeForm {
|
|||
pub comment_id: CommentId,
|
||||
pub like_score: i16,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub liked: DateTime<Utc>,
|
||||
pub liked_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -175,5 +175,5 @@ pub struct CommentSavedForm {
|
|||
pub person_id: PersonId,
|
||||
pub comment_id: CommentId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub saved: DateTime<Utc>,
|
||||
pub saved_at: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct CommentReply {
|
|||
pub recipient_id: PersonId,
|
||||
pub comment_id: CommentId,
|
||||
pub read: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
|
|
@ -27,9 +27,9 @@ pub struct CommentReport {
|
|||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub violates_instance_rules: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ pub struct Community {
|
|||
pub sidebar: Option<String>,
|
||||
/// Whether the community is removed by a mod.
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// Whether the community has been deleted by its creator.
|
||||
pub deleted: bool,
|
||||
/// Whether its an NSFW community.
|
||||
|
@ -114,9 +114,9 @@ pub struct CommunityInsertForm {
|
|||
#[new(default)]
|
||||
pub removed: Option<bool>,
|
||||
#[new(default)]
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub deleted: Option<bool>,
|
||||
#[new(default)]
|
||||
|
@ -158,8 +158,8 @@ pub struct CommunityUpdateForm {
|
|||
pub title: Option<String>,
|
||||
pub sidebar: Option<Option<String>>,
|
||||
pub removed: Option<bool>,
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
pub deleted: Option<bool>,
|
||||
pub nsfw: Option<bool>,
|
||||
pub ap_id: Option<DbUrl>,
|
||||
|
@ -208,7 +208,7 @@ pub struct CommunityActions {
|
|||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the community was followed.
|
||||
pub followed: Option<DateTime<Utc>>,
|
||||
pub followed_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The state of the community follow.
|
||||
pub follow_state: Option<CommunityFollowerState>,
|
||||
|
@ -217,16 +217,16 @@ pub struct CommunityActions {
|
|||
pub follow_approver_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the community was blocked.
|
||||
pub blocked: Option<DateTime<Utc>>,
|
||||
pub blocked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When this user became a moderator.
|
||||
pub became_moderator: Option<DateTime<Utc>>,
|
||||
pub became_moderator_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When this user received a ban.
|
||||
pub received_ban: Option<DateTime<Utc>>,
|
||||
pub received_ban_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When their ban expires.
|
||||
pub ban_expires: Option<DateTime<Utc>>,
|
||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
|
@ -236,7 +236,7 @@ pub struct CommunityModeratorForm {
|
|||
pub community_id: CommunityId,
|
||||
pub person_id: PersonId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub became_moderator: DateTime<Utc>,
|
||||
pub became_moderator_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
|
@ -246,9 +246,9 @@ pub struct CommunityPersonBanForm {
|
|||
pub community_id: CommunityId,
|
||||
pub person_id: PersonId,
|
||||
#[new(default)]
|
||||
pub ban_expires: Option<Option<DateTime<Utc>>>,
|
||||
pub ban_expires_at: Option<Option<DateTime<Utc>>>,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub received_ban: DateTime<Utc>,
|
||||
pub received_ban_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
|
@ -261,7 +261,7 @@ pub struct CommunityFollowerForm {
|
|||
#[new(default)]
|
||||
pub follow_approver_id: Option<PersonId>,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub followed: DateTime<Utc>,
|
||||
pub followed_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -271,5 +271,5 @@ pub struct CommunityBlockForm {
|
|||
pub community_id: CommunityId,
|
||||
pub person_id: PersonId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub blocked: DateTime<Utc>,
|
||||
pub blocked_at: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ pub struct CommunityReport {
|
|||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
|
@ -20,9 +20,9 @@ pub struct CustomEmoji {
|
|||
pub image_url: DbUrl,
|
||||
pub alt_text: String,
|
||||
pub category: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, derive_new::new)]
|
||||
|
|
|
@ -12,7 +12,7 @@ pub struct EmailVerification {
|
|||
pub local_user_id: LocalUserId,
|
||||
pub email: String,
|
||||
pub verification_token: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
|
|
@ -19,8 +19,8 @@ use std::fmt::Debug;
|
|||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
pub struct FederationAllowList {
|
||||
pub instance_id: InstanceId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
@ -28,5 +28,5 @@ pub struct FederationAllowList {
|
|||
#[cfg_attr(feature = "full", diesel(table_name = federation_allowlist))]
|
||||
pub struct FederationAllowListForm {
|
||||
pub instance_id: InstanceId,
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ use {lemmy_db_schema_file::schema::federation_blocklist, ts_rs::TS};
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
pub struct FederationBlockList {
|
||||
pub instance_id: InstanceId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
@ -32,6 +32,6 @@ pub struct FederationBlockList {
|
|||
#[cfg_attr(feature = "full", diesel(table_name = federation_blocklist))]
|
||||
pub struct FederationBlockListForm {
|
||||
pub instance_id: InstanceId,
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ pub struct FederationQueueState {
|
|||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_successful_id: Option<ActivityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_successful_published_time: Option<DateTime<Utc>>,
|
||||
pub last_successful_published_time_at: Option<DateTime<Utc>>,
|
||||
/// how many failed attempts have been made to send the next activity
|
||||
pub fail_count: i32,
|
||||
/// timestamp of the last retry attempt (when the last failing activity was resent)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_retry: Option<DateTime<Utc>>,
|
||||
pub last_retry_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ use {
|
|||
#[cfg_attr(feature = "full", cursor_keys_module(name = local_image_keys))]
|
||||
pub struct LocalImage {
|
||||
pub pictrs_alias: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// This means the image is an auto-generated thumbnail, for a post.
|
||||
|
@ -57,7 +57,7 @@ pub struct LocalImageForm {
|
|||
#[cfg_attr(feature = "full", diesel(primary_key(link)))]
|
||||
pub struct RemoteImage {
|
||||
pub link: DbUrl,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
|
|
|
@ -19,10 +19,10 @@ use ts_rs::TS;
|
|||
pub struct Instance {
|
||||
pub id: InstanceId,
|
||||
pub domain: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the instance was updated.
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The software of the instance.
|
||||
pub software: Option<String>,
|
||||
|
@ -41,7 +41,7 @@ pub struct InstanceForm {
|
|||
#[new(default)]
|
||||
pub version: Option<String>,
|
||||
#[new(default)]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
|
@ -64,13 +64,13 @@ pub struct InstanceActions {
|
|||
pub instance_id: InstanceId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the instance was blocked.
|
||||
pub blocked: Option<DateTime<Utc>>,
|
||||
pub blocked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When this user received a site ban.
|
||||
pub received_ban: Option<DateTime<Utc>>,
|
||||
pub received_ban_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When their ban expires.
|
||||
pub ban_expires: Option<DateTime<Utc>>,
|
||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -80,7 +80,7 @@ pub struct InstanceBlockForm {
|
|||
pub person_id: PersonId,
|
||||
pub instance_id: InstanceId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub blocked: DateTime<Utc>,
|
||||
pub blocked_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -90,6 +90,6 @@ pub struct InstanceBanForm {
|
|||
pub person_id: PersonId,
|
||||
pub instance_id: InstanceId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub received_ban: DateTime<Utc>,
|
||||
pub ban_expires: Option<DateTime<Utc>>,
|
||||
pub received_ban_at: DateTime<Utc>,
|
||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
|
|
@ -56,9 +56,9 @@ pub struct LocalSite {
|
|||
pub captcha_enabled: bool,
|
||||
/// The captcha difficulty.
|
||||
pub captcha_difficulty: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub registration_mode: RegistrationMode,
|
||||
/// Whether to email admins on new reports.
|
||||
pub reports_email_admins: bool,
|
||||
|
@ -185,7 +185,7 @@ pub struct LocalSiteUpdateForm {
|
|||
pub captcha_difficulty: Option<String>,
|
||||
pub registration_mode: Option<RegistrationMode>,
|
||||
pub reports_email_admins: Option<bool>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
pub federation_signed_fetch: Option<bool>,
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
|
|
|
@ -33,9 +33,9 @@ pub struct LocalSiteRateLimit {
|
|||
pub comment_per_second: i32,
|
||||
pub search: i32,
|
||||
pub search_per_second: i32,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub import_user_settings: i32,
|
||||
pub import_user_settings_per_second: i32,
|
||||
}
|
||||
|
@ -93,5 +93,5 @@ pub struct LocalSiteRateLimitUpdateForm {
|
|||
pub search_per_second: Option<i32>,
|
||||
pub import_user_settings: Option<i32>,
|
||||
pub import_user_settings_per_second: Option<i32>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ use ts_rs::TS;
|
|||
pub struct LocalSiteUrlBlocklist {
|
||||
pub id: i32,
|
||||
pub url: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
|
@ -25,5 +25,5 @@ pub struct LocalSiteUrlBlocklist {
|
|||
#[cfg_attr(feature = "full", diesel(table_name = local_site_url_blocklist))]
|
||||
pub struct LocalSiteUrlBlocklistForm {
|
||||
pub url: String,
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ pub struct LocalUser {
|
|||
pub auto_mark_fetched_posts_as_read: bool,
|
||||
/// The last time a donation request was shown to this user. If this is more than a year ago,
|
||||
/// a new notification request should be shown.
|
||||
pub last_donation_notification: DateTime<Utc>,
|
||||
pub last_donation_notification_at: DateTime<Utc>,
|
||||
/// Whether to hide posts containing images/videos
|
||||
pub hide_media: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
|
@ -145,7 +145,7 @@ pub struct LocalUserInsertForm {
|
|||
#[new(default)]
|
||||
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
||||
#[new(default)]
|
||||
pub last_donation_notification: Option<DateTime<Utc>>,
|
||||
pub last_donation_notification_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub hide_media: Option<bool>,
|
||||
#[new(default)]
|
||||
|
@ -190,7 +190,7 @@ pub struct LocalUserUpdateForm {
|
|||
pub collapse_bot_comments: Option<bool>,
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
||||
pub last_donation_notification: Option<DateTime<Utc>>,
|
||||
pub last_donation_notification_at: Option<DateTime<Utc>>,
|
||||
pub hide_media: Option<bool>,
|
||||
pub default_post_time_range_seconds: Option<Option<i32>>,
|
||||
pub show_score: Option<bool>,
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct LoginToken {
|
|||
pub token: SensitiveString,
|
||||
pub user_id: LocalUserId,
|
||||
/// Time of login
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
/// IP address where login was made from, allows invalidating logins by IP address.
|
||||
/// Could be stored in truncated format, or store derived information for better privacy.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
|
|
|
@ -37,7 +37,7 @@ pub struct AdminPurgePerson {
|
|||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -59,7 +59,7 @@ pub struct AdminPurgeCommunity {
|
|||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -82,7 +82,7 @@ pub struct AdminPurgePost {
|
|||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -106,7 +106,7 @@ pub struct AdminPurgeComment {
|
|||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -137,7 +137,7 @@ pub struct AdminAllowInstance {
|
|||
pub allowed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
@ -171,8 +171,8 @@ pub struct AdminBlockInstance {
|
|||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
|
|
@ -51,7 +51,7 @@ pub struct ModRemovePost {
|
|||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -74,7 +74,7 @@ pub struct ModLockPost {
|
|||
pub mod_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
pub locked: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ pub struct ModFeaturePost {
|
|||
pub mod_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
pub featured: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub is_featured_community: bool,
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ pub struct ModRemoveComment {
|
|||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -152,7 +152,7 @@ pub struct ModRemoveCommunity {
|
|||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -180,8 +180,8 @@ pub struct ModBanFromCommunity {
|
|||
pub reason: Option<String>,
|
||||
pub banned: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -192,7 +192,7 @@ pub struct ModBanFromCommunityForm {
|
|||
pub community_id: CommunityId,
|
||||
pub reason: Option<String>,
|
||||
pub banned: Option<bool>,
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
|
@ -210,8 +210,8 @@ pub struct ModBan {
|
|||
pub reason: Option<String>,
|
||||
pub banned: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub instance_id: InstanceId,
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ pub struct ModChangeCommunityVisibility {
|
|||
pub id: ModChangeCommunityVisibilityId,
|
||||
pub community_id: CommunityId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub visibility: CommunityVisibility,
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ pub struct ModBanForm {
|
|||
pub other_person_id: PersonId,
|
||||
pub reason: Option<String>,
|
||||
pub banned: Option<bool>,
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub instance_id: InstanceId,
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ pub struct ModAddCommunity {
|
|||
pub other_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -283,7 +283,7 @@ pub struct ModTransferCommunity {
|
|||
pub mod_person_id: PersonId,
|
||||
pub other_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
@ -305,7 +305,7 @@ pub struct ModAdd {
|
|||
pub mod_person_id: PersonId,
|
||||
pub other_person_id: PersonId,
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
|
|
@ -18,9 +18,9 @@ pub struct OAuthAccount {
|
|||
pub local_user_id: LocalUserId,
|
||||
pub oauth_provider_id: OAuthProviderId,
|
||||
pub oauth_user_id: String,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, derive_new::new)]
|
||||
|
|
|
@ -59,9 +59,9 @@ pub struct OAuthProvider {
|
|||
pub account_linking_enabled: bool,
|
||||
/// switch to enable or disable an oauth provider
|
||||
pub enabled: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// switch to enable or disable PKCE
|
||||
pub use_pkce: bool,
|
||||
}
|
||||
|
@ -124,5 +124,5 @@ pub struct OAuthProviderUpdateForm {
|
|||
pub account_linking_enabled: Option<bool>,
|
||||
pub use_pkce: Option<bool>,
|
||||
pub enabled: Option<bool>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use lemmy_db_schema_file::schema::password_reset_request;
|
|||
pub struct PasswordResetRequest {
|
||||
pub id: i32,
|
||||
pub token: SensitiveString,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub local_user_id: LocalUserId,
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ pub struct Person {
|
|||
/// A URL for an avatar.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub avatar: Option<DbUrl>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// The federated ap_id.
|
||||
pub ap_id: DbUrl,
|
||||
/// An optional bio, in markdown.
|
||||
|
@ -83,9 +83,9 @@ pub struct PersonInsertForm {
|
|||
#[new(default)]
|
||||
pub avatar: Option<DbUrl>,
|
||||
#[new(default)]
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub ap_id: Option<DbUrl>,
|
||||
#[new(default)]
|
||||
|
@ -114,7 +114,7 @@ pub struct PersonInsertForm {
|
|||
pub struct PersonUpdateForm {
|
||||
pub display_name: Option<Option<String>>,
|
||||
pub avatar: Option<Option<DbUrl>>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
pub ap_id: Option<DbUrl>,
|
||||
pub bio: Option<Option<String>>,
|
||||
pub local: Option<bool>,
|
||||
|
@ -145,12 +145,12 @@ pub struct PersonActions {
|
|||
#[serde(skip)]
|
||||
pub person_id: PersonId,
|
||||
#[serde(skip)]
|
||||
pub followed: Option<DateTime<Utc>>,
|
||||
pub followed_at: Option<DateTime<Utc>>,
|
||||
#[serde(skip)]
|
||||
pub follow_pending: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the person was blocked.
|
||||
pub blocked: Option<DateTime<Utc>>,
|
||||
pub blocked_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
|
@ -161,7 +161,7 @@ pub struct PersonFollowerForm {
|
|||
pub person_id: PersonId,
|
||||
pub follow_pending: bool,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub followed: DateTime<Utc>,
|
||||
pub followed_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -172,5 +172,5 @@ pub struct PersonBlockForm {
|
|||
pub person_id: PersonId,
|
||||
pub target_id: PersonId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub blocked: DateTime<Utc>,
|
||||
pub blocked_at: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct PersonCommentMention {
|
|||
pub recipient_id: PersonId,
|
||||
pub comment_id: CommentId,
|
||||
pub read: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct PersonPostMention {
|
|||
pub recipient_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
pub read: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
|
|
|
@ -35,9 +35,9 @@ pub struct Post {
|
|||
pub removed: bool,
|
||||
/// Whether the post is locked.
|
||||
pub locked: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// Whether the post is deleted.
|
||||
pub deleted: bool,
|
||||
/// Whether the post is NSFW.
|
||||
|
@ -70,16 +70,16 @@ pub struct Post {
|
|||
pub alt_text: Option<String>,
|
||||
/// Time at which the post will be published. None means publish immediately.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scheduled_publish_time: Option<DateTime<Utc>>,
|
||||
pub scheduled_publish_time_at: Option<DateTime<Utc>>,
|
||||
pub comments: i64,
|
||||
pub score: i64,
|
||||
pub upvotes: i64,
|
||||
pub downvotes: i64,
|
||||
#[serde(skip)]
|
||||
/// A newest comment time, limited to 2 days, to prevent necrobumping
|
||||
pub newest_comment_time_necro: DateTime<Utc>,
|
||||
pub newest_comment_time_necro_at: DateTime<Utc>,
|
||||
/// The time of the newest comment in the post.
|
||||
pub newest_comment_time: DateTime<Utc>,
|
||||
pub newest_comment_time_at: DateTime<Utc>,
|
||||
#[serde(skip)]
|
||||
pub hot_rank: f64,
|
||||
#[serde(skip)]
|
||||
|
@ -118,9 +118,9 @@ pub struct PostInsertForm {
|
|||
#[new(default)]
|
||||
pub locked: Option<bool>,
|
||||
#[new(default)]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub deleted: Option<bool>,
|
||||
#[new(default)]
|
||||
|
@ -146,7 +146,7 @@ pub struct PostInsertForm {
|
|||
#[new(default)]
|
||||
pub alt_text: Option<String>,
|
||||
#[new(default)]
|
||||
pub scheduled_publish_time: Option<DateTime<Utc>>,
|
||||
pub scheduled_publish_time_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub federation_pending: Option<bool>,
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ pub struct PostUpdateForm {
|
|||
pub body: Option<Option<String>>,
|
||||
pub removed: Option<bool>,
|
||||
pub locked: Option<bool>,
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
pub deleted: Option<bool>,
|
||||
pub embed_title: Option<Option<String>>,
|
||||
pub embed_description: Option<Option<String>>,
|
||||
|
@ -175,7 +175,7 @@ pub struct PostUpdateForm {
|
|||
pub featured_local: Option<bool>,
|
||||
pub url_content_type: Option<Option<String>>,
|
||||
pub alt_text: Option<Option<String>>,
|
||||
pub scheduled_publish_time: Option<Option<DateTime<Utc>>>,
|
||||
pub scheduled_publish_time_at: Option<Option<DateTime<Utc>>>,
|
||||
pub federation_pending: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -204,26 +204,26 @@ pub struct PostActions {
|
|||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was read.
|
||||
pub read: Option<DateTime<Utc>>,
|
||||
pub read_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When was the last time you read the comments.
|
||||
pub read_comments: Option<DateTime<Utc>>,
|
||||
pub read_comments_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The number of comments you read last. Subtract this from total comments to get an unread
|
||||
/// count.
|
||||
pub read_comments_amount: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was saved.
|
||||
pub saved: Option<DateTime<Utc>>,
|
||||
pub saved_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was liked.
|
||||
pub liked: Option<DateTime<Utc>>,
|
||||
pub liked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The like / score of the post.
|
||||
pub like_score: Option<i16>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was hidden.
|
||||
pub hidden: Option<DateTime<Utc>>,
|
||||
pub hidden_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
|
@ -237,7 +237,7 @@ pub struct PostLikeForm {
|
|||
pub person_id: PersonId,
|
||||
pub like_score: i16,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub liked: DateTime<Utc>,
|
||||
pub liked_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -247,7 +247,7 @@ pub struct PostSavedForm {
|
|||
pub post_id: PostId,
|
||||
pub person_id: PersonId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub saved: DateTime<Utc>,
|
||||
pub saved_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new, Clone)]
|
||||
|
@ -257,7 +257,7 @@ pub struct PostReadForm {
|
|||
pub post_id: PostId,
|
||||
pub person_id: PersonId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub read: DateTime<Utc>,
|
||||
pub read_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -268,7 +268,7 @@ pub struct PostReadCommentsForm {
|
|||
pub person_id: PersonId,
|
||||
pub read_comments_amount: i64,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub read_comments: DateTime<Utc>,
|
||||
pub read_comments_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(derive_new::new)]
|
||||
|
@ -278,5 +278,5 @@ pub struct PostHideForm {
|
|||
pub post_id: PostId,
|
||||
pub person_id: PersonId,
|
||||
#[new(value = "Utc::now()")]
|
||||
pub hidden: DateTime<Utc>,
|
||||
pub hidden_at: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ pub struct PostReport {
|
|||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub violates_instance_rules: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use serde::{Deserialize, Serialize};
|
|||
pub struct PostTag {
|
||||
pub post_id: PostId,
|
||||
pub tag_id: TagId,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -28,9 +28,9 @@ pub struct PrivateMessage {
|
|||
pub content: String,
|
||||
pub deleted: bool,
|
||||
pub read: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub ap_id: DbUrl,
|
||||
pub local: bool,
|
||||
pub removed: bool,
|
||||
|
@ -51,9 +51,9 @@ pub struct PrivateMessageInsertForm {
|
|||
#[new(default)]
|
||||
pub read: Option<bool>,
|
||||
#[new(default)]
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[new(default)]
|
||||
pub ap_id: Option<DbUrl>,
|
||||
#[new(default)]
|
||||
|
@ -67,8 +67,8 @@ pub struct PrivateMessageUpdateForm {
|
|||
pub content: Option<String>,
|
||||
pub deleted: Option<bool>,
|
||||
pub read: Option<bool>,
|
||||
pub published: Option<DateTime<Utc>>,
|
||||
pub updated: Option<Option<DateTime<Utc>>>,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<Option<DateTime<Utc>>>,
|
||||
pub ap_id: Option<DbUrl>,
|
||||
pub local: Option<bool>,
|
||||
pub removed: Option<bool>,
|
||||
|
|
|
@ -31,9 +31,9 @@ pub struct PrivateMessageReport {
|
|||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue