示例#1
0
文件: mute.py 项目: leeccong/code
 def mute(self):
     if self._cancel:
         Mute.unmute(self._type, self._proj_name, self._target_id, self._user)
         return {"status": "on"}
     else:
         Mute.mute(self._type, self._proj_name, self._target_id, self._user)
         return {"status": "off"}
示例#2
0
文件: mute.py 项目: jackfrued/code-1
 def mute(self):
     if self._cancel:
         Mute.unmute(self._type, self._proj_name, self._target_id,
                     self._user)
         return {"status": 'on'}
     else:
         Mute.mute(self._type, self._proj_name, self._target_id, self._user)
         return {"status": 'off'}
示例#3
0
 def mail_receivers(self):
     ticket = self._ticket
     ticket_id = ticket.ticket_id
     target = self._target
     to_receivers = Mute.filter('ticket', target.name,
                                ticket_id, [ticket.author, ])
     cc_recievers = Mute.filter('ticket', target.name,
                                ticket_id, ticket.participants)
     toaddr = Mail.addrs_by_usernames(to_receivers, target)
     ccaddr = Mail.addrs_by_usernames(cc_recievers, target)
     return toaddr, ccaddr
示例#4
0
def mute(request):
    ''' mute ticket(pr) or issue, just 'project' scope yet. '''
    user = request.user
    if user:
        entry_type = request.get_form_var('type', '')
        target = request.get_form_var('target', '')
        entry_id = request.get_form_var('id', '')
        if entry_type == 'pull':
            Mute.mute('ticket', target, entry_id, user)
        elif entry_type == 'issue':
            # TODO: models.issue.leave or mute
            issue = ProjectIssue.get_by_proj_name_and_number(target, entry_id)
            if user.name != issue.creator_id:
                issue.delete_participant(user.name)
        return dict(r=0)
    else:
        return dict(r=1)
示例#5
0
 def noti_receivers(self):
     participants = self._ticket.participants
     mentions = get_mentions_from_text(self._content)
     extra = [self._ticket.author, self._pullreq.to_proj.owner_id]
     receivers = set(participants + mentions + extra)
     receivers.discard(self._sender)
     return Mute.filter('ticket', self._target.name,
                        self._pullreq.ticket_id, receivers)
示例#6
0
文件: qaci.py 项目: 000fan000/code
 def noti_receivers(self):
     participants = self._ticket.participants
     extra = [self._ticket.author, self._pull.to_proj.owner_id]
     receivers = set(participants + extra)
     return Mute.filter('ticket',
                        self._target.name,
                        self._pull.ticket_id,
                        receivers)
示例#7
0
 def noti_receivers(self):
     participants = self._ticket.participants
     extra = [self._ticket.author, self._pull.to_proj.owner_id]
     receivers = set(participants + extra)
     return Mute.filter('ticket', self._target.name, self._pull.ticket_id,
                        receivers)