Пример #1
0
def add_comment_to_issue(issue_id, comment_content, user):
    issue = Issue.objects.get(pk=issue_id)
    issue.touch()
    comment = IssueComment.newComment(issue, user, comment_content)
    comment.save()
    watches = watch_services.find_issue_watches(comment.issue)
    notifyWatchers_newissuecomment(comment, watches)
    return issue
def change_existing_offer(offer_id, offerdict, user):
    offer = Offer.objects.get(pk=offer_id)
    _throwIfNotOfferOwner(offer, user)
    offer.issue.update_redundant_fields()
    old_offer = offer.clone()
    offer.changeOffer(offerdict)
    watches = watch_services.find_issue_watches(offer.issue)
    notifyWatchers_offerchanged(old_offer, offer, watches)
    return offer
def resolve_existing_solution(solution_id, comment_content, user):
    solution = Solution.objects.get(pk=solution_id)
    solution.issue.touch()
    _throwIfNotSolutionOwner(solution, user)
    _throwIfSolutionNotInProgress(solution, user, 'resolve solution')
    solution.resolve()
    comment = None
    if(comment_content):
        comment = IssueComment.newComment(solution.issue, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(solution.issue)
    notifyWatchers_workdone(solution, comment, watches)
    return solution
def revoke_existing_offer(offer_id, comment_content, user):
    offer = Offer.objects.get(pk=offer_id)
    _throwIfNotOfferOwner(offer, user)
    _throwIfOfferNotOpen(offer, user, 'revoke offer')
    offer.revoke()
    offer.issue.update_redundant_fields()
    comment = None
    if(comment_content):
        comment = IssueComment.newComment(offer.issue, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(offer.issue)
    notifyWatchers_offerrevoked(offer, comment, watches)
    return offer, comment
def resolve_existing_solution(solution_id, comment_content, user):
    solution = Solution.objects.get(pk=solution_id)
    solution.issue.touch()
    _throwIfNotSolutionOwner(solution, user)
    _throwIfSolutionNotInProgress(solution, user, 'resolve solution')
    solution.resolve()
    comment = None
    if (comment_content):
        comment = IssueComment.newComment(solution.issue, user,
                                          comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(solution.issue)
    notifyWatchers_workdone(solution, comment, watches)
    return solution
def abort_existing_solution(solution_id, comment_content, user):
    solution = Solution.objects.get(pk=solution_id)
    _throwIfNotSolutionOwner(solution, user)
    _throwIfSolutionNotInProgress(solution, user, 'abort solution')
    solution.abort()
    solution.issue.update_redundant_fields();
    comment = None
    if(comment_content):
        comment = IssueComment.newComment(solution.issue, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(solution.issue)
    notifyWatchers_workstopped(solution, comment, watches)

    return solution
def add_solution_to_existing_issue(issue_id, comment_content, user):
    issue = Issue.objects.get(pk=issue_id)
    issue.touch()
    solution = get_or_none(Solution, issue=issue, programmer=user)
    if(solution):
        _throwIfSolutionInProgress(solution, user, 'add solution')
        solution.reopen()
    else:
        solution = Solution.newSolution(issue, user)
    solution.save()
    comment = None
    if(comment_content):
        comment = IssueComment.newComment(issue, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(solution.issue)
    notifyWatchers_workbegun(solution, comment, watches)
    return issue
def _notify_payment_finished_if_applicable(payment_id):
    payment = Payment.objects.get(pk=payment_id)
    parts = PaymentPart.objects.filter(payment__id=payment.id)
    is_finished = True
    for part in parts:
        if part.money_sent.status != MoneySent.CONFIRMED_TRN:
            is_finished = False
            break
    if is_finished:
        payment.offer.paid()
        watches = watch_services.find_issue_watches(payment.offer.issue)
        mail_services.notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        ActionLog.log_pay(payment)
        msg = 'payment_id=%s, value=%s, issue=%s' % (
            payment.id,
            payment.total_bitcoin_received,
            payment.offer.issue.title)
        mail_services.notify_admin('Bitcoin payment made - %s'%payment.total_bitcoin_received, msg)
def sponsor_existing_issue(issue_id, dict, user):
    issue = Issue.objects.get(pk=issue_id)
    issue.touch()
    _throwIfAlreadySponsoring(issue, user)
    offer = _buildOfferFromDictionary_and_issue(dict, user, issue);
    offer.save()
    if issue.is_public_suggestion:
        issue.is_public_suggestion = False
        issue.save()
    watches = watch_services.find_issue_watches(issue)
    notifyWatchers_offeradded(offer, watches)
    msg = "offer: " + str(offer.price) + "\n<br>" +\
          "issue key: " + offer.issue.key + "\n<br>" +\
          "issue title: " + offer.issue.title + "\n<br>"
    if(offer.issue.project):
        msg += "project : " + offer.issue.project.name + "\n<br>" +\
               "project.trackerURL: " + offer.issue.project.trackerURL + "\n<br>"
    notify_admin("INFO: Existing issue sponsored", msg)
    return offer
Пример #10
0
def sponsor_existing_issue(issue_id, dict, user):
    issue = Issue.objects.get(pk=issue_id)
    issue.touch()
    _throwIfAlreadySponsoring(issue, user)
    offer = _buildOfferFromDictionary_and_issue(dict, user, issue)
    offer.save()
    if issue.is_public_suggestion:
        issue.is_public_suggestion = False
        issue.save()
    watches = watch_services.find_issue_watches(issue)
    notifyWatchers_offeradded(offer, watches)
    msg = "offer: " + str(offer.price) + "\n<br>" +\
          "issue key: " + offer.issue.key + "\n<br>" +\
          "issue title: " + offer.issue.title + "\n<br>"
    if (offer.issue.project):
        msg += "project : " + offer.issue.project.name + "\n<br>" +\
               "project.trackerURL: " + offer.issue.project.trackerURL + "\n<br>"
    notify_admin("INFO: Existing issue sponsored", msg)
    return offer
def add_solution_to_existing_issue(issue_id, comment_content, accepting_payments, user):
    issue = Issue.objects.get(pk=issue_id)
    solution = get_or_none(Solution, issue=issue, programmer=user)
    if(solution):
        _throwIfSolutionInProgress(solution, user, 'add solution')
        solution.reopen(accepting_payments)
    else:
        solution = Solution.newSolution(issue, user, accepting_payments)
    solution.save()
    issue.update_redundant_fields();
    comment = None
    if(comment_content):
        comment = IssueComment.newComment(issue, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(solution.issue)
    notifyWatchers_workbegun(solution, comment, watches)
    if(accepting_payments):
        notifyWatchers_acceptingpayments(solution, watches)
    return issue
Пример #12
0
def add_solution_to_existing_issue(issue_id, comment_content,
                                   accepting_payments, user):
    issue = Issue.objects.get(pk=issue_id)
    issue.touch()
    solution = get_or_none(Solution, issue=issue, programmer=user)
    if (solution):
        _throwIfSolutionInProgress(solution, user, 'add solution')
        solution.reopen(accepting_payments)
    else:
        solution = Solution.newSolution(issue, user, accepting_payments)
    solution.save()
    comment = None
    if (comment_content):
        comment = IssueComment.newComment(issue, user, comment_content)
        comment.save()
    watches = watch_services.find_issue_watches(solution.issue)
    notifyWatchers_workbegun(solution, comment, watches)
    if (accepting_payments):
        notifyWatchers_acceptingpayments(solution, watches)
    return issue
def process_ipn_return(paykey, status, tracking_id):
    if status == 'COMPLETED':
        payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id)
        if not payment:
            raise BaseException('payment not found ' + paykey)
        if payment.status == Payment.CONFIRMED_IPN:
            return  # double notification, nothing to do
        payment.confirm_ipn()
        payment.offer.paid()
        payment.offer.issue.touch()
        watches = watch_services.find_issue_watches(payment.offer.issue)
        notify_payment_parties_and_watchers_paymentconfirmed(payment, watches)
        notify_admin_payment_confirmed(payment)
        ActionLog.log_pay(payment)
    else:
        subject = 'received a payment confirmation with status = %s' % status
        msg = 'paykey = %s\nconfirm_key=%s' % (paykey, tracking_id)
        mail_services.notify_admin(subject, msg)
        logger.warn(subject)
        logger.warn(msg)