def addOfferComment(request): offer_id = int(request.POST['offer_id']) comment_content = request.POST['content'] watch_services.watch_offer(request.user, offer_id, OfferWatch.COMMENTED) offer = comment_services.add_comment_to_offer(offer_id, comment_content, request.user) return redirect(offer.get_view_link())
def test_watch_toggle_offer(self): offer = test_data.create_dummy_offer() user = offer.issue.createdByUser self.assertTrue(not watch_services.is_watching_offer(user, offer.id)) watch_services.watch_offer(user, offer.id, OfferWatch.WATCHED) self.assertTrue(watch_services.is_watching_offer(user, offer.id)) watch_services.unwatch_offer(user, offer.id) self.assertTrue(not watch_services.is_watching_offer(user, offer.id))
def test_watch_toggle_offer(self): offer = test_data.create_dummy_offer_usd() user = offer.issue.createdByUser self.assertTrue(not watch_services.is_watching_offer(user, offer.id)) watch_services.watch_offer(user, offer.id, OfferWatch.WATCHED) self.assertTrue(watch_services.is_watching_offer(user, offer.id)) watch_services.unwatch_offer(user, offer.id) self.assertTrue(not watch_services.is_watching_offer(user, offer.id))
def watchOffer(request, offer_id): watch_services.watch_offer(request.user, int(offer_id), OfferWatch.WATCHED) return HttpResponse('WATCHING')