Commit graph

764 commits

Author SHA1 Message Date
Brad Jorsch f608d73287 Update for API error i18n
See Iae0e2ce3. Since Echo master requires core master, this just depends
on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: Icc088b31bc99e03ac88dfb44329df55318bf99b5
2016-11-14 12:48:24 -05:00
WMDE-Fisch 5d0a03fcf1 Fix typo in doc
Change-Id: I8a4c3119391ef436cb021b8512ccd3a2dce185f4
2016-11-01 15:08:29 +01:00
Aaron Schulz cfa0aa099a Fix bogus variable usage
Change-Id: I9100648d5b6be63a697a8660def33e592d010688
2016-10-17 19:53:10 -07:00
Kavitha Muthu d3d61409d3 Show orange alert and provide hook
Show orange alert for all notification types in the edit-user-talk
category and provide a hook to enable other extensions to prevent
the orange alert from appearing.

Bug: T137954
Change-Id: I0b49c3a5eb0a027f8839ab86e77c527357907dd0
2016-10-14 17:54:29 +00:00
Reedy 161f21ab5a Database and LoadBalancer documentation updates
Replace deprecated function calls

Change-Id: Id7e4136d7258abb61117fff73d51766954605737
2016-10-09 21:21:33 +01:00
addshore 4010faaf89 Add some typehints & phpdoc
Change-Id: Ic5751f0745685ea4db009458b5976907dc22c518
2016-10-05 23:27:02 +01:00
Reedy 21faa050f6 Replace Revision::getText()
Bug: T147380
Change-Id: I3864fc64bd178471b1454033adbc9137485d1563
2016-10-05 00:42:45 +01:00
Roan Kattouw 9d8e09e71b Don't show pages and counts related to disabled notification types on Special:Notifications
Bug: T147138
Change-Id: I4350377720644015a1db9789979fb80cd4844745
2016-10-04 11:35:30 -07:00
enigmaeth 5b9ee79253 Dropped call to WikiPage::getText()
Bug: T146994
Change-Id: I47c5258154749b70f380c1462a4d310a04f1d85b
2016-09-29 18:47:29 +00:00
jenkins-bot e888d95f1e Merge "Used parsed section titles for anchors" 2016-09-28 14:46:47 +00:00
Roan Kattouw 6eea6d93a1 Used parsed section titles for anchors
This allows us to link to the right section when the section
title contains templates or magic words.

* Add getParsedSectionTitle()
* Use it in getTitleWithSection()
** Stop using Parser::guessSectionNameFromWikiText() because it
   wants preprocessed wikitext, not fully parsed and stripped text
* Move getTruncatedSectionTitle() from EventPresentationModel to
  PresentationModelSectionTrait and make it use getParsedSectionTitle()

Bug: T134216
Change-Id: I877ff6b0ce4e64400f6e5f6284ae47a11cd4335b
2016-09-27 16:17:59 -07:00
jenkins-bot faf3bee07c Merge "Fix links to sections with [[links]] in their title" 2016-09-27 19:53:33 +00:00
jenkins-bot 4f2ef135a7 Merge "Make user rights notifications link to added/removed group" 2016-09-27 04:00:07 +00:00
Kavitha Muthu a518044bb3 Make user rights notifications link to added/removed group
This change was made to direct users to the added/removed group.
Notification about the change in the user's right will route the user
to a page about the group.

Bug: T55860
Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
2016-09-27 03:53:53 +00:00
Roan Kattouw 229db67347 Fix links to sections with [[links]] in their title
We would generate things like #Foo_.5B.5Bbar.5D.5D
instead of #Foo_bar . Unfortunately this doesn't
fix section titles with templates / magic words
in them, because those are parsed at notification render
time instead of at notification generation time.

Bug: T134216
Change-Id: Ia171324a4a616c956ab08fcff38293f18dc765fa
2016-09-26 17:16:24 -07:00
Roan Kattouw 44a210c720 Defer cache write in EchoSeenTime::setTime()
This can be called on GET requests, like when visiting Special:Notifications,
and also from getTime() on a cache miss. Defer the write to the real
cache, but update the in-memory cache immediately.

Bug: T146492
Change-Id: I24db223ded9508942dc0ef1abf55952e98f444d0
2016-09-23 12:11:37 -07:00
Roan Kattouw 8269970305 Remove unused $flags parameter for EchoSeenTime::getTime()
It was always set to 0, and we were using the old (pre-2015)
get() interface so it wouldn't have worked anyway.

Change-Id: Ie92b223a485a5d9d256d2dc69d4ff3807e838878
Bonus: remove documentation for nonexistent parameter for setTime().
2016-09-23 11:53:59 -07:00
jenkins-bot f40f1aa36c Merge "Convert 'seenTime' to a global property" 2016-09-20 23:22:26 +00:00
Matthew Flaschen ffd9d4bb4d Fix moderation controller
The change to use DeferredUpdates had a missing use.

