This commit is contained in:
Adrian Woźniak 2021-04-29 14:55:22 +02:00
parent 98f9204fbd
commit 83ee058297
12 changed files with 25 additions and 29 deletions

View File

@ -1,4 +1,3 @@
use actix;
use rusoto_s3::{PutObjectRequest, S3Client, S3};
#[derive(Debug)]

View File

@ -195,7 +195,9 @@ impl CreateIssue {
}
.execute(conn)?
.first()
.ok_or_else(|| crate::DatabaseError::Issue(crate::IssueError::NoIssueStatuses))?
.ok_or(crate::DatabaseError::Issue(
crate::IssueError::NoIssueStatuses,
))?
.id
} else {
msg.issue_status_id
@ -225,7 +227,8 @@ impl CreateIssue {
crate::issue_assignees::AsignMultiple {
issue_id: issue.id,
user_ids: assign_users,
};
}
.execute(conn);
issues.find(issue.id).get_result(conn).map_err(|e| {
log::error!("{:?}", e);
crate::DatabaseError::GenericFailure(

View File

@ -64,19 +64,19 @@ impl HighlightActor {
.first()
.and_then(|idx| self.syntax_set.syntaxes().get(*idx))
.map(|st| st.name.as_str())
.ok_or_else(|| HighlightError::UnknownLanguage)?;
.ok_or(HighlightError::UnknownLanguage)?;
let set = self
.syntax_set
.as_ref()
.find_syntax_by_name(lang)
.ok_or_else(|| HighlightError::UnknownLanguage)?;
.ok_or(HighlightError::UnknownLanguage)?;
let theme: &syntect::highlighting::Theme = self
.theme_set
.as_ref()
.themes
.get("GitHub")
.ok_or_else(|| HighlightError::UnknownTheme)?;
.ok_or(HighlightError::UnknownTheme)?;
let mut hi = HighlightLines::new(set, theme);
Ok(hi.highlight(code, self.syntax_set.as_ref()))

View File

@ -10,7 +10,6 @@ use database_actor::user_projects::CurrentUserProject;
use database_actor::users::UpdateAvatarUrl;
use database_actor::DbExecutor;
#[cfg(feature = "local-storage")]
use filesystem_actor;
use futures::executor::block_on;
use futures::{StreamExt, TryStreamExt};
use jirs_data::{User, UserId, WsMsg};

View File

@ -5,8 +5,7 @@ pub fn token_from_headers(
headers: &HeaderMap,
) -> std::result::Result<uuid::Uuid, crate::errors::ServiceError> {
headers
.get(header::AUTHORIZATION)
.ok_or_else(|| crate::errors::ServiceError::Unauthorized)
.get(header::AUTHORIZATION).ok_or(crate::errors::ServiceError::Unauthorized)
.map(|h| h.to_str().unwrap_or_default())
.and_then(|s| parse_bearer(s))
}

View File

@ -60,7 +60,7 @@ impl WsHandler<UpdateEpicName> for WebSocketActor {
database_actor::epics::UpdateEpicName {
project_id: *project_id,
epic_id: msg.epic_id,
name: msg.name.clone(),
name: msg.name,
}
);
Ok(Some(WsMsg::EpicUpdated(epic)))

View File

@ -7,7 +7,7 @@ pub struct HighlightCode(pub Lang, pub Code);
impl WsHandler<HighlightCode> for WebSocketActor {
fn handle_msg(&mut self, msg: HighlightCode, _ctx: &mut Self::Context) -> WsResult {
self.require_user()?.id;
self.require_user()?;
let res = actor_or_debug_and_return!(
self,
hi,

View File

@ -49,8 +49,8 @@ impl WsHandler<DeleteIssueStatus> for WebSocketActor {
let n = db_or_debug_and_return!(
self,
issue_statuses::DeleteIssueStatus {
issue_status_id,
project_id,
issue_status_id
}
);
Ok(Some(WsMsg::IssueStatusDeleted(msg.issue_status_id, n)))
@ -76,9 +76,9 @@ impl WsHandler<UpdateIssueStatus> for WebSocketActor {
self,
issue_statuses::UpdateIssueStatus {
issue_status_id,
position,
name,
project_id,
position,
name
}
);
let msg = Some(WsMsg::IssueStatusUpdated(issue_status));

View File

@ -103,13 +103,13 @@ impl WebSocketActor {
WsMsg::IssueStatusUpdate(issue_status_id, name, position) => self.handle_msg(
UpdateIssueStatus {
issue_status_id,
name,
position,
name,
},
ctx,
)?,
WsMsg::IssueStatusCreate(name, position) => {
self.handle_msg(CreateIssueStatus { name, position }, ctx)?
self.handle_msg(CreateIssueStatus { position, name }, ctx)?
}
// projects
@ -166,7 +166,7 @@ impl WebSocketActor {
// invitations
WsMsg::InvitationSendRequest { name, email, role } => {
self.handle_msg(CreateInvitation { name, email, role }, ctx)?
self.handle_msg(CreateInvitation { email, name, role }, ctx)?
}
WsMsg::InvitationListLoad => self.handle_msg(ListInvitation, ctx)?,
WsMsg::InvitationAcceptRequest(invitation_token) => {
@ -177,7 +177,7 @@ impl WebSocketActor {
// users
WsMsg::ProfileUpdate(email, name) => {
self.handle_msg(ProfileUpdate { email, name }, ctx)?
self.handle_msg(ProfileUpdate { name, email }, ctx)?
}
// messages
@ -189,8 +189,8 @@ impl WebSocketActor {
WsMsg::EpicCreate(name, description, description_html) => self.handle_msg(
epics::CreateEpic {
name,
description_html,
description,
description_html,
},
ctx,
)?,
@ -252,17 +252,13 @@ impl WebSocketActor {
}
fn require_user(&self) -> Result<&User, WsMsg> {
self.current_user
.as_ref()
.map(|u| u)
.ok_or_else(|| WsMsg::AuthorizeExpired)
self.current_user.as_ref().ok_or(WsMsg::AuthorizeExpired)
}
fn require_user_project(&self) -> Result<&UserProject, WsMsg> {
self.current_user_project
.as_ref()
.map(|u| u)
.ok_or_else(|| WsMsg::AuthorizeExpired)
.ok_or(WsMsg::AuthorizeExpired)
}
fn load_user_project(&self) -> Result<UserProject, WsMsg> {

View File

@ -354,7 +354,7 @@ fn priority_select_option<'l>(priority: IssuePriority) -> StyledSelectOption<'l>
StyledSelectOption {
icon: Some(
StyledIcon {
icon: priority.clone().into(),
icon: priority.into(),
class_list: priority.to_str(),
..Default::default()
}

View File

@ -119,8 +119,8 @@ pub fn time_tracking_field(
.render(),
};
StyledField {
input,
label,
input,
..Default::default()
}
.render()

View File

@ -201,9 +201,9 @@ fn issue_list(page: &ReportsPage, project_name: &str, this_month_updated: &[&Iss
} = issue;
let day = date.format("%Y-%m-%d").to_string();
let type_icon = StyledIcon::from(Icon::from(issue_type.clone()))
let type_icon = StyledIcon::from(Icon::from(*issue_type))
.render();
let priority_icon = StyledIcon::from(Icon::from(priority.clone()))
let priority_icon = StyledIcon::from(Icon::from(*priority))
.render();
let desc = Node::from_html(None,
description