Remove trailing 07 from method name

This commit is contained in:
Kitaiti Makoto 2022-05-03 02:11:46 +09:00
parent 6282b98b03
commit d23002b817
15 changed files with 70 additions and 70 deletions

View file

@ -221,10 +221,10 @@ impl Blog {
Ok(CustomGroup::new(blog, ap_signature, source))
}
pub fn outbox07(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
self.outbox_collection07(conn).map(ActivityStream::new)
pub fn outbox(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
self.outbox_collection(conn).map(ActivityStream::new)
}
pub fn outbox_collection07(&self, conn: &Connection) -> Result<OrderedCollection> {
pub fn outbox_collection(&self, conn: &Connection) -> Result<OrderedCollection> {
let acts = self.get_activities(conn);
let acts = acts
.iter()
@ -245,15 +245,15 @@ impl Blog {
);
Ok(coll)
}
pub fn outbox_page07(
pub fn outbox_page(
&self,
conn: &Connection,
(min, max): (i32, i32),
) -> Result<ActivityStream<OrderedCollectionPage>> {
self.outbox_collection_page07(conn, (min, max))
self.outbox_collection_page(conn, (min, max))
.map(ActivityStream::new)
}
pub fn outbox_collection_page07(
pub fn outbox_collection_page(
&self,
conn: &Connection,
(min, max): (i32, i32),
@ -917,7 +917,7 @@ pub(crate) mod tests {
}
#[test]
fn self_federation07() {
fn self_federation() {
let conn = &db();
conn.test_transaction::<_, (), _>(|| {
let (users, mut blogs) = fill_database(&conn);
@ -1019,12 +1019,12 @@ pub(crate) mod tests {
}
#[test]
fn outbox_collection07() {
fn outbox_collection() {
let conn = &db();
conn.test_transaction::<_, Error, _>(|| {
let (_users, blogs) = fill_database(conn);
let blog = &blogs[0];
let act = blog.outbox_collection07(conn)?;
let act = blog.outbox_collection(conn)?;
let expected = json!({
"items": [],
@ -1041,12 +1041,12 @@ pub(crate) mod tests {
}
#[test]
fn outbox_collection_page07() {
fn outbox_collection_page() {
let conn = &db();
conn.test_transaction::<_, Error, _>(|| {
let (_users, blogs) = fill_database(conn);
let blog = &blogs[0];
let act = blog.outbox_collection_page07(conn, (33, 36))?;
let act = blog.outbox_collection_page(conn, (33, 36))?;
let expected = json!({
"next": "https://plu.me/~/BlogName/outbox?page=3",

View file

@ -196,7 +196,7 @@ impl Comment {
Ok(())
}
pub fn build_delete07(&self, conn: &Connection) -> Result<Delete> {
pub fn build_delete(&self, conn: &Connection) -> Result<Delete> {
let mut tombstone = Tombstone::new();
tombstone.set_id(
self.ap_url
@ -454,7 +454,7 @@ mod tests {
// creates a post, get it's Create activity, delete the post,
// "send" the Create to the inbox, and check it works
#[test]
fn self_federation07() {
fn self_federation() {
let conn = &db();
conn.test_transaction::<_, (), _>(|| {
let (original_comm, posts, users, _blogs) = prepare_activity(&conn);
@ -523,7 +523,7 @@ mod tests {
inbox(
&conn,
serde_json::to_value(original_comm.build_delete07(&conn).unwrap()).unwrap(),
serde_json::to_value(original_comm.build_delete(&conn).unwrap()).unwrap(),
)
.unwrap();
@ -576,11 +576,11 @@ mod tests {
}
#[test]
fn build_delete07() {
fn build_delete() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (comment, _posts, _users, _blogs) = prepare_activity(&conn);
let act = comment.build_delete07(&conn)?;
let act = comment.build_delete(&conn)?;
let expected = json!({
"actor": "https://plu.me/@/admin/",

View file

@ -84,7 +84,7 @@ impl Follow {
/// from -> The one sending the follow request
/// target -> The target of the request, responding with Accept
pub fn accept_follow07<A: Signer + IntoId + Clone, B: Clone + AsActor<T> + IntoId, T>(
pub fn accept_follow<A: Signer + IntoId + Clone, B: Clone + AsActor<T> + IntoId, T>(
conn: &Connection,
from: &B,
target: &A,
@ -105,7 +105,7 @@ impl Follow {
)?;
res.notify(conn)?;
let accept = res.build_accept07(from, target, follow)?;
let accept = res.build_accept(from, target, follow)?;
broadcast(
&*target,
accept,
@ -115,7 +115,7 @@ impl Follow {
Ok(res)
}
pub fn build_accept07<A: Signer + IntoId + Clone, B: Clone + AsActor<T> + IntoId, T>(
pub fn build_accept<A: Signer + IntoId + Clone, B: Clone + AsActor<T> + IntoId, T>(
&self,
from: &B,
target: &A,
@ -137,7 +137,7 @@ impl Follow {
Ok(accept)
}
pub fn build_undo07(&self, conn: &Connection) -> Result<Undo> {
pub fn build_undo(&self, conn: &Connection) -> Result<Undo> {
let mut undo = Undo::new(
User::get(conn, self.follower_id)?
.ap_url
@ -164,7 +164,7 @@ impl AsObject<User, FollowAct, &DbConn> for User {
let mut follow =
FollowAct::new(id.parse::<IriString>()?, actor.ap_url.parse::<IriString>()?);
follow.set_id(id.parse::<IriString>()?);
Follow::accept_follow07(conn, &actor, &self, follow, actor.id, self.id)
Follow::accept_follow(conn, &actor, &self, follow, actor.id, self.id)
}
}
@ -200,7 +200,7 @@ impl FromId<DbConn> for Follow {
CONFIG.proxy(),
)
.map_err(|(_, e)| e)?;
Follow::accept_follow07(conn, &actor, &target, follow, actor.id, target.id)
Follow::accept_follow(conn, &actor, &target, follow, actor.id, target.id)
}
fn get_sender() -> &'static dyn Signer {
@ -319,11 +319,11 @@ mod tests {
}
#[test]
fn build_accept07() {
fn build_accept() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (follow, following, follower, _users) = prepare_activity(&conn);
let act = follow.build_accept07(&follower, &following, follow.to_activity(&conn)?)?;
let act = follow.build_accept(&follower, &following, follow.to_activity(&conn)?)?;
let expected = json!({
"actor": "https://plu.me/@/user/",
@ -348,11 +348,11 @@ mod tests {
}
#[test]
fn build_undo07() {
fn build_undo() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (follow, _following, _follower, _users) = prepare_activity(&conn);
let act = follow.build_undo07(&conn)?;
let act = follow.build_undo(&conn)?;
let expected = json!({
"actor": "https://plu.me/@/other/",

View file

@ -70,7 +70,7 @@ impl Like {
Ok(())
}
pub fn build_undo07(&self, conn: &Connection) -> Result<Undo> {
pub fn build_undo(&self, conn: &Connection) -> Result<Undo> {
let mut act = Undo::new(
User::get(conn, self.user_id)?.ap_url.parse::<IriString>()?,
AnyBase::from_extended(self.to_activity(conn)?)?,
@ -217,14 +217,14 @@ mod tests {
}
#[test]
fn build_undo07() {
fn build_undo() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (posts, _users, _blogs) = fill_database(&conn);
let post = &posts[0];
let user = &post.get_authors(&conn)?[0];
let like = Like::insert(&*conn, NewLike::new(post, user))?;
let act = like.build_undo07(&*conn)?;
let act = like.build_undo(&*conn)?;
let expected = json!({
"actor": "https://plu.me/@/admin/",

View file

@ -445,7 +445,7 @@ impl Post {
Ok(act)
}
pub fn update_mentions07(&self, conn: &Connection, mentions: Vec<link::Mention>) -> Result<()> {
pub fn update_mentions(&self, conn: &Connection, mentions: Vec<link::Mention>) -> Result<()> {
let mentions = mentions
.into_iter()
.map(|m| {
@ -483,7 +483,7 @@ impl Post {
Ok(())
}
pub fn update_tags07(&self, conn: &Connection, tags: Vec<Hashtag>) -> Result<()> {
pub fn update_tags(&self, conn: &Connection, tags: Vec<Hashtag>) -> Result<()> {
let tags_name = tags
.iter()
.filter_map(|t| t.name.as_ref().map(|name| name.as_str().to_string()))
@ -520,7 +520,7 @@ impl Post {
Ok(())
}
pub fn update_hashtags07(&self, conn: &Connection, tags: Vec<Hashtag>) -> Result<()> {
pub fn update_hashtags(&self, conn: &Connection, tags: Vec<Hashtag>) -> Result<()> {
let tags_name = tags
.iter()
.filter_map(|t| t.name.as_ref().map(|name| name.as_str().to_string()))
@ -568,7 +568,7 @@ impl Post {
.and_then(|c| c.url().ok())
}
pub fn build_delete07(&self, conn: &Connection) -> Result<Delete> {
pub fn build_delete(&self, conn: &Connection) -> Result<Delete> {
let mut tombstone = Tombstone::new();
tombstone.set_id(self.ap_url.parse()?);
@ -968,9 +968,9 @@ impl AsObject<User, Update, &DbConn> for PostUpdate {
})
.ok();
}
post.update_mentions07(conn, mentions)?;
post.update_tags07(conn, tags)?;
post.update_hashtags07(conn, hashtags)?;
post.update_mentions(conn, mentions)?;
post.update_tags(conn, tags)?;
post.update_hashtags(conn, hashtags)?;
}
post.update(conn)?;
@ -1033,7 +1033,7 @@ mod tests {
// creates a post, get it's Create activity, delete the post,
// "send" the Create to the inbox, and check it works
#[test]
fn self_federation07() {
fn self_federation() {
let conn = &db();
conn.test_transaction::<_, (), _>(|| {
let (_, users, blogs) = fill_database(&conn);
@ -1230,11 +1230,11 @@ mod tests {
}
#[test]
fn build_delete07() {
fn build_delete() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (post, _mention, _posts, _users, _blogs) = prepare_activity(&conn);
let act = post.build_delete07(&conn)?;
let act = post.build_delete(&conn)?;
let expected = json!({
"actor": "https://plu.me/@/admin/",

View file

@ -68,7 +68,7 @@ impl ActorFactoryArgs<DbPool> for RemoteFetchActor {
}
fn fetch_and_cache_articles(user: &Arc<User>, conn: &DbConn) {
let create_acts = user.fetch_outbox07::<Create>();
let create_acts = user.fetch_outbox::<Create>();
match create_acts {
Ok(create_acts) => {
for create_act in create_acts {

View file

@ -97,7 +97,7 @@ impl Reshare {
Ok(())
}
pub fn build_undo07(&self, conn: &Connection) -> Result<Undo> {
pub fn build_undo(&self, conn: &Connection) -> Result<Undo> {
let mut act = Undo::new(
User::get(conn, self.user_id)?.ap_url.parse::<IriString>()?,
AnyBase::from_extended(self.to_activity(conn)?)?,
@ -247,14 +247,14 @@ mod test {
}
#[test]
fn build_undo07() {
fn build_undo() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (posts, _users, _blogs) = fill_database(&conn);
let post = &posts[0];
let user = &post.get_authors(&conn)?[0];
let reshare = Reshare::insert(&*conn, NewReshare::new(post, user))?;
let act = reshare.build_undo07(&*conn)?;
let act = reshare.build_undo(&*conn)?;
let expected = json!({
"actor": "https://plu.me/@/admin/",

View file

@ -623,7 +623,7 @@ mod tests {
)
.unwrap();
gnu_post
.update_tags07(&conn, vec![Tag::build_activity("free".to_owned()).unwrap()])
.update_tags(&conn, vec![Tag::build_activity("free".to_owned()).unwrap()])
.unwrap();
PostAuthor::insert(
&conn,

View file

@ -460,10 +460,10 @@ impl User {
.load::<User>(conn)
.map_err(Error::from)
}
pub fn outbox07(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
Ok(ActivityStream::new(self.outbox_collection07(conn)?))
pub fn outbox(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
Ok(ActivityStream::new(self.outbox_collection(conn)?))
}
pub fn outbox_collection07(&self, conn: &Connection) -> Result<OrderedCollection> {
pub fn outbox_collection(&self, conn: &Connection) -> Result<OrderedCollection> {
let mut coll = OrderedCollection::new();
let first = &format!("{}?page=1", &self.outbox_url);
let last = &format!(
@ -476,16 +476,16 @@ impl User {
coll.set_total_items(self.get_activities_count(conn) as u64);
Ok(coll)
}
pub fn outbox_page07(
pub fn outbox_page(
&self,
conn: &Connection,
(min, max): (i32, i32),
) -> Result<ActivityStream<OrderedCollectionPage>> {
Ok(ActivityStream::new(
self.outbox_collection_page07(conn, (min, max))?,
self.outbox_collection_page(conn, (min, max))?,
))
}
pub fn outbox_collection_page07(
pub fn outbox_collection_page(
&self,
conn: &Connection,
(min, max): (i32, i32),
@ -513,7 +513,7 @@ impl User {
Ok(coll)
}
pub fn fetch_outbox_page07<T: Activity + serde::de::DeserializeOwned>(
pub fn fetch_outbox_page<T: Activity + serde::de::DeserializeOwned>(
&self,
url: &str,
) -> Result<(Vec<T>, Option<String>)> {
@ -531,7 +531,7 @@ impl User {
Ok((items, next))
}
pub fn fetch_outbox07<T: Activity + serde::de::DeserializeOwned>(&self) -> Result<Vec<T>> {
pub fn fetch_outbox<T: Activity + serde::de::DeserializeOwned>(&self) -> Result<Vec<T>> {
let mut res = get(
&self.outbox_url[..],
Self::get_sender(),
@ -542,7 +542,7 @@ impl User {
if let Some(first) = json.get("first") {
let mut items: Vec<T> = Vec::new();
let mut next = first.as_str().unwrap().to_owned();
while let Ok((mut page, nxt)) = self.fetch_outbox_page07(&next) {
while let Ok((mut page, nxt)) = self.fetch_outbox_page(&next) {
if page.is_empty() {
break;
}
@ -1421,7 +1421,7 @@ pub(crate) mod tests {
}
#[test]
fn self_federation07() {
fn self_federation() {
let conn = db();
conn.test_transaction::<_, (), _>(|| {
let users = fill_database(&conn);
@ -1535,12 +1535,12 @@ pub(crate) mod tests {
}
#[test]
fn outbox_collection07() {
fn outbox_collection() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (_pages, users, _blogs) = fill_pages(&conn);
let user = &users[0];
let act = user.outbox_collection07(&conn)?;
let act = user.outbox_collection(&conn)?;
let expected = json!({
"first": "https://plu.me/@/admin/outbox?page=1",
@ -1556,12 +1556,12 @@ pub(crate) mod tests {
}
#[test]
fn outbox_collection_page07() {
fn outbox_collection_page() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let users = fill_database(&conn);
let user = &users[0];
let act = user.outbox_collection_page07(&conn, (33, 36))?;
let act = user.outbox_collection_page(&conn, (33, 36))?;
let expected = json!({
"items": [],

View file

@ -349,7 +349,7 @@ pub fn update(
#[get("/~/<name>/outbox")]
pub fn outbox(name: String, conn: DbConn) -> Option<ActivityStream<OrderedCollection>> {
let blog = Blog::find_by_fqn(&conn, &name).ok()?;
blog.outbox07(&conn).ok()
blog.outbox(&conn).ok()
}
#[allow(unused_variables)]
#[get("/~/<name>/outbox?<page>")]
@ -359,7 +359,7 @@ pub fn outbox_page(
conn: DbConn,
) -> Option<ActivityStream<OrderedCollectionPage>> {
let blog = Blog::find_by_fqn(&conn, &name).ok()?;
blog.outbox_page07(&conn, page.limits()).ok()
blog.outbox_page(&conn, page.limits()).ok()
}
#[get("/~/<name>/atom.xml")]
pub fn atom_feed(name: String, conn: DbConn) -> Option<Content<String>> {

View file

@ -150,7 +150,7 @@ pub fn delete(
if let Ok(comment) = Comment::get(&conn, id) {
if comment.author_id == user.id {
let dest = User::one_by_instance(&conn)?;
let delete_activity = comment.build_delete07(&conn)?;
let delete_activity = comment.build_delete(&conn)?;
inbox(
&conn,
serde_json::to_value(&delete_activity).map_err(Error::from)?,

View file

@ -33,7 +33,7 @@ pub fn create(
.execute(move || broadcast(&user, act, dest, CONFIG.proxy().cloned()));
} else {
let like = likes::Like::find_by_user_on_post(&conn, user.id, post.id)?;
let delete_act = like.build_undo07(&conn)?;
let delete_act = like.build_undo(&conn)?;
inbox(
&conn,
serde_json::to_value(&delete_act).map_err(Error::from)?,

View file

@ -308,7 +308,7 @@ pub fn update(
post.update(&conn).expect("post::update: update error");
if post.published {
post.update_mentions07(
post.update_mentions(
&conn,
mentions
.into_iter()
@ -327,7 +327,7 @@ pub fn update(
.into_iter()
.filter_map(|t| Tag::build_activity(t.to_string()).ok())
.collect::<Vec<_>>();
post.update_tags07(&conn, tags)
post.update_tags(&conn, tags)
.expect("post::update: tags error");
let hashtags = hashtags
@ -336,7 +336,7 @@ pub fn update(
.into_iter()
.filter_map(|t| Tag::build_activity(t).ok())
.collect::<Vec<_>>();
post.update_hashtags07(&conn, hashtags)
post.update_hashtags(&conn, hashtags)
.expect("post::update: hashtags error");
if post.published {
@ -606,7 +606,7 @@ pub fn delete(
}
let dest = User::one_by_instance(&conn)?;
let delete_activity = post.build_delete07(&conn)?;
let delete_activity = post.build_delete(&conn)?;
inbox(
&conn,
serde_json::to_value(&delete_activity).map_err(Error::from)?,

View file

@ -33,7 +33,7 @@ pub fn create(
.execute(move || broadcast(&user, act, dest, CONFIG.proxy().cloned()));
} else {
let reshare = Reshare::find_by_user_on_post(&conn, user.id, post.id)?;
let delete_act = reshare.build_undo07(&conn)?;
let delete_act = reshare.build_undo(&conn)?;
inbox(
&conn,
serde_json::to_value(&delete_act).map_err(Error::from)?,

View file

@ -103,7 +103,7 @@ pub fn follow(
) -> Result<Flash<Redirect>, ErrorPage> {
let target = User::find_by_fqn(&conn, &name)?;
let message = if let Ok(follow) = follows::Follow::find(&conn, user.id, target.id) {
let delete_act = follow.build_undo07(&conn)?;
let delete_act = follow.build_undo(&conn)?;
local_inbox(
&conn,
serde_json::to_value(&delete_act).map_err(Error::from)?,
@ -531,7 +531,7 @@ pub fn create(
#[get("/@/<name>/outbox")]
pub fn outbox(name: String, conn: DbConn) -> Option<ActivityStream<OrderedCollection07>> {
let user = User::find_by_fqn(&conn, &name).ok()?;
user.outbox07(&conn).ok()
user.outbox(&conn).ok()
}
#[get("/@/<name>/outbox?<page>")]
pub fn outbox_page(
@ -540,7 +540,7 @@ pub fn outbox_page(
conn: DbConn,
) -> Option<ActivityStream<OrderedCollectionPage>> {
let user = User::find_by_fqn(&conn, &name).ok()?;
user.outbox_page07(&conn, page.limits()).ok()
user.outbox_page(&conn, page.limits()).ok()
}
#[post("/@/<name>/inbox", data = "<data>")]
pub fn inbox(