Change-Id: Ied72608c9b3aa597627aa5ea069c257f506c3c1b
2016-09-20 01:44:25 -04:00
jenkins-bot 21cd011dda Merge "Make sure bundledNotifications is an array" 2016-09-20 00:13:56 +00:00
Moriel Schottlender f47c554e1c Make sure bundledNotifications is an array
- Make sure that even if internal values of the array are null,
  the end-result is a valid array (with sequential keys)
- Verify that the API sent the UI an actual array, and if not,
  output an error to the console.

Bug: T145825
Change-Id: Ibdf17c58fe88e3e2547dde62cd4d3d06e089cbc8
2016-09-19 23:08:14 +00:00
jenkins-bot 92c7c8d521 Merge "Remove primary link from the bundle of page linked notification" 2016-09-19 22:59:15 +00:00
Moriel Schottlender 1575e2bb7a Convert 'seenTime' to a global property
This transforms seenTime concept to a global property for all wikis
and sources, and updates the global seen time on opening the popup.

Bug: T134855
Change-Id: I67bcc4b346237317c7a9204dd43cd0e9ee02792f
2016-09-19 14:37:31 -07:00
Moriel Schottlender 58c53af1d1 Remove primary link from the bundle of page linked notification
Also, make sure that the bundle follows the same behavior as the
xwiki bundle, where if it does not have a primary link, the 'click'
event triggers the 'expand' action.

Bug: T145902
Change-Id: I456bf76a7bd531ffcad5462708f37cd54d8af99d
2016-09-19 14:16:43 -07:00
jenkins-bot bac8d67e99 Merge "Count the number of success & failure notifs sent" 2016-09-19 08:14:32 +00:00
Matthew Flaschen f2327a919b Fix GENDER without explicit parameter
Although we generally use getViewingUserForGender, these messages
are UI and in user language, so we should change the flag anyway.

getViewingUserForGender is essential for messages that are used
in batch jobs.  Some messages technically don't require it, though
it's probably best to be consistent anyway.

Bug: T144538
Change-Id: I7b57777ab93b5752165c7bdd85fa5ce66b294b22
2016-09-14 16:39:49 -04:00
addshore cb575928a9 Count the number of success & failure notifs sent
Change-Id: I3e11bc8878ddf48265c628d828ee700f3aee7bbb
2016-09-14 13:35:03 +02:00
Jakob Warkotsch 3da89ea4d9 Send notification for mentions on changes
This sends out a notification when a user gets mentioned in a change as
long as a signature is added in the same section.

Bug: T138938
Change-Id: Ie183fbb8150bd9451a5b0a9fea0227e3241b26a0
2016-09-14 12:36:22 +02:00
jenkins-bot 5fd9831c07 Merge "Send mentions when editing multiple sections in between sections." 2016-09-14 10:06:36 +00:00
Catrope bba984c002 Revert "Make seen/unseen badge more consistent across wikis"
Has bugs, and will likely cause deployment problems.
This'll need to be reverted in wmf.19 at least
until we fix it up.

This reverts commit 00e0b9f45d.

Change-Id: Ia9d220ebcb607f96dee6bc856755305ed8501fcc
2016-09-13 14:21:32 -07:00
jenkins-bot 1f3517e562 Merge "Fix seen time for new users" 2016-09-13 17:31:59 +00:00
Moriel Schottlender cc36178e4a Add {{GENDER}} support to dynamic action messages
Make sure we pass the current user to the message, since empty
{{GENDER:|}} doesn't seem to work in PHP.

- Add parameter to documentation
- Add {{GENDER}} syntax to en.json as example
- Add parameter to the message creation

Bug: T144538
Change-Id: Ifc5e3bbe8309cc9ce120b7d61cdc050d7055aacc
2016-09-12 15:30:29 -07:00
jenkins-bot 28248c0cc2 Merge "Actually insert target page entries when creating an Event" 2016-09-12 21:32:03 +00:00
Stephane Bisson d7845da3f6 resetNotificationCount() from replica with no lag
When notifications are being moderated, the unread count
for affected users has to be recalculated.

It was initially done using DB_SLAVE but it was leading
to inconsistent data since that database did not know
about recently deleted notifications.

It was changed to DB_MASTER but it potentially led
to too many queries on master.

This patch tries to wait for the replica to have
caught up with those changes and use it to update
the unread count for the affected users.

Bug: T93673
Change-Id: Ib4a845e82f686dd7ed807ab21a28490014b56604
2016-09-12 19:59:02 +00:00
Stephane Bisson bc03468473 Actually insert target page entries when creating an Event
This was broken in Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a

Bug: T145232
Change-Id: Ieaad1febaf07bdcf8aee3761afbd039c082fc9ad
2016-09-12 15:05:18 -04:00
jenkins-bot 7f24836607 Merge "Make PresentationModel::getPrimaryLinkWithMarkAsRead() final" 2016-09-12 13:28:05 +00:00
Kunal Mehta 7051cfb2a5 Make PresentationModel::getPrimaryLinkWithMarkAsRead() final
Subclasses should not override this. Also fix the return type phpdoc of
getNotificationCountForOutput().

