mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
aa578a44a1
In the current bundling system, only the bundle base is mark as read. It leaves all the non-base bundled notifications without a read_timestamp. They would all appear as read in the new bundling system. With this change, all notifications in a bundled are update with a read_timestamp when the bundle is read. The implementation of this change is somewhat temporary as the new bundling system brings changes to the models and controller. Bug: T136368 Change-Id: I70b71d722d8d62cbdd1adc004293030ef900ac94
32 lines
855 B
PHP
32 lines
855 B
PHP
<?php
|
|
|
|
/**
|
|
* A formatter for the notification flyout popup. Just the bare data needed to
|
|
* render everything client-side.
|
|
*/
|
|
class EchoModelFormatter extends EchoEventFormatter {
|
|
/**
|
|
* @param EchoEventPresentationModel $model
|
|
* @return array
|
|
*/
|
|
protected function formatModel( EchoEventPresentationModel $model ) {
|
|
$data = $model->jsonSerialize();
|
|
$data['iconUrl'] = EchoNotificationFormatter::getIconUrl( $model->getIconType(), $this->language->getDir() );
|
|
|
|
if ( isset( $data['links']['primary']['url'] ) ) {
|
|
$data['links']['primary']['url'] = wfExpandUrl( $data['links']['primary']['url'] );
|
|
}
|
|
|
|
foreach ( $data['links']['secondary'] as &$link ) {
|
|
$link['url'] = wfExpandUrl( $link['url'] );
|
|
}
|
|
|
|
$bundledIds = $model->getBundledIds();
|
|
if ( $bundledIds ) {
|
|
$data[ 'bundledIds' ] = $bundledIds;
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|