forked from openSUSE/open-build-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] Synchronize serialization of comment and event payload
SendEventEmailsJob is creating notifications from certain events. As part of this the serialized event payload is copied to the 'event_payload' attribute. Both models were using different serialization libraries (Yajl::Encoder for events, ActiveSupport::JSON.encode for notifications), which could cause the stored data format to differ, eg. active support encodes certains chars differently. In general this was not causing any trouble, because the decoded data would be the same. But it could happen that the payload of the notification is bigger than the original event payload and exceeds the size limit of that field. In such a case the notification creation failed with a ActiveRecord::ValueTooLong error. By using the same serialization method in both places, we avoid this from happening. Since notifications are created from events, and the event payload length is already sanitized based on that serialization method used by the event model, we pick the Yajl::Encoder. Fixes openSUSE#3638 openSUSE#4161
- Loading branch information
Showing
4 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters