Commit graph

29 commits

Author SHA1 Message Date
Aaron Schulz
140da10741 Move updateNotificationTimestamp callback to DeferredUpdates
* This puts the complex logic here after the commit step for
  all DBs, making the main multi-DB transaction more likely
  to be atomic.
* Also fixed the reuseConnection() call by getting a new
  handle in the callback.

Change-Id: I449a521423ff13bfbf49bdaa6e7e6df2145c8751
2016-07-19 15:27:29 -07:00
addshore
eacec0a223 add setNotificationTimestampsForUser to WatchedItemStore
Bug: T134387
Change-Id: Ia6abe7687b51aabe67e8461375075692db28c9a2
2016-05-18 08:50:46 +00:00
addshore
818984e5cb Remove WatchedItemStore::getDefaultInstance
Change-Id: I0c7d706fabee8d1f6fcfbc4c568f375953de8058
2016-05-06 08:47:37 +00:00
addshore
8a71ee8ec3 Make WatchedItemStore use MediaWikiServices
(This is a re-submi8t of I5c8c1a65 after it got reverted by Iae7f7b7)

Change-Id: I193de7ef1566336040463b71735b09db941d8ce1
2016-05-06 08:47:29 +00:00
Leszek Manicki
70f5f90d4b Assert jobs called from WIS::resetNotificationTimestamp are correct
This also adds tests for some previously untested paths.

Change-Id: Id95144c0bad90cfc123a4444a03aad91531d2332
2016-04-29 09:14:16 +00:00
Kunal Mehta
c9d885f3b4 Namespace LinkTarget under MediaWiki\Linker
And add a GPL file header while we're at it.

Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
2016-04-21 17:19:10 -07:00
addshore
2cad416fe7 Test coverage WatchedItemStore::duplicateAllAssociatedEntries to 100%
Change-Id: I3d686fda1175a9ae5e4244b9ba8cfdb416950ebd
2016-04-18 11:42:39 +00:00
addshore
80f9cfd32e Test coverage WatchedItemStore::addWatchBatchForUser to 100%
Change-Id: I6ff916519af87a40187d86149b0b72c2ab5a5f26
2016-04-18 12:42:24 +01:00
Leszek Manicki
35783aeb76 Remove unused import in WatchedItemStoreUnitTest
Change-Id: I56abf221e6e601ad0bceaae1a15eb8f1097f5baa
2016-04-14 17:28:44 +02:00
Catrope
deb22bced7 Revert "Make WatchedItemStore use MediaWikiServices"
In order to cleanly revert "Allow reset of global services"
which breaks login.

This reverts commit 99e8d45b50.

Change-Id: Iae7f7b7b7083345dd50c313ee68e2e814f130f1a
2016-04-11 20:25:47 +00:00
addshore
99e8d45b50 Make WatchedItemStore use MediaWikiServices
Change-Id: I5c8c1a652a35e055d8d65753a60c0d1684e1c37d
2016-04-11 15:50:15 +01:00
addshore
6ae77e6984 Introduce NullStatsdDataFactory
I have left the phpdocs in NullStatsdDataFactory
to clearly show the return types of the interface
implemented.

Change-Id: I96cb64b4af16fc087028269a53d539f8c132f81c
2016-04-02 13:02:37 +00:00
addshore
9d18093909 Track the use of the WatchedItemStore Cache
Change-Id: Idc33dd6a52471e895b312fa2c6562a90bf3d7861
2016-04-01 15:06:09 +03:00
addshore
13eb234654 Add WatchedItemStoreUnitTest::newWatchedItemStore
Change-Id: Ic3e1d23b8f707ae5e3221d1c2fd08878ae8bfff9
2016-04-01 14:59:30 +03:00
addshore
12e2e9edbc Switch Signature of WatchedItemStore::addWatchBatch
Adding batches of watched items per users
makes much more sense.
Only the deprecated static WatchedItem method
needed the old silly way of passing in objects.

Change-Id: I90f9583b66bd3b5afcf07faefedb38a8a0149f6e
2016-03-24 18:28:08 +00:00
addshore
4e42311f92 Use WIS::getWatchedItemsForUser in SpecialEditWatchlist
This also adds a order option to:
WacthedItemStore::getWatchedItemsForUser

Tests are also updated

