diff --git a/app/schemas/models/clan.schema.coffee b/app/schemas/models/clan.schema.coffee index 4aa2354b8..acdc17cd9 100644 --- a/app/schemas/models/clan.schema.coffee +++ b/app/schemas/models/clan.schema.coffee @@ -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' diff --git a/app/templates/clans/clan-details.jade b/app/templates/clans/clan-details.jade index 2775edcc5..545a16e31 100644 --- a/app/templates/clans/clan-details.jade +++ b/app/templates/clans/clan-details.jade @@ -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 diff --git a/server/clans/clan_handler.coffee b/server/clans/clan_handler.coffee index 80d521a55..df5a6ca0c 100644 --- a/server/clans/clan_handler.coffee +++ b/server/clans/clan_handler.coffee @@ -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) -> diff --git a/test/server/functional/clan.spec.coffee b/test/server/functional/clan.spec.coffee index 9586a01d2..b5bdf79df 100644 --- a/test/server/functional/clan.spec.coffee +++ b/test/server/functional/clan.spec.coffee @@ -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) ->