Skip to content

Commit

Permalink
chore: fix ci
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper committed Dec 9, 2024
1 parent fdd146a commit aa065ac
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 39 deletions.
34 changes: 34 additions & 0 deletions ee/tabby-schema/src/dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,40 @@ impl From<ThreadMessageAttachmentDoc> for thread::MessageAttachmentDoc {
}
}

pub fn from_thread_message_attachment_document(
doc: ThreadMessageAttachmentDoc,
author: Option<UserValue>,
) -> thread::MessageAttachmentDoc {
match doc {
ThreadMessageAttachmentDoc::Web(web) => {
thread::MessageAttachmentDoc::Web(thread::MessageAttachmentWebDoc {
title: web.title,
link: web.link,
content: web.content,
})
}
ThreadMessageAttachmentDoc::Issue(issue) => {
thread::MessageAttachmentDoc::Issue(thread::MessageAttachmentIssueDoc {
title: issue.title,
link: issue.link,
author,
body: issue.body,
closed: issue.closed,
})
}
ThreadMessageAttachmentDoc::Pull(pull) => {
thread::MessageAttachmentDoc::Pull(thread::MessageAttachmentPullDoc {
title: pull.title,
link: pull.link,
author,
body: pull.body,
patch: pull.diff,
merged: pull.merged,
})
}
}
}

impl From<&thread::MessageAttachmentDoc> for ThreadMessageAttachmentDoc {
fn from(val: &thread::MessageAttachmentDoc) -> Self {
match val {
Expand Down
35 changes: 0 additions & 35 deletions ee/tabby-schema/src/schema/thread/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use tabby_common::api::{
code::{CodeSearchDocument, CodeSearchHit, CodeSearchScores},
structured_doc::DocSearchDocument,
};
use tabby_db::ThreadMessageAttachmentDoc;
use validator::Validate;

use crate::{interface::UserValue, juniper::relay::NodeType, Context};
Expand Down Expand Up @@ -186,40 +185,6 @@ impl MessageAttachmentDoc {
}),
}
}

pub fn from_thread_message_attachment_document(
doc: ThreadMessageAttachmentDoc,
author: Option<UserValue>,
) -> Self {
match doc {
ThreadMessageAttachmentDoc::Web(web) => {
MessageAttachmentDoc::Web(MessageAttachmentWebDoc {
title: web.title,
link: web.link,
content: web.content,
})
}
ThreadMessageAttachmentDoc::Issue(issue) => {
MessageAttachmentDoc::Issue(MessageAttachmentIssueDoc {
title: issue.title,
link: issue.link,
author,
body: issue.body,
closed: issue.closed,
})
}
ThreadMessageAttachmentDoc::Pull(pull) => {
MessageAttachmentDoc::Pull(MessageAttachmentPullDoc {
title: pull.title,
link: pull.link,
author,
body: pull.body,
patch: pull.diff,
merged: pull.merged,
})
}
}
}
}

#[derive(GraphQLObject)]
Expand Down
6 changes: 2 additions & 4 deletions ee/tabby-webserver/src/service/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use juniper::ID;
use tabby_db::{DbConn, ThreadMessageAttachmentDoc, ThreadMessageDAO};
use tabby_schema::{
auth::AuthenticationService,
bail,
bail, from_thread_message_attachment_document,
policy::AccessPolicy,
thread::{
self, CreateMessageInput, CreateThreadInput, MessageAttachment, MessageAttachmentDoc,
Expand Down Expand Up @@ -98,9 +98,7 @@ impl ThreadServiceImpl {
None
};

output.push(
MessageAttachmentDoc::from_thread_message_attachment_document(thread_doc, user),
);
output.push(from_thread_message_attachment_document(thread_doc, user));
}
output
}
Expand Down

0 comments on commit aa065ac

Please sign in to comment.