modoboa / modoboa
Showing 2 of 3 files from the diff.

@@ -420,10 +420,12 @@
Loading
420 420
                    alias__address=alias).exists():
421 421
                continue
422 422
            local_part, domname = split_mailbox(alias)
423 -
            al = models.Alias(address=alias, enabled=account.is_active)
424 -
            al.domain = models.Domain.objects.get(name=domname)
425 -
            al.save()
426 -
            al.set_recipients([self.mb.full_address])
423 +
            al, _ = models.Alias.objects.get_or_create(
424 +
                address=alias,
425 +
                domain=models.Domain.objects.get(name=domname),
426 +
                defaults={'enabled': account.is_active},
427 +
            )
428 +
            al.add_recipients([self.mb.full_address])
427 429
            al.post_create(user)
428 430
429 431
    def _update_sender_addresses(self):

@@ -137,8 +137,8 @@
Loading
137 137
            for admin in self.domain.admins:
138 138
                grant_access_to_object(admin, self)
139 139
140 -
    def set_recipients(self, address_list):
141 -
        """Set recipients for this alias.
140 +
    def add_recipients(self, address_list):
141 +
        """Add recipients for this alias.
142 142
143 143
        Special recipients:
144 144
        * local mailbox + extension: r_mailbox will be set to local mailbox
@@ -187,6 +187,11 @@
Loading
187 187
                    kwargs["r_mailbox"] = rcpt
188 188
            AliasRecipient(**kwargs).save()
189 189
190 +
    def set_recipients(self, address_list):
191 +
        """Set recipients for this alias."""
192 +
193 +
        self.add_recipients(address_list)
194 +
190 195
        # Remove old recipients
191 196
        self.aliasrecipient_set.exclude(
192 197
            address__in=address_list).delete()
Files Coverage
modoboa 81.93%
Project Totals (208 files) 81.93%
1
comment:
2
  layout: header, changes, diff
3
coverage:
4
  ignore:
5
  - **/migrations/*
6
  - **/tests/*
7
  - **/tests.py
8
  - modoboa/core/dev_settings.py
9
  - modoboa/test_settings.py
10
  status:
11
    patch:
12
      default:
13
        target: '70'
14
    project:
15
      default:
16
        target: auto
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading