* don't set nil when size not called recently, #16570 worked around an issue where aggregated siblings wasn't present, by only calling size if present. Unfortunately, this causes a comparison of integer (new json_data aggregated siblings count) with nil (result of the safe navigation for dig()&.size assigned nil to previous_siblings_size, when we expected it to be 0). The initial error on the same data moved farther down the controller. If old_json_data is present, but does not have an array in reaction.aggregated_siblings, we want to have previous size be zero. Remove guard clause and previous assignment The issue was not that old_json_data was nil (it came from an existing notification) but that there were missing keys (or rather that the json data for some notifications didn't have a reaction key at all). Remove the guard clause and either set to the size, or zero if there is none. I don't understand what the guard clause was for, so replace the safety by adding a nil safe call to dig. I don't _believe_ this is possible but in case it was we can shorten the check here. * Add test to cover missing json_data['reaction'] key * Remove unneeded temporary variable |
||
|---|---|---|
| .. | ||
| milestone | ||
| moderation | ||
| new_badge_achievement | ||
| new_comment | ||
| new_follower | ||
| new_mention | ||
| notifiable_action | ||
| reactions | ||
| tag_adjustment_notification | ||
| welcome_notification | ||
| moderation.rb | ||
| remove_all.rb | ||
| remove_all_by_action.rb | ||
| update.rb | ||