Commit graph

329 commits

Author SHA1 Message Date
Kunal Mehta 999c53a1c3 Use CentralIdLookup instead of hardcoding for CentralAuth
Change-Id: I5b2d23588ab6b026d1a2100b9c16a74e9aefbd73
2015-12-08 16:54:23 -08:00
mhutti1 ea64fe4770 Redirect anonymous user to login page from Special:Notifications
Added code to redirect the user and display a short message informing
them of the need to login.

Bug: T118873
Change-Id: I2145bc1502dbd19d660302d9f19e0d4a2ad5ad50
2015-12-08 11:55:15 -08:00
Roan Kattouw ece6e3f80a Follow-up 65638384: update calls to normalizer functions
Change-Id: Id6352b133e88827047dac85423b6914b83e71909
2015-12-07 16:49:24 -08:00
Stephane Bisson 14b842bd34 Add gender support for the viewing user for mention notification
Bug: T119321
Change-Id: I1cd7caa7bfe811bab89a0c6950c1aeaf1739aac6
2015-12-04 16:53:11 -05:00
Stephane Bisson 65638384fc Normalize links in Special:Notifications formatter
Change-Id: I35354a3b27a59ee9740c6330bb3df22a8f7d6093
2015-12-03 11:11:15 -05:00
Roan Kattouw 52f4b91204 Allow grouping for getBundleCount()
Presentation models that display the number of bundled notifications
typically group these by a property like agent or page ID. For example,
every edit someone makes to a user talk page generates an event,
so there could be 5 edit-user-talk events by only 2 distinct users;
in that case we want to display "Foo and 1 other user left a message",
not "Foo and 4 other users".

With this change, a presentation model that wants such behavior
can pass a callback to getBundleCount() that retursn the user ID, which
will cause getBundleCount() to return the number of distinct
users rather than the total number of notifications.

Change-Id: I79c8dd14277eff0d2ec27f155b1d13dca1e571a8
2015-12-02 08:16:19 -08:00
jenkins-bot 434a034120 Merge "Special:Notifications formatter" 2015-11-30 21:30:05 +00:00
Stephane Bisson 259effc235 Get bundled notifications count
Utility functions to get the count of bundled notifications
for display and plural purposes.

Change-Id: I74d5ad244dec337a94e59c2118c33e474cd76797
2015-11-27 14:28:35 -05:00
jenkins-bot a8171d1f75 Merge "EventPresentationModel: Cache the result of getBundledEvents()" 2015-11-25 18:39:01 +00:00
Roan Kattouw 104075d2d4 EventPresentationModel: Cache the result of getBundledEvents()
Change-Id: I83ce3b7754055dd494fcde41f043144294da2f3f
2015-11-25 10:33:47 -08:00
Kunal Mehta 2892108b65 Special:Notifications formatter
I'm not really sure where to stick the primary link. I could wrap the
entire notification in a <a> tag, but all the text becomes ugly (I
suppose we could hack around it with CSS?). For now I just added it
before all the secondary links.

Change-Id: I4f6add9ecfb367660d1a6346825382ad415bdb77
2015-11-25 10:22:04 -08:00
Roan Kattouw 23734e3539 Follow-up b85f978ddd: don't check for the non-existent CentralAuth class
Change-Id: Ie7ca022c659f9856641aaec6183eadf8a86865a2
2015-11-24 19:34:27 -08:00
jenkins-bot cdee3093b3 Merge "Add secondary link details: icon & description" 2015-11-24 18:54:15 +00:00
Kunal Mehta 5be28ba4df Require a User object to be passed to EchoEvent::userCan()
All callers were already doing this.

Change-Id: If9e20e3d4740bcdb8842592e4cd988f8b35e1300
2015-11-23 16:08:17 -08:00
jenkins-bot 6eba89d400 Merge "Add accessor for bundled events in EventPresentationModel" 2015-11-23 23:43:41 +00:00
Kunal Mehta 9057196d21 Add accessor for bundled events in EventPresentationModel
The implementation of this sucks as the presentation model
should not be making database queries. But the API it provides
is what we want and will be supported even if the backend
implementation is changed.

Change-Id: Ifd0d11260990fd0e00e8f32eee273f9717d3e1fb
2015-11-23 15:13:31 -08:00
Matthias Mullie 30dcfeaa9e Add secondary link details: icon & description
We should probably merge this ASAP now that a lot of presentation
models still have to be implemented. There's a bit of B/C code that
will take care of the previous format, but it would be nice to be
able to remove that soon.