Change-Id: Ia683b92846ad79bde3f37068a8e168c5a8bdc201
2016-03-24 12:33:38 +00:00
jenkins-bot
98c62a6542 Merge "Add WatchedItemStore::getWatchedItemsForUser" 2016-03-23 15:45:45 +00:00
addshore
659fd5ec9c Add WatchedItemStore::getWatchedItemsForUser
This method is also no used in SpecialEditWatchlist

Unit and Integration tests have also been added.

Bug: T129481
Change-Id: Ica136b6fee63be8de4c2fe502288dd2318d99114
2016-03-23 14:01:31 +00:00
Leszek Manicki
b92ae1501e Use WatchedItemStore in ApiQueryInfo::getWatchedInfo
Adds a method for getting watchlist's notification timestamps
for a batch of LinkTargets.

Bug: T129482
Change-Id: I1f84212e7879a84b34bb3b53859069fcea282bba
2016-03-21 10:25:54 +01:00
Leszek Manicki
7d4e225cb9 Add WatchedItemStore::countVisitingWatchersMultiple
This is for batch counting of visiting watchers, following the change
made in I2868c31fc09121de381d822e8f49194e3022bb42.
Query/logic has been extracted from ApiQueryInfo.

Bug: T129482
Change-Id: Ia9a534f5edb7af3cb7bf86be358dddb5d8c259cf
2016-03-17 16:17:38 +00:00
addshore
bfa8662b73 Add WatchedItemStore::countWatchedItems
This method counts the number of individual items
that a user is watching.
A subject and corresponding talk page would mean a
count of 2

Unit and integration tests are also added here

Bug: T129481
Change-Id: I4b55318dc1d1c5abab1c5da16cebf1a43ddf9248
2016-03-15 15:58:51 +00:00
addshore
3ab9a9656c Reset WatchedItemStore default instance after tests
Prior to this change in tests the overridden store
would remain in the instance static and thus could
be used in other places.

This patch introduces the used of ScopedCallbacks
in the override methods in WatchedItemStore.
This means that any instance of WatchedItemStore
should return to a regular state after each test.

This is better than requiring the tests to reset
the value back to the origional as this would likely
be forgotten and result in long hunts for failing
tests.

This was found while writing more tests...

Change-Id: I9aa71425642174ae9ea2c6d4f85dcd07d724af11
2016-03-15 15:36:38 +00:00
addshore
846d373c28 Add countUnreadNotifications to WatchedItemStore
This query / logic has been extracted from
ApiQueryUserInfo.

Unit & Integration tests have also been added.

Relating to the task linked this is the last change
needed in this ApiQueryUserInfo!

Bug: T129482
Change-Id: I91aa109416c16cd1f257c9de46669e35d6fd34d7
2016-03-14 16:00:47 +00:00
addshore
0b852c5717 Move countVisitingWatchers to WatchedItemStore
Also adds tests

Bug: T129479
Change-Id: I2868c31fc09121de381d822e8f49194e3022bb42
2016-03-14 15:56:43 +00:00
addshore
6e2d6a0b44 Move counting of watchers to WatchedItemStore
Also adds tests

Bug: T129479
Bug: T129482
Change-Id: I5a465773599cce9f8c9e94847cede6d12282c827
2016-03-14 15:56:16 +00:00
addshore
59e7587ed2 Improve cache assertions in WatchedItemStoreUnitTest
Change-Id: If4b2086cc29fcfc73dee2e9f96591a9e4aa50da9
2016-03-14 15:55:55 +00:00
addshore
8d984cebb2 Uncache things in WatchedItemStore::updateNotificationTimestamp
When the notification timestamp for a LinkTarget is
updated all items relating to that LinkTarget should
be uncached!..

This also switches this class from a BagOStuff to
a HashBagOStuff as this cache index is only maintained
per process..

Change-Id: I5dc58e018a6a4a15903abc1e0b326b4220abc75e
2016-03-14 15:13:19 +00:00
addshore
a683b11b23 Move EmailNotification::updateWatchlistTimestamp to WatchedItemStore
Flow is the only thing remaining that uses this deprecated method.

Change-Id: Iaa4e1e34cb3f2a91c163565fb0107c500e3852d7
2016-03-08 18:44:05 +00:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00