Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/allow-remove-splash-screen
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow deleting existing splash screens in `PUT /teams/:tid (see also PR#2474 in Release 4.18.0)
14 changes: 10 additions & 4 deletions libs/wire-api/src/Wire/API/Team.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ data Team = Team
_teamIcon :: Icon,
_teamIconKey :: Maybe Text,
_teamBinding :: TeamBinding,
_teamSplashScreen :: Maybe AssetKey
_teamSplashScreen :: Icon
}
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform Team)
deriving (ToJSON, FromJSON, S.ToSchema) via (Schema Team)

newTeam :: TeamId -> UserId -> Text -> Icon -> TeamBinding -> Team
newTeam tid uid nme ico tb = Team tid uid nme ico Nothing tb Nothing
newTeam tid uid nme ico tb = Team tid uid nme ico Nothing tb DefaultIcon

modelTeam :: Doc.Model
modelTeam = Doc.defineModel "Team" $ do
Expand All @@ -128,6 +128,9 @@ modelTeam = Doc.defineModel "Team" $ do
Doc.optional
Doc.property "binding" Doc.bool' $
Doc.description "user binding team"
Doc.property "splash_screen" Doc.string' $ do
Doc.description "new splash screen asset key"
Doc.optional

instance ToSchema Team where
schema =
Expand All @@ -139,7 +142,7 @@ instance ToSchema Team where
<*> _teamIcon .= field "icon" schema
<*> _teamIconKey .= maybe_ (optField "icon_key" schema)
<*> _teamBinding .= (fromMaybe Binding <$> optField "binding" schema)
<*> _teamSplashScreen .= maybe_ (optField "splash_screen" schema)
<*> _teamSplashScreen .= (fromMaybe DefaultIcon <$> optField "splash_screen" schema)

data TeamBinding
= Binding
Expand Down Expand Up @@ -269,7 +272,7 @@ data TeamUpdateData = TeamUpdateData
{ _nameUpdate :: Maybe (Range 1 256 Text),
_iconUpdate :: Maybe Icon,
_iconKeyUpdate :: Maybe (Range 1 256 Text),
_splashScreenUpdate :: Maybe AssetKey
_splashScreenUpdate :: Maybe Icon
}
deriving stock (Eq, Show, Generic)
deriving (ToJSON, FromJSON, S.ToSchema) via (Schema TeamUpdateData)
Expand All @@ -293,6 +296,9 @@ modelUpdateData = Doc.defineModel "TeamUpdateData" $ do
Doc.property "icon_key" Doc.string' $ do
Doc.description "new icon asset key"
Doc.optional
Doc.property "splash_screen" Doc.string' $ do
Doc.description "new splash screen asset key"
Doc.optional

newTeamUpdateData :: TeamUpdateData
newTeamUpdateData = TeamUpdateData Nothing Nothing Nothing Nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Data.Id (Id (Id))
import qualified Data.UUID as UUID (fromString)
import Imports (Maybe (Just, Nothing), fromJust, (&))
import Wire.API.Asset
import Wire.API.Team (Icon (..), Team, TeamBinding (Binding, NonBinding), newTeam, teamIconKey)
import Wire.API.Team (Icon (..), Team, TeamBinding (Binding, NonBinding), newTeam, teamIconKey, teamSplashScreen)

testObject_Team_team_1 :: Team
testObject_Team_team_1 =
Expand All @@ -46,6 +46,7 @@ testObject_Team_team_2 =
(Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal))
(NonBinding)
& teamIconKey .~ (Just "\34417R3q")
& teamSplashScreen .~ (Icon (AssetKeyV3 (Id (fromJust (UUID.fromString "55b9ad19-315c-4bda-8c0f-5d7b0e143008"))) AssetEternal))
)

testObject_Team_team_3 :: Team
Expand Down
3 changes: 2 additions & 1 deletion libs/wire-api/test/golden/testObject_Event_team_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"creator": "00000003-0000-0001-0000-000300000002",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000003-0000-0004-0000-000000000001",
"name": "\u0004X󳒌h"
"name": "\u0004X󳒌h",
"splash_screen": "default"
},
"team": "0000103e-0000-62d6-0000-7840000079b9",
"time": "1864-05-15T23:16:24.423381912958Z",
Expand Down
3 changes: 2 additions & 1 deletion libs/wire-api/test/golden/testObject_Event_team_13.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": ",7\u0007S",
"id": "00000002-0000-0003-0000-000200000001",
"name": "\u0008h0󺴴"
"name": "\u0008h0󺴴",
"splash_screen": "default"
},
"team": "000000a2-0000-56a4-0000-1a9f0000402b",
"time": "1864-04-14T05:25:05.00980826325Z",
Expand Down
9 changes: 6 additions & 3 deletions libs/wire-api/test/golden/testObject_TeamList_team_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000001-0000-0001-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000000-0000-0000-0000-000000000001",
"icon": "default",
"icon_key": "",
"id": "00000001-0000-0001-0000-000100000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000001-0000-0000-0000-000000000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000001-0000-0000-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000000-0000-0002-0000-000200000001",
"name": "/锟"
"name": "/锟",
"splash_screen": "default"
}
]
}
18 changes: 12 additions & 6 deletions libs/wire-api/test/golden/testObject_TeamList_team_14.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,52 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000000-0000-0001-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000001-0000-0001-0000-000000000001",
"icon": "default",
"icon_key": "",
"id": "00000001-0000-0000-0000-000100000001",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000000-0000-0001-0000-000100000001",
"icon": "default",
"icon_key": "",
"id": "00000001-0000-0000-0000-000000000001",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000000-0000-0001-0000-000100000001",
"icon": "default",
"icon_key": "",
"id": "00000000-0000-0001-0000-000100000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000001-0000-0001-0000-000100000000",
"icon": "default",
"icon_key": "",
"id": "00000001-0000-0000-0000-000100000001",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000000-0000-0000-0000-000000000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000000-0000-0001-0000-000100000001",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
15 changes: 10 additions & 5 deletions libs/wire-api/test/golden/testObject_TeamList_team_15.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,42 @@
"creator": "00000001-0000-0001-0000-000000000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000001-0000-0001-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000000-0000-0000-0000-000100000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000000-0000-0000-0000-000100000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": true,
"creator": "00000001-0000-0000-0000-000000000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000000-0000-0001-0000-000100000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000000-0000-0000-0000-000100000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000000-0000-0000-0000-000100000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": true,
"creator": "00000001-0000-0000-0000-000000000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000001-0000-0001-0000-000000000001",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "􏵷(",
"id": "00000001-0000-0001-0000-000100000002",
"name": "𩬟"
"name": "𩬟",
"splash_screen": "default"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"creator": "00000002-0000-0000-0000-000000000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000000-0000-0000-0000-000000000002",
"name": "W1"
"name": "W1",
"splash_screen": "default"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "𮏥(",
"id": "00000001-0000-0002-0000-000200000000",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
6 changes: 4 additions & 2 deletions libs/wire-api/test/golden/testObject_TeamList_team_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
"icon": "default",
"icon_key": "@",
"id": "00000000-0000-0001-0000-000100000000",
"name": "7"
"name": "7",
"splash_screen": "default"
},
{
"binding": true,
"creator": "00000000-0000-0000-0000-000000000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000000-0000-0001-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
12 changes: 8 additions & 4 deletions libs/wire-api/test/golden/testObject_TeamList_team_20.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,34 @@
"creator": "00000000-0000-0000-0000-000000000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000001-0000-0001-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": true,
"creator": "00000000-0000-0001-0000-000000000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000001-0000-0000-0000-000000000000",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": true,
"creator": "00000000-0000-0001-0000-000000000001",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000000-0000-0001-0000-000100000001",
"name": ""
"name": "",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000001-0000-0001-0000-000000000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000001-0000-0001-0000-000000000001",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
3 changes: 2 additions & 1 deletion libs/wire-api/test/golden/testObject_TeamList_team_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"creator": "00000000-0000-0001-0000-000100000002",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"id": "00000001-0000-0002-0000-000200000000",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
6 changes: 4 additions & 2 deletions libs/wire-api/test/golden/testObject_TeamList_team_4.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000001-0000-0001-0000-000100000001",
"name": "􄃌"
"name": "􄃌",
"splash_screen": "default"
},
{
"binding": false,
"creator": "00000001-0000-0001-0000-000100000000",
"icon": "3-1-55b9ad19-315c-4bda-8c0f-5d7b0e143008",
"icon_key": "",
"id": "00000001-0000-0000-0000-000100000001",
"name": ""
"name": "",
"splash_screen": "default"
}
]
}
Loading