cachet icon indicating copy to clipboard operation
cachet copied to clipboard

Wrong component status in status update email

Open fdhex opened this issue 10 years ago • 14 comments

Before submitting your issue, please make sure that you've checked the checkboxes below.

  • [x ] I am running the 2.4 version of Cachet.
  • [x ] I am running at least PHP 5.5.9. You can check this by running php -v.
  • [x ] I have ran rm -rf bootstrap/cache/*.

Expected behaviour

  • When a component gets updated to major outage, subscribers receive an email with content "The component XXX has seen a status change. The component is now at Major Outage."

Actual behaviour

  • When a component gets updated to major outage, subscribers receive an email with content "The component XXX has seen a status change. The component is now at Operational." -> Operational is the old status.

Steps to reproduce

  • Create a component, add a subscriber, update the status, check the received email.

fdhex avatar Aug 16 '16 08:08 fdhex

I'd like to help with that one as it's pretty significant issue for me, but somehow I can't pinpoint what is going wrong there. The changes introduced by @jbrooksuk regarding the old_status and new_status seem to be additions to the previous code, and the component still updated with the new $command status. Any ideas so that I could try to move forward with this?

fdhex avatar Aug 19 '16 08:08 fdhex

Seems like the perfect excuse to get #2060 put into action.

ConnorVG avatar Aug 19 '16 08:08 ConnorVG

@ConnorVG Thanks for the work! Regarding the bug, have you had the chance to take a look?

fdhex avatar Aug 23 '16 08:08 fdhex

@fdhex it's something that will surely be looked into and easier to avoid once we have proper mail testing in place. After my initial testing I wasn't actually able to replicate this bug myself, though.

ConnorVG avatar Aug 23 '16 08:08 ConnorVG

Which may correlate with me not finding what's the problem in the code - I'll check my installation, maybe some local issues.

fdhex avatar Aug 23 '16 08:08 fdhex

Could this be an instance of an email sending job is created - before - the update to the database is done?

fdhex avatar Aug 23 '16 09:08 fdhex

@fdhex that could very much be it, actually

ConnorVG avatar Aug 23 '16 09:08 ConnorVG

debugbar

I don't know much Laravel but I've tried to use this Debugbar I found, and here are the requests when updating the component from 1 to 2. I'm not sure if they are ordered in the order they are done, but if yes that's indeed the issue. Not sure how to fix it yet though...

fdhex avatar Aug 23 '16 10:08 fdhex

We should instead be using the variables on the event (https://github.com/CachetHQ/Cachet/blob/2.4/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php#L42) rather than the property on the component (https://github.com/CachetHQ/Cachet/blob/2.4/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php#L100)

Note: I haven't tested this, it may not be the issue.

ConnorVG avatar Aug 23 '16 10:08 ConnorVG

But it's two different Events no? Can you send a variable from one to the other?

fdhex avatar Aug 23 '16 11:08 fdhex

@ConnorVG I'm going to assign this one to you, since you're already kinda on it.

jbrooksuk avatar Aug 23 '16 11:08 jbrooksuk

Just wanted to let the group know that i was able to replicate the issue running php 5.6.24. I have tried both database and sync queues, haven't had a chance to try the other.

wonhchoi avatar Aug 24 '16 02:08 wonhchoi

Above fix is working for me!

fdhex avatar Aug 28 '16 18:08 fdhex

Closed by https://github.com/CachetHQ/Cachet/commit/b40066b20e0d5b3262d81c69d4edeeb60f7d8a00

jbrooksuk avatar Oct 08 '16 09:10 jbrooksuk