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