Skip to content

Commit

Permalink
Fixes bugs in promotion code:
Browse files Browse the repository at this point in the history
Updates an occurrence of "index" that should have been changed to campaign._id
during the campaign thing reads change. This fixes two bugs:

(1) Campaigns were being incorrectly marked with "update failed" when edited
by an admin or sponsor even though the update was successful.

(2) Campaigns were not being automatically marked as freebies when edited by
an admin or sponsor. (These have to be set as freebies in self-serve because
they are billed separately.)

This change also checks for an empty user string so the update function can
be run in paster shell.
  • Loading branch information
shlurbee authored and bsimpson63 committed Aug 21, 2012
1 parent 7205f9a commit 15d60fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions r2/r2/lib/promote.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def edit_campaign(link, campaign_id, dates, bid, sr):
# make it a freebie, if applicable
author = Account._byID(link.author_id, True)
if getattr(author, "complimentary_promos", False):
free_campaign(link, index, c.user)
free_campaign(link, campaign._id, c.user)

except Exception, e: # record error and rethrow
g.log.error("Failed to update PromoCampaign %s on link %d. Error was: %r" %
Expand Down Expand Up @@ -544,7 +544,7 @@ def auth_campaign(link, campaign_id, user, pay_id):
link.promote_status))
# notify of campaign creation
# update the query queue
if user._id == link.author_id and trans_id > 0:
if user and (user._id == link.author_id) and trans_id > 0:
emailer.promo_bid(link, campaign.bid, campaign.start_date)

else:
Expand Down

0 comments on commit 15d60fb

Please sign in to comment.