Change-Id: Ia6963794d3a68dca742fe52ac197edf1575bed76
2016-09-11 12:46:08 -07:00
Moriel Schottlender 615ffb1125 Always cap notification count based on MWEchoNotifUser::MAX_BADGE_COUNT
Also increase Echo version so we update the cache.

Bug: T144707
Change-Id: Ie939d313c8c6a8168fa3eb3036d9275270575559
2016-09-09 17:15:15 -07:00
Matthew Flaschen 98c6cd9eab Fix seen time for new users
Until the user opens the popup the first time, everything should be
unseen, rather than nothing unseen.

Also, make the default 'everything unseen' if we forget their seen
time.

Change-Id: I99ff8d46d4fa2fab0db374ddff63727b18a68363
2016-09-09 17:46:34 -04:00
Sébastien Santoro ad0cf6cda0 Fix MentionStatusPresentationModel::getSecondaryLinks return value
Any class implementing EchoEventPresentationModel and overriding the
getSecondaryLinks method should return an array (while getPrimaryLink
could return a false boolean value).

This change fixes the following errors:

Warning: array_values() expects parameter 1 to be an array or collection
in …/extensions/Echo/includes/formatters/EventPresentationModel.php on line 494

Warning: array_filter() expects parameter 1 to be an array or collection
in …/extensions/Echo/includes/formatters/EventPresentationModel.php on line 494

This is a follow-up for commit b4b59ee4.

Bug: T145229
Change-Id: Ic66ca03b6979472495c9b748093d01f8f097d56a
2016-09-09 19:59:09 +00:00
Stephane Bisson b3c07eedeb Remove etp_user
Target page entries used to exist for each user
that was notified for an event. They were
removed as the notifications were marked as read.

Now they remain so that the association between
pages and events can be used for moderation
regardless of the notifications read status.

This patch removes everything about
echo_target_page.etp_user from sql and php code.

Bug: T143959
Change-Id: Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a
2016-09-09 09:32:28 -04:00
Moriel Schottlender 59c0ad6c4d Make 'Edit threshhold' notif appear regardless of title existence
If a user recieves 'this is your X edit' they should get this notif
regardless of whether the edit they created was deleted. We should
make sure the title is there only for deciding whether or not to
create a link for it; otherwise, the notification will just appear
without a link to the revision.

Change-Id: I00ed4278bb4e15b1e9ddfa2c3af8fad0540fc5f8
2016-09-08 23:01:47 +00:00
Roan Kattouw 48ca4aeb5e ModerationController: Update count from master, not slave
At the time that resetNotificationCount() is called, we've only
just moderated something, so the slave won't have those changes yet,
and the computed notification count will be wrong.

Change-Id: Ia83f2b9cf7f4bbaee25e03f7bc8f73bcd4d345f9
2016-09-08 15:26:07 -07:00
Moriel Schottlender 00e0b9f45d Make seen/unseen badge more consistent across wikis
- Add a 'hasUnseen' data to the xwiki bundle so the badge can
  consider its value when changing its color even without the
  bundle being opened.
- Check and store seenTimes from all sources that the xwiki
  has in a new JS object that the SeenTimeModel can store

Bug: T134855
Change-Id: Ifdcee88b4378cdc7acb4ae5c0cbc60b76339757e
2016-09-08 12:40:15 -07:00
Chad Horohoe da4f8f5db9 Use static cache for times so it works across instances of SeenTime
Follows-up If6319a02. Making the cache static enables us to reuse
the in-process cache across multiple instances of the class.

Bug: T144534
Change-Id: I1a594830f13d56ab4e0e636a3cdb5e96379e990a
2016-09-08 12:24:46 -07:00
WMDE-Fisch 4ac1711be8 Send mentions when editing multiple sections in between sections.
This patch fixes mentions not being send when multiple sections were added
in between sections.

Since we only want to send mentions when userlinks and signature are present
in the same section a new method was added extracting sections and the related
content from an addition. The results are checked whether a section content
contains a signature and might be relevant for mentions.

Bug: T141863
Change-Id: I434c664552bbadbeef6e897e20703e813f5a4c52
2016-09-08 15:15:14 +02:00
Moriel Schottlender eb98b21dfe Add 'canRender' check to EchoMentionStatusPresentationModel
Change-Id: Ica338ff5810b62849d30e5b27709558f1b797c43
2016-09-06 14:44:51 -07:00
Kunal Mehta b3cdd56952 SeenTime: Wrap cache with CachedBagOStuff
That adds an in-process cache so we don't have duplicate key lookups on
every request.

Bug: T144534
Change-Id: If6319a026c457a32bfde0e212c6193aa728cb208
2016-09-06 13:06:26 -07:00
jenkins-bot cf7cf0dd66 Merge "Provide title when parsing wikitext" 2016-09-02 01:48:33 +00:00
Stephane Bisson c75d974004 Provide title when parsing wikitext
Bug: T141460
Change-Id: I802c9c4bf964a060e44f25a487b5aec6f7d8c6b6
2016-09-01 16:48:56 -04:00