"eslint": "^7.30.0",
"eslint-plugin-jane": "^9.0.3",
"jest": "^27.0.6",
- "lemmy-js-client": "0.17.0-rc.2",
+ "lemmy-js-client": "0.17.0-rc.3",
"node-fetch": "^2.6.1",
"prettier": "^2.3.2",
"ts-jest": "^27.0.3",
dependencies:
language-subtag-registry "~0.3.2"
-lemmy-js-client@0.17.0-rc.2:
- version "0.17.0-rc.2"
- resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.2.tgz#4e6ff9a8d83ac922cd36eeaa01c657b3b93309e6"
- integrity sha512-2YkZiAkq2ZUHPSl/B7pvMMkI19XRtTKwLFJ1u4NT2BlFkNdlvkvkOddnJ6aRwKAp/WBohxoKLoDHhlwePS5gqA==
+lemmy-js-client@0.17.0-rc.3:
+ version "0.17.0-rc.3"
+ resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.3.tgz#3c9b3d5e3346eed8cb8096dad527e72096052223"
+ integrity sha512-VwKSkjqZhsTrtlKTKs9DEVaj9rlmMEjzn/BxkizU9v03Km7OIs9Z7cOEfperOR9A6q5gh2hWfTDp5eV/0kYkVg==
leven@^3.1.0:
version "3.1.0"
let community_follower_form = CommunityFollowerForm {
community_id: data.community_id,
person_id: banned_person_id,
- pending: false,
+ pending: Some(false),
};
blocking(context.pool(), move |conn: &'_ _| {
CommunityFollower::unfollow(conn, &community_follower_form)
let community_follower_form = CommunityFollowerForm {
community_id: data.community_id,
person_id,
- pending: false,
+ pending: Some(false),
};
blocking(context.pool(), move |conn: &'_ _| {
CommunityFollower::unfollow(conn, &community_follower_form)
let community_follower_form = CommunityFollowerForm {
community_id: data.community_id,
person_id: local_user_view.person.id,
- pending: false, // Don't worry, this form isn't used for remote follows
+ pending: Some(false), // Don't worry, this form isn't used for remote follows
};
if community.local {
let community_follower_form = CommunityFollowerForm {
community_id: inserted_community.id,
person_id: local_user_view.person.id,
- pending: false,
+ pending: Some(false),
};
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
let community_follower_form = CommunityFollowerForm {
community_id: main_community.id,
person_id: inserted_person.id,
- pending: false,
+ pending: Some(false),
};
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
let community_follower_form = CommunityFollowerForm {
community_id: community.id,
person_id: blocked_person.id,
- pending: false,
+ pending: Some(false),
};
blocking(context.pool(), move |conn: &'_ _| {
CommunityFollower::unfollow(conn, &community_follower_form)
let community_follower_form = CommunityFollowerForm {
community_id: community.id,
person_id: actor.id,
- pending: true,
+ pending: Some(true),
};
blocking(context.pool(), move |conn| {
CommunityFollower::follow(conn, &community_follower_form).ok()
let community_follower_form = CommunityFollowerForm {
community_id: community.id,
person_id: person.id,
- pending: false,
+ pending: Some(false),
};
// This will fail if they're already a follower, but ignore the error.
let community_follower_form = CommunityFollowerForm {
community_id: community.id,
person_id: person.id,
- pending: false,
+ pending: Some(false),
};
// This will fail if they aren't a follower, but ignore the error.
let first_person_follow = CommunityFollowerForm {
community_id: inserted_community.id,
person_id: inserted_person.id,
- pending: false,
+ pending: Some(false),
};
CommunityFollower::follow(&conn, &first_person_follow).unwrap();
let second_person_follow = CommunityFollowerForm {
community_id: inserted_community.id,
person_id: another_inserted_person.id,
- pending: false,
+ pending: Some(false),
};
CommunityFollower::follow(&conn, &second_person_follow).unwrap();
let another_community_follow = CommunityFollowerForm {
community_id: another_inserted_community.id,
person_id: inserted_person.id,
- pending: false,
+ pending: Some(false),
};
CommunityFollower::follow(&conn, &another_community_follow).unwrap();
let community_follower_form = CommunityFollowerForm {
community_id: inserted_community.id,
person_id: inserted_person.id,
- pending: false,
+ pending: Some(false),
};
let inserted_community_follower =
id: inserted_community_follower.id,
community_id: inserted_community.id,
person_id: inserted_person.id,
- pending: Some(false),
+ pending: false,
published: inserted_community_follower.published,
};
community_id -> Int4,
person_id -> Int4,
published -> Timestamp,
- pending -> Nullable<Bool>,
+ pending -> Bool,
}
}
pub community_id: CommunityId,
pub person_id: PersonId,
pub published: chrono::NaiveDateTime,
- pub pending: Option<bool>,
+ pub pending: bool,
}
#[derive(Clone)]
pub struct CommunityFollowerForm {
pub community_id: CommunityId,
pub person_id: PersonId,
- pub pending: bool,
+ pub pending: Option<bool>,
}
traits::{ToSafe, ViewToVec},
};
-type CommunityFollowerViewTuple = (CommunitySafe, PersonSafe, Option<bool>);
+type CommunityFollowerViewTuple = (CommunitySafe, PersonSafe, bool);
impl CommunityFollowerView {
pub fn for_community(conn: &PgConnection, community_id: CommunityId) -> Result<Vec<Self>, Error> {
pub struct CommunityFollowerView {
pub community: CommunitySafe,
pub follower: PersonSafe,
- pub pending: Option<bool>,
+ pub pending: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
--- /dev/null
+-- This file should undo anything in `up.sql`
+
+alter table community_follower
+ alter column pending drop not null,
+ alter column pending set default false;
--- /dev/null
+-- Make the pending column not null
+
+update community_follower set pending = true where pending is null;
+
+alter table community_follower
+ alter column pending set not null,
+ alter column pending set default true;
+