Commit 17909a7e authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

BREAKING: rename unpublish to unshare

Previously there was no symmetry in the name of the share endpoint,
which is meant to be used to generate a publicly-accessible URL to view
a node, and the previously-called "unpulish" endpoint.

The problem is that now the "unpublish" name would clash with the dual
of publishing a node. To avoid the problem, this commit renames the old
"unpublish" endpoint to be "unshare", so that now it's clear that is the
inverse operation of "share".
parent 35124c54
......@@ -261,7 +261,7 @@ genericNodeAPI' _ authenticatedUser targetNode = Named.NodeAPI
, moveAPI = Named.MoveAPI $ \parentId ->
withPolicy authenticatedUser (moveChecks (SourceId targetNode) (TargetId parentId)) $
moveNode loggedInUserId targetNode parentId
, unpublishEp = Share.unPublish targetNode
, unshareEp = Share.unShare targetNode
, fileAPI = Named.FileAPI $ fileApi targetNode
, fileAsyncAPI = fileAsyncApi authenticatedUser targetNode
, dfwnAPI = DFWN.api authenticatedUser targetNode
......
......@@ -24,7 +24,7 @@ import Gargantext.Core.Notifications.CentralExchange.Types (HasCentralExchangeNo
import Gargantext.Core.NLP (HasNLPServer)
import Gargantext.Core.Types.Individu (User(..), arbitraryUsername)
import Gargantext.Database.Action.Share (ShareNodeWith(..))
import Gargantext.Database.Action.Share as DB (shareNodeWith, unPublish)
import Gargantext.Database.Action.Share as DB (shareNodeWith, unshare)
import Gargantext.Database.Action.User
import Gargantext.Database.Action.User.New
import Gargantext.Database.Admin.Types.Node
......@@ -84,5 +84,6 @@ api _uId nId2 (SharePublicParams nId1) =
fromIntegral <$> DB.shareNodeWith (ShareNodeWith_Node NodeFolderPublic nId1) nId2
unPublish :: IsGargServer env err m => NodeId -> Named.Unpublish (AsServerT m)
unPublish n = Named.Unpublish $ DB.unPublish n
-- | Unshare a previously shared node via the /share endpoint.
unShare :: IsGargServer env err m => NodeId -> Named.UnshareNode (AsServerT m)
unShare = Named.UnshareNode . DB.unshare
......@@ -81,6 +81,7 @@ data NodeAPI a mode = NodeAPI
, scoreAPI :: mode :- "score" :> NamedRoutes ScoreAPI
, searchAPI :: mode :- "search" :> NamedRoutes (SearchAPI SearchResult)
, shareAPI :: mode :- "share" :> NamedRoutes ShareNode
, unshareEp :: mode :- "unshare" :> NamedRoutes Share.UnshareNode
---- Pairing utilities
, pairWithEp :: mode :- "pairwith" :> NamedRoutes PairWith
, pairsEp :: mode :- "pairs" :> NamedRoutes Pairs
......@@ -92,7 +93,6 @@ data NodeAPI a mode = NodeAPI
, treeAPI :: mode :- "tree" :> NamedRoutes TreeAPI
, phyloAPI :: mode :- "phylo" :> NamedRoutes PhyloAPI
, moveAPI :: mode :- "move" :> NamedRoutes MoveAPI
, unpublishEp :: mode :- "unpublish" :> NamedRoutes Share.Unpublish
, fileAPI :: mode :- "file" :> NamedRoutes FileAPI
, fileAsyncAPI :: mode :- "async" :> NamedRoutes FileAsyncAPI
, dfwnAPI :: mode :- "documents-from-write-nodes" :> NamedRoutes DocumentsFromWriteNodesAPI
......
......@@ -4,7 +4,7 @@
module Gargantext.API.Routes.Named.Share (
-- * Routes types
ShareNode(..)
, Unpublish(..)
, UnshareNode(..)
, ShareURL(..)
, ShareLink(..)
, renderShareLink
......@@ -62,6 +62,6 @@ newtype ShareNode mode = ShareNode
} deriving Generic
newtype Unpublish mode = Unpublish
{ unpublishEp :: mode :- Summary " Unpublish Node" :> Capture "node_id" NodeId :> Put '[JSON] Int
newtype UnshareNode mode = UnshareNode
{ unshareEp :: mode :- Summary " Unshare a Node" :> Capture "node_id" NodeId :> Put '[JSON] Int
} deriving Generic
......@@ -141,7 +141,7 @@ delFolderTeam u nId = do
folderSharedId <- getFolderId u NodeFolderShared
deleteNodeNode folderSharedId nId
unPublish :: HasNodeError err
=> ParentId -> NodeId
-> Cmd err Int
unPublish p n = deleteNodeNode p n
unshare :: HasNodeError err
=> ParentId -> NodeId
-> Cmd err Int
unshare p n = deleteNodeNode p n
......@@ -42,10 +42,9 @@ module Gargantext.Database.Query.Table.NodeNode
, nodeNodesScore
, pairCorpusWithAnnuaire
, publishNode
, unpublishNode
, queryNodeNodeTable
, shareNode
, unpublishNode
)
where
......
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