Beispiel #1
0
    def test_can_get(self):
        username = self.user.username

        owner = get_repo_owner(self.fake_request, self.repo.id)
        assert owner == username
        assert get_repo_shared_users(self.repo.id, owner) == []

        # user share a repo to admin
        seafile_api.share_repo(self.repo.id, username,
                               self.admin.username, 'rw')
        assert get_repo_shared_users(self.repo.id, owner) == [self.admin.username]

        # user share a repo to group
        seafile_api.set_group_repo(self.repo.id, self.group.id,
                                   username, 'rw')
        assert get_repo_shared_users(self.repo.id, owner) == [self.admin.username, self.user2.username]
Beispiel #2
0
    def test_can_get(self):
        username = self.user.username

        owner = get_repo_owner(self.fake_request, self.repo.id)
        assert owner == username
        assert get_repo_shared_users(self.repo.id, owner) == []

        # user share a repo to admin
        seafile_api.share_repo(self.repo.id, username, self.admin.username,
                               'rw')
        assert get_repo_shared_users(self.repo.id,
                                     owner) == [self.admin.username]

        # user share a repo to group
        seafile_api.set_group_repo(self.repo.id, self.group.id, username, 'rw')
        assert get_repo_shared_users(
            self.repo.id, owner) == [self.admin.username, self.user2.username]
Beispiel #3
0
def comment_file_successful_cb(sender, **kwargs):
    repo = kwargs['repo']
    repo_owner = kwargs['repo_owner']
    file_path = kwargs['file_path']
    comment = kwargs['comment']
    author = kwargs['author']

    notify_users = get_repo_shared_users(repo.id, repo_owner)
    notify_users.append(repo_owner)
    notify_users = [x for x in notify_users if x != author]
    for u in notify_users:
        detail = file_comment_msg_to_json(repo.id, file_path, author, comment)
        UserNotification.objects.add_file_comment_msg(u, detail)
Beispiel #4
0
def comment_file_successful_cb(sender, **kwargs):
    repo = kwargs['repo']
    repo_owner = kwargs['repo_owner']
    file_path = kwargs['file_path']
    comment = kwargs['comment']
    author = kwargs['author']

    notify_users = get_repo_shared_users(repo.id, repo_owner)
    notify_users.append(repo_owner)
    notify_users = [x for x in notify_users if x != author]
    for u in notify_users:
        detail = file_comment_msg_to_json(repo.id, file_path, author, comment)
        UserNotification.objects.add_file_comment_msg(u, detail)