Commit b77bb393 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/415-dev-user-empty-field' into dev

parents 63357a3a 582b58e0
......@@ -34,6 +34,7 @@ import Gargantext.Database.Admin.Types.Hyperdata.Contact
, cw_organization
, cw_role
, cw_touch
, cw_description
, ct_mail
, ct_phone
, hc_who
......@@ -64,6 +65,7 @@ data UserInfo = UserInfo
, ui_cwRole :: Maybe Text
, ui_cwTouchPhone :: Maybe Text
, ui_cwTouchMail :: Maybe Text -- TODO: Remove. userLight_email should be used instead
, ui_cwDescription :: Maybe Text
}
deriving (Generic, GQLType, Show)
......@@ -91,7 +93,8 @@ data UserInfoMArgs
, ui_cwOffice :: Maybe Text
, ui_cwRole :: Maybe Text
, ui_cwTouchPhone :: Maybe Text
, ui_cwTouchMail :: Maybe Text
, ui_cwTouchMail :: Maybe Text
, ui_cwDescription :: Maybe Text
} deriving (Generic, GQLType)
type GqlM e env = Resolver QUERY e (GargM env GargError)
......@@ -132,6 +135,7 @@ updateUserInfo (UserInfoMArgs { ui_id, .. }) = do
uh ui_cwRoleL ui_cwRole $
uh ui_cwTouchMailL ui_cwTouchMail $
uh ui_cwTouchPhoneL ui_cwTouchPhone $
uh ui_cwDescriptionL ui_cwDescription
u_hyperdata
-- NOTE: We have 1 username and 2 emails: userLight_email and ui_cwTouchMail
-- The userLight_email is more important: it is used for login and sending mail.
......@@ -179,7 +183,8 @@ toUser (UserLight { .. }, u_hyperdata) =
, ui_cwRole = u_hyperdata ^. ui_cwRoleL
--, ui_cwTouchMail = u_hyperdata ^. ui_cwTouchMailL
, ui_cwTouchMail = Just userLight_email
, ui_cwTouchPhone = u_hyperdata ^. ui_cwTouchPhoneL }
, ui_cwTouchPhone = u_hyperdata ^. ui_cwTouchPhoneL
, ui_cwDescription = u_hyperdata ^. ui_cwDescriptionL }
sharedL :: Traversal' HyperdataUser HyperdataContact
sharedL = hu_shared . _Just
......@@ -213,3 +218,5 @@ ui_cwTouchMailL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct
ui_cwTouchPhoneL :: Traversal' HyperdataUser (Maybe Text)
ui_cwTouchPhoneL = hu_shared . _Just . (hc_where . (ix 0) . cw_touch . _Just . ct_phone)
--ui_cwTouchPhoneL = contactWhereL . cw_touch . _Just . ct_phone
ui_cwDescriptionL :: Traversal' HyperdataUser (Maybe Text)
ui_cwDescriptionL = contactWhoL . cw_description
......@@ -272,7 +272,7 @@ instance ToHyperdataRow HyperdataDocument where
, _hr_uniqIdBdd = fromMaybe "" _hd_uniqIdBdd }
instance ToHyperdataRow HyperdataContact where
toHyperdataRow (HyperdataContact { _hc_who = Just (ContactWho _ fn ln _ _), _hc_where = ou} ) =
toHyperdataRow (HyperdataContact { _hc_who = Just (ContactWho _ fn ln _ _ _), _hc_where = ou} ) =
HyperdataRowContact (fromMaybe "FirstName" fn) (fromMaybe "LastName" ln) ou'
where
ou' = maybe "CNRS" (Text.intercalate " " . _cw_organization) (head ou)
......
......@@ -169,7 +169,8 @@ imtUser2gargContact (IMTUser { id
, _cw_firstName = prenom
, _cw_lastName = nom
, _cw_keywords = catMaybes [service]
, _cw_freetags = [] }
, _cw_freetags = []
, _cw_description = Nothing }
ou = ContactWhere { _cw_organization = toList entite
, _cw_labTeamDepts = toList service
, _cw_role = fonction
......
......@@ -103,6 +103,7 @@ data ContactWho =
, _cw_lastName :: Maybe Text
, _cw_keywords :: [Text]
, _cw_freetags :: [Text]
, _cw_description :: Maybe Text
} deriving (Eq, Show, Generic)
instance GQLType ContactWho where
......@@ -120,7 +121,8 @@ contactWho fn ln =
, _cw_firstName = Just fn
, _cw_lastName = Just ln
, _cw_keywords = []
, _cw_freetags = [] }
, _cw_freetags = []
, _cw_description = Nothing }
data ContactWhere =
ContactWhere { _cw_organization :: [Text]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment