ONEARMY / community-platform

A platform to build useful communities that aim to tackle global problems
https://platform.onearmy.earth
MIT License
1.08k stars 362 forks source link

[bug] Saving a new Research Article Update as Draft triggers the webhook #3740

Open pizzaisdavid opened 1 week ago

pizzaisdavid commented 1 week ago

To Reproduce Steps to reproduce the behaviour:

  1. Start emulator backend.
  2. Start frontend for emulator.
  3. Login as precious plastic.
  4. Edit the existing Research Article.
  5. Create a new Update.
  6. Create a title, description, and add a photo.
  7. Press save as draft.
  8. Check in the command line that the webhook was triggered.

Link to emulator: https://github.com/ONEARMY/community-platform/blob/master/packages/documentation/docs/Backend%20Development/firebase-emulator.md#commands

Expected behaviour The webhook should not be triggered.

Also, as Ben has pointed out in the comments, that if the article is a draft, it is currently also possible to trigger the webhook, which is bad mm'kay.

pizzaisdavid commented 1 week ago

When you fix this, it would be good to add a corresponding unit test, you can use this as a base: https://github.com/ONEARMY/community-platform/blob/master/functions/src/Integrations/firebase-discord.test.ts

benfurber commented 1 week ago

I can accidently confirm this problem. This is a draft update on a draft research article!

Screenshot 2024-07-08 at 16 55 45
pizzaisdavid commented 1 week ago

@benfurber Good catch, I have updated the description.

Someone please consider adding the label Good First Issue. :)