Commit graph

14 commits

Author SHA1 Message Date
Matthias Mullie 0ef4df8e15 Expose more data through API
Instead of relying on the frontend to render, this enables the frontend
to do it.

The API will now accept a new format: 'model', which is basically the
presentation model's data in json format.

Some of the render code is currently only in the backend (e.g. get icon
path from icon type) so other api formats will stay available. At some
point, however, we may be able to kill those.

Bug: T115418
Change-Id: Ibc3ad54c94d6ea9bf751f3927cf69e1d062f4780
2015-11-20 19:27:34 +00:00
James D. Forrester eb4e17f15d build: Enable phpcs rule 'PSR2.Classes.PropertyDeclaration.ScopeMissing' and make pass
Change-Id: I96b295bba43185085631722e10a5e5cfa7ecf27f
2015-10-29 13:06:43 +01:00
Kunal Mehta ba957d399a Allow presentation models to indicate a notification can't be formatted
Adds EchoEventPresentationModel::canRender() for notification types to
indicate that something can't be rendered if for example, a page is
deleted.

In that case, the notification is marked as read in a deferred update.
All callers were also updated to check if the notification was formatted
properly.

Bug: T116888
Change-Id: Idb975feaec893ef86c41cc487102e3539c07e328
2015-10-28 18:28:08 -07:00
Kunal Mehta 1f366807d6 Don't use $wgLang in DataOutputFormatter
Require callers to pass it in.

Change-Id: I94ec940495a681151b289294186121462d4b5b5c
2015-10-26 08:37:57 -07:00
Kunal Mehta f40ef7019f Require $user parameter in DataOutputFormatter::formatOutput()
All callers already pass it.

Change-Id: Ic99893f53d6379a3fbbc2a45193e6804264ff7b7
2015-10-26 08:34:51 -07:00
Kunal Mehta 56c4b95087 Clean up and refactor formatting system
The workflow to format a notification is
* Get EchoEvent, User, and Language
* Get EchoEventFormatter implementation for notification type
** EchoEventFormatter returns structured data about each part of the
notification (header, body, primary link, secondary link(s))
* Each output type will have a formatter class (e.g.
EchoSpecialNotificationsFormatter, EchoPlainTextEmailFormatter) which
takes a EchoEventPresentationModel and generates whatever it wants
(HTML, plain-text email, etc).

Included is an example conversion of the user-rights and mention
formatters. The previous infrastructure will remain in place for
backwards compatability until other extensions can be updated.

Bug: T107823
Change-Id: I4397872a7ec062148dfcb066ddd8ab83f40486ac
2015-10-19 10:00:23 -07:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
Kunal Mehta 5d772ad76b Expose the revid of the event revision in the API
So custom applications can generate links to the revision
the event is about

Change-Id: I21d0417b9e014ff59f26a94cbcc28f22044a4a39
2015-09-02 11:03:02 -07:00
Kunal Mehta d072a9a47b Add some type-hinting and doc fixes
And remove some useless code as well.

Change-Id: I97a2ca08a1d4ef0b59535c1c002840f108defe4a
2015-08-06 15:36:05 -07:00
Erik Bernhardson 70639162f3 Allow multiple target pages per event
Bug: T85064
Change-Id: I338f3d73efb98a3bb66ef64fdeeb66e752a453c2
2015-03-31 07:56:52 +00:00
bsitu 25d6d71a61 [5] Code cleanup and miscellneous fix
* cache function result in local variables

* Update the logic of generating notification date header

Change-Id: I04c3ed853076f17c819da8f27bfdb169e99b2a3a
2014-08-19 17:58:07 +00:00
bsitu 7be9d68219 Auto mark notification as read if it doesn't have target page
The special page will now not auto mark a notification as read if
it has a target url. Currently no notifications have target urls
but this will be changed in a later patch...

Change-Id: I9bd71d59391189d5d761ab5f1c84af0bc3554be0
2014-08-15 00:11:57 +00:00
bsitu b26cc21794 static method should be declared with static
Change-Id: I855c09d950a44ae70b7d982e8c3e23b36dde1475
2014-07-31 13:10:35 -07:00
bsitu d3d99772b9 Replace EchoBackend with mappers and gateway
* Get rid of EchoBackend by separating responsibilities into smaller objects

* Move main fetchNotification logic from API to a more appropriate place

* Add more unit testing coverage

Change-Id: I42f4d7566543332588431c21c220c0d64d026b70
2014-07-31 10:29:52 -07:00