Meanwhile I've also changed getPrimaryLink to follow the same format.

Bug: T115421
Change-Id: Ic18a050d2ee0239f287a6d55c572df6f8aebb59a
2015-11-23 16:10:52 +00:00
jenkins-bot f875dfc191 Merge "Track what wikis a user has unread notifications on" 2015-11-21 00:05:44 +00:00
Kunal Mehta b85f978ddd Track what wikis a user has unread notifications on
This implements a backend layer and database storage for tracking what
wikis a user has unread notifications on. It is not yet exposed via any
API.

Whenever the notification counts on the local wiki are reset, a deferred
update is queued to also update the central database table.

Change-Id: Id1498bdeb5811d6848dc66781ffca03e726eab90
2015-11-20 15:54:11 -08:00
jenkins-bot 0416f39e68 Merge "Expose more data through API" 2015-11-20 23:41:55 +00:00
jenkins-bot 7a68a05083 Merge "Prevent link color on hover for the body ("payload") as well as the header" 2015-11-20 23:39:37 +00:00
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
Kunal Mehta 8c49a812e1 Unstub $wgLang in BasicFormatter::getLanguage() too
Bug: T118542
Change-Id: Ic9f3c03a3f1d38f2ea420cf32dcd3bb33d6c3635
2015-11-19 16:34:13 -08:00
Kunal Mehta a00628b42a EventMapper::fetchByUserBundleHash(): Always return an array
It's basically impossible for DatabaseBase::select() to return false now
that ignoreErrors() is protected. So always return an array so callers
don't have to worry about false.

And remove a test that checked the result if DatabaseBase::select() did
return false.

Change-Id: I9ca8511585403d8c0ec262898ad4e61c2b038d51
2015-11-19 10:12:43 -08:00
Roan Kattouw c8d0115fd5 Prevent link color on hover for the body ("payload") as well as the header
Change-Id: Id221af75ed76122b03f741c184053e73bd2f4ee5
2015-11-18 20:10:40 -08:00
jenkins-bot 904e1e5a8c Merge "Presentation model for reverted" 2015-11-19 00:55:46 +00:00
jenkins-bot 9c40143cef Merge "Presentation model for email-user" 2015-11-18 18:42:00 +00:00
jenkins-bot 5100bba74f Merge "Extract getMessageWithAgent" 2015-11-18 17:53:03 +00:00
Stephane Bisson b3ab132ffd Extract getMessageWithAgent
`getMessageWithAgent` is used by `getHeaderMessage` is can
be reused by other presentation models who need the
agent in their body message.

Bug: T118059
Change-Id: I0cbccaeb8b6e60d03bc75bc85c74591619b4399a
2015-11-18 09:47:24 -08:00
Matthias Mullie a35bf21084 'Load more' check should be based on retrieved data, not what could render
Since EchoEventPresentationModel::canRender can reject notifications,
its result should no longer be used for infinite scroll.

Current code checks if the amount of to-be-rendered data exceeds what
we need to display, but if we reject some notifications that may no
longer be the case, even though there is more data still.

Change-Id: I3e5f8c2d1fc0c63db7b277324c96af043689ddce
2015-11-18 11:06:22 +01:00
Stephane Bisson 44149b6cbd Presentation model for email-user
Bug: T116843
Change-Id: I99e790d72c7c534665d1d86c38459c5d0e60b91b
2015-11-17 12:44:45 -05:00
Stephane Bisson 3fa832c6c7 Presentation model for reverted
Bug: T116843
Change-Id: Ide03220ad8ad621b5943e36d71e484a21bc8a65b
2015-11-17 10:19:15 -05:00
Kunal Mehta dbc83a0c0c Unstub $wgLang before passing it to DiscussionParser::getTextSnippet()
getTextSnippet() has a `Language` type hint that will fatal if $wgLang
is a StubUserLang object, so make sure we unstub it if nothing else
already has.

