Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #895 from kawazrepos/892
Browse files Browse the repository at this point in the history
プロジェクトを下書きにしてから公開すると参加者が居なくなるバグを修正
  • Loading branch information
giginet committed Apr 27, 2015
2 parents ee477ae + 3e43ab5 commit 98b14a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pytz
pillow
markdown2==2.3.0
djangorestframework>=3.0.1
django-permission>=0.8.3
django-permission
django-filter
django-roughpages>=0.1.2
django-thumbnailfield>=0.2.3
Expand Down
2 changes: 1 addition & 1 deletion src/kawaz/apps/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def join_administrator(**kwargs):
"""
created = kwargs.get('created')
instance = kwargs.get('instance')
if created and instance.pub_state != 'draft':
if instance.pub_state != 'draft' and not instance.administrator in instance.members.all():
instance.join(instance.administrator)

from permission import add_permission_logic
Expand Down
8 changes: 8 additions & 0 deletions src/kawaz/apps/projects/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ def test_administrator_is_member(self):
project = ProjectFactory(administrator=user)
self.assertTrue(project.is_member(user))

def test_administrator_can_join_automatically_draft(self):
"""
下書き状態のイベントでも作成時に自動的に管理者がプロジェクトメンバーになる
"""
user = PersonaFactory()
project = ProjectFactory(administrator=user, status='draft')
self.assertTrue(project.is_member(user))

def test_quit(self):
'''Tests can remove member correctly'''
project = ProjectFactory()
Expand Down

0 comments on commit 98b14a9

Please sign in to comment.