mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -05:00
Decouple clan type from dashboard details
Adding dashboardType field, private clans automatically set this to ‘premium’.
This commit is contained in:
parent
45c070209b
commit
f80a73ae9b
4 changed files with 6 additions and 2 deletions
|
@ -9,7 +9,8 @@ _.extend ClanSchema.properties,
|
|||
description: {type: 'string'}
|
||||
members: c.array {title: 'Members'}, c.objectId()
|
||||
ownerID: c.objectId()
|
||||
type: {type: 'string', 'enum': ['public', 'private']}
|
||||
type: {type: 'string', 'enum': ['public', 'private'], description: 'Controls clan general visibility.'}
|
||||
dashboardType: {type: 'string', 'enum': ['basic', 'premium']}
|
||||
|
||||
c.extendBasicProperties ClanSchema, 'Clan'
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ block content
|
|||
|
||||
if members
|
||||
h3 Heroes (#{members.length})
|
||||
if clan.get('type') === 'private'
|
||||
if clan.get('dashboardType') === 'premium'
|
||||
table.table.table-condensed
|
||||
thead
|
||||
tr
|
||||
|
|
|
@ -35,6 +35,7 @@ ClanHandler = class ClanHandler extends Handler
|
|||
instance = super(req)
|
||||
instance.set 'ownerID', req.user._id
|
||||
instance.set 'members', [req.user._id]
|
||||
instance.set 'dashboardType', 'premium' if req.body?.type is 'private'
|
||||
instance
|
||||
|
||||
delete: (req, res, clanID) ->
|
||||
|
|
|
@ -23,12 +23,14 @@ describe 'Clans', ->
|
|||
expect(body.type).toEqual(type)
|
||||
expect(body.name).toEqual(name)
|
||||
expect(body.description).toEqual(description) if description?
|
||||
expect(body.dashboardType).toEqual('premium') if type is 'private'
|
||||
expect(body.members?.length).toEqual(1)
|
||||
expect(body.members?[0]).toEqual(user.id)
|
||||
Clan.findById body._id, (err, clan) ->
|
||||
expect(clan.get('type')).toEqual(type)
|
||||
expect(clan.get('name')).toEqual(name)
|
||||
expect(clan.get('description')).toEqual(description) if description?
|
||||
expect(clan.get('dashboardType')).toEqual('premium') if type is 'private'
|
||||
expect(clan.get('members')?.length).toEqual(1)
|
||||
expect(clan.get('members')?[0]).toEqual(user._id)
|
||||
User.findById user.id, (err, user) ->
|
||||
|
|
Loading…
Reference in a new issue