Bug: T118542
Change-Id: I847680074fbbf95bbe3b6002151d2a18c45ebe6e
2015-11-16 10:41:51 -08:00
jenkins-bot 72cb6202b0 Merge "EventPresentationModel: Add accessor for current user's username" 2015-11-12 23:58:10 +00:00
jenkins-bot 20579a711b Merge "Allow welcome notifications to have a primary link" 2015-11-12 23:53:08 +00:00
jenkins-bot b36847f95f Merge "Fix some phpdoc, add missing @throws" 2015-11-12 23:52:06 +00:00
Kunal Mehta 40667ca7d4 EventPresentationModel: Add accessor for current user's username
Only to be used for GENDER purposes.

Bug: T118058
Change-Id: I5cf0563374ac1eaf934fecbf4bb68d35fa287edd
2015-11-12 14:34:24 -08:00
Kunal Mehta 0a0a62e3c3 Allow welcome notifications to have a primary link
Wikis can customize the 'notification-welcome-link' to a page title
(like "Project:Welcome" for example) and the "Welcome!" notification new
users receive will have a primary link to that page.

Bug: T117509
Change-Id: I29f6d69db480fa7d39573941e762c4dad8737ed0
2015-11-12 14:30:51 -08:00
Kunal Mehta fb56d61d68 Fix some phpdoc, add missing @throws
Change-Id: Iba072d64443ed9117233f591f1aea3cc6a4adc44
2015-11-12 14:10:52 -08:00
Kunal Mehta 5114aa2c26 Remove unused NotifUser::getFormattedNotificationCount()
As of 0790125dd4, this is unused.

Change-Id: I7d7080cd2c45c14a3fb59fc3b9d224fac8e55dd8
2015-11-12 11:21:56 -08:00
jenkins-bot 1619c87109 Merge "Make EchoEvent::create() a no-op if the DB is read-only" 2015-11-06 18:22:24 +00:00
Stephane Bisson 7e1a6e7b6f Output body in flyout
* Also rename getBodyText to getBodyMessage
  since it returns a Message.

Change-Id: I2aad6f766407c13625b1c35df3ae209f75849970
2015-11-04 16:24:37 -05:00
jenkins-bot bc4888169d Merge "Add a presentation model for Echo "Welcome" notification" 2015-11-04 18:34:33 +00:00
Timo Tijhof 59e1be5af9 Migrate LocalCache from MapCacheLRU to HashBagOStuff
Depends on If39d72983 for HashBagOStuff::clear().

Change-Id: I90a03ea44430223ef420be9175bea9bcc8da8cf5
2015-11-03 06:49:50 +00:00
Timo Tijhof b99048e9aa LocalCache: Fix bad type hint of getTargets()
Change-Id: Ib05064b6d812b89948f7927caa6a6bf5634a6a08
2015-11-03 06:02:31 +00:00
Moriel Schottlender 88b558f44d Add a presentation model for Echo "Welcome" notification
Bug: T116843
Change-Id: Ia43ce2c467873390c2b36439af1db8932708cda9
2015-11-02 16:02:06 -08:00
Kunal Mehta 38e54e14fb Allow notifications to not have a primary link
Because 'welcome' doesn't.

Returning `false` indicates that there is no link, and the
FlyoutFormatter was updated accordingly.

Change-Id: Ifd329b396f3361fc7c08c607a6407181ffdb8bf6
2015-11-02 15:55:17 -08:00
Aaron Schulz e261aa7593 Make EchoEvent::create() a no-op if the DB is read-only
This seems better for availability than stopping the world
and rolling everything back (or just throwing post-commit
errors that didn't stop the original change anyway).

Change-Id: I816b3cb5f0d26de608e620a01571a332aa832c05
2015-11-02 11:17:05 -08:00
Kunal Mehta 558cc64bc2 IDatabase::delete() does not take a fourth parameter
And don't use the deprecated getDB() function.

Change-Id: I824fb1e69262298d6b76fb22b499d961c1189f98
2015-10-30 10:49:59 -07:00
Kunal Mehta 74b50cad30 Move some boilerplate code into EchoEventFormatter
The conversion of EchoEvent into a EchoEventPresentationModel is now
done by EchoFlyoutFormatter, instead of having each subclass do it. It
also does the canRender() check so subclasses don't need to worry about
it.

The subclasses no longer have access to the underlying EchoEvent object,
so the timestamp is exposed in EchoEventPresentationModel.

Change-Id: I7f0a650373eebac7aa2231b1795b51a6d031ad67
2015-10-29 21:22:54 +00:00