Commit graph

86 commits

Author SHA1 Message Date
Ed Sanders 1d3be2c605 ESLint: Autofix no-var errors
Keep the rule and prefer-const disabled as they will
require manual fixing.

Change-Id: Idd31eb7d7a456b10c07b905b4b837dd4c890eb71
2024-06-03 13:22:48 +01:00
Ed Sanders 2cac61da34 Move var declarations inline
Change-Id: I8734c30880bcb416a4945f6653555dc1189e7733
2024-03-05 22:39:09 +00:00
jenkins-bot 22c08547a6 Merge "Add visible help link for Special:Notifications" 2019-04-09 15:32:14 +00:00
Shivanshbindal9 a09db3ea59 Add visible help link for Special:Notifications
Bug: T200184
Change-Id: Iaf321f88322e8a9686be62eb9b055c6544cf0ad6
2019-04-09 10:27:40 -04:00
James D. Forrester 38b41c0f98 build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I6747b5e36f64d681b6f83461f0ebb9c9f88bea86
2019-04-03 15:57:20 -07:00
Ed Sanders 7ed027ddcf build: Update eslint-config-wikimedia to 0.10.1
Change-Id: I776585adab962c2b1d353d18d3a02b6662941b13
2019-02-06 01:42:53 +00:00
Ed Sanders 17126b2ab1 Remove obsolete aliases from closures
Bug: T208951
Change-Id: If51fc6d50b9755c779fd0bf1be7bb0fe276539ea
2018-11-12 13:56:38 +00:00
Stephane Bisson c46d56b018 Special:Notifications show unread by default if there's unread notifications
Bug: T162927
Change-Id: Ibdfaca90803eb8b12b12eb1781b0692e7336b7d9
2017-04-19 15:20:12 -04:00
Fomafix a76bd5320f Replace $( document ).ready(...) by $(...)
In jQuery 3 $(document).ready(...) is deprecated.
https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function

Change-Id: Iff3d7fb07a739fc6ff9b62a2f586c54cd9c8f315
2017-01-06 14:06:39 +01:00
Ed Sanders c8d24ebd17 build: Replace jscs/jshint with eslint
Change-Id: Iee1d1b20ed31e636bfb8fc8cf9b18ff328bf608c
2016-11-23 15:25:59 -08:00
Ed Sanders 44140295ce Remove apparently unused PNG files
The repo is now PNG-free.

Change-Id: Ia76505473fc99365781735a19ece4d028eaec528
2016-09-02 12:28:28 -07:00
Stephane Bisson 3600a271c5 Enable local bundles on mobile
Have the 'bundle' param always
controlled by the controller
instead of configured in the
API.

Change-Id: I08fb7c515f1af28fc01073702b552624cc14f2f0
2016-08-04 10:42:11 -04:00
Moriel Schottlender 9e206ef8f5 Reduce number of prioritized actions in mobile
For mobile view, only display 1 prioritized action in the items,
and for general desktop view, stick to the default 2.

Bug: T141788
Change-Id: Ibf386ee598553ecfb717f07f02688034bbc338c8
2016-08-01 16:31:18 -07:00
Moriel Schottlender 1dd3af10bb Adjust mobile view for the new settings cog menu
Now that we have the cog menu, it should be placed correctly in
mobile and the "preferences" link should be hidden.

Since MobileFrontend doesn't have the personal toolbar, and we
can't cheat by using jQuery and grabbing the url of preferences,
we have to get SpecialNotifications.php to output the urls
to a wg variable and reading it from there.

Bug: T115528
Change-Id: I6a69823d6f75c376c04e9a21d79916321e417178
2016-07-25 19:30:44 +00:00
Moriel Schottlender 545d4e67ae Add a mark-all-read button and a settings menu to Special:Notifications
Add a global-wiki 'mark all as read' to the Special:Notifications page.
The 'mark all as read' will makr all notifications in the given
wiki. The context of the wiki changes when filters are chosen,
and so the message of the button changes as well.

Bug: T115528
Change-Id: Ibd9dcdf7072d6cbc1a268c18e558e6d0df28f929
2016-07-20 17:25:38 -07:00
Moriel Schottlender 5aaf6d26d8 Relate read-state filter and mark read/unread action
When we are viewing a certain read state filter ('read' or 'unread')
the visibility of items should correspond to that state even when
the user marks a specific item as read/unread. That means that the
system should remove these items from view when the action is taken.

In this commit:
* The controller makes the judgment of whether to remove items when
  read/unread action is taken, based on whether a filter is set.
* We clean up the terminology of discard - no more 'remove' - to
  make sure we have consistency in the code.
* Related: The 'discard' event is now scoped within the hierarchy;
  meaning, lists emit 'discard' when an item is removed, grouplist
  emits 'discard' when a group is removed, and the manager emits
  'discard' when an entire notification model is removed. This
  means we can actually have proper hierarchy and organization with
  a single event, and not worry about clashing between the intentional
  'discard' action and the event 'remove' that is also used while
  resorting happens.
* The model manager emits a discard event when a model is removed
  so that the general list can listen to the manager and remove an
  entire batch of items if needed.
* The pagination model now updates the count for the current page
  rather than some vague notion of the last page. This is also
  updated when the controller removes items, so we can get an
  accurate count in the page for the number of notifications that
  are displayed.

Bug: T136891
Change-Id: I247c618042ef256fadf09922f7b83bd1ad361f64
2016-07-18 13:23:57 -07:00
Stephane Bisson f8a8d392d6 Expandable bundle
Support bundles being expandable
to show their sub-notifications.

Bug: T114356
Change-Id: I1507cae360f45cc87f2d60e966b4d047abfa202d
2016-06-28 15:37:54 -04:00
Stephane Bisson 1bef12c3e7 Stop outputting $nextContinue in Special:Notifications
Bug: T129176
Change-Id: If0d05cb1df0b2e0f93c7367c0848fbcbb04fea8d
2016-05-27 16:46:20 -07:00
jenkins-bot 95bea57983 Merge "Initial version of Special:Notifications Javascript page" 2016-05-27 21:34:44 +00:00
Moriel Schottlender 9262614ded Initial version of Special:Notifications Javascript page
Bug: T129176
Change-Id: I2f55358c16f78e234ec19154b944a4edebfbe639
2016-05-27 13:42:25 -07:00
matejsuchanek 38adb78619 Use native MediaWiki linking to help pages
There was quite a small link under the main title in Special:Notifications
which pointed to a related help page. Now the OutputPage::addHelpLink()
method is used which moves this link to the upper right corner and allows
configuring this on-wiki (instead of LocalSettings.php or so).

Bug: T101057
Change-Id: Ib4aecee8006b8d71bb3cd86f1d4ebdfee9080870
2016-05-27 20:40:41 +02:00
Moriel Schottlender 8e76bc4126 Refactoring Echo's front end for MVC
Changing the way Echo's front-end architecture works to work with
model-view-controller methodology.

Change-Id: I97862402c41bc04dd41cd08d79f19ff677340249
2016-05-18 12:28:45 -07:00
Moriel Schottlender 2d184c087c Add JSDuck support and fix errors
Change-Id: I7816110862d9ca1b16e2ec9ce842d240bee6b46b
2016-05-11 14:07:12 -07:00
Matthias Mullie e8d1f6a888 Remove param index
It's (mostly) unused, and it would become problematic once we have
notifications from multiple places (where those ids could conflict)

Change-Id: Ib3bb5ae1e5689037b38290c9ce3d8691f52582b0
2016-04-21 13:33:15 +02:00
Catrope f808909c67 Revert "Compress PNGs with zopflipng"
Changed icons to different ones: Generic.png became a heart.

This reverts commit 3f36dfab56.

Change-Id: I5aa4711e254590ba824c86867f705b950a48e2de
2016-03-03 19:57:02 +00:00
Ricordisamoa be0dff6a89 build: Enable jscs rule 'requireSpacesInsideBrackets' and make pass
Change-Id: I62bd55936f8416caa2e1b917752d91355f7d9e7d
2016-02-29 18:03:29 +01:00
Ori Livneh 3f36dfab56 Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Bug: T127608
Change-Id: I1f01ac23c10d57edb8471f43ba01bf3cc8de5969
2016-02-21 00:12:15 +00: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
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 35c4a37918 Use db-replicated objectcache for storing last seen time
So we're not abusing user preferences for the last seen time.
EchoSeenTime is a small wrapper around ObjectCache that handles the
fallback to user preferences during the transition.

All JavaScript code now needs to use mw.config.get('wgEchoSeenTime').

Bug: T95839
Change-Id: Ia45ba5e30eb4564250539d04d5886d2598ebd49a
2015-09-02 22:42:35 +00:00
Moriel Schottlender 1ac72cc01a Split alerts and messages in Echo
Split the notifications into 'alert' and 'message' badget with two
different flyouts. Also clean up styling and module behavior.

** Depends on ooui change Id4bbe14ba0bf6c for footers in popups.
** Depends on ooui change Ie93e4d6ed5637c for fixing a bug in
   inverted icons.

** MobileFrontend must also be updated to support the new modules
   in this patch  I168f485d6e54cb4067

In this change:
* Split notifcations into alert and messages and display those in
  two different badges.
* Create two separate flyout/popups for each category with their
  notifications.
* Create a view-model to control notification state and emit events
  for both the popup and the badge to intercept and react to.
* Clean up module load and distribution:
  * Create an ext.echo.ui module for javascript-ui support and ooui
    widgets.
  * Create an ext.echo.nojs module that unifies all base classes that
    are needed for both nojs and js support, that the js version
    builds upon.
  * Create a separate ext.echo.logger module as a singleton that can
    be called to perform all logging.
* Clean up style uses
  * Move the special page LESS file into nojs module so all styles
    load properly even in nojs mode.
  * Transfer some of the styling from JS to LESS for consistency.
  * Make the 'read more' button load already with the styles it
    needs to look like a button, since its behavior is similar in
    nojs and js vesions, but before its classes were applied only
    by the js, making it inconsistent and also making its appearance
    'jump' from a link to a button.
* Delete and clean up all old and unused files.
* Moved 'Help.png' icon from modules/overlay to modules/icons for
  later use.

Bug: T108190
Change-Id: I55f440ed9f64c46817f620328a6bb522d44c9ca9
2015-09-02 15:36:37 -07:00
Legoktm 2257dd2a56 Revert "Pass uselang=user to the API instead of figuring it out client side"
This breaks pages using ?uselang=xx where "xx" is not
the user's language.

This reverts commit 0919b01e75.

Bug: T103935
Change-Id: I219810451b991cef88bac62cf880bfda6f98e930
2015-06-25 17:16:13 -07:00
Kunal Mehta 78dc653c80 Remove dead dismiss code
mw.echo.setUpDismissability was removed in 08fc83b6de, and will
never be called since the class is never set.

Change-Id: I1e13bbabaeb7df21c161d4cf4205a1564e1d81d9
2015-06-07 18:30:49 -07:00
Kunal Mehta 70d95fbad0 Use mw.Api.postWithToken to automatically re-try badtoken errors
Bug: T101664
Change-Id: I93188099e24102b47384c08113e8dbd26dac8df1
2015-06-07 18:11:48 -07:00
Kunal Mehta 0919b01e75 Pass uselang=user to the API instead of figuring it out client side
Change-Id: I09add693567af577c14c646d2b6b943716e0522e
2015-06-07 17:30:00 -07:00
Roan Kattouw 518101e495 Actually pass jscs
Removed exemptions from .jscsrc and fixed the code to make jscs still
pass.

Kept the dangling underscores exemption because leading underscores
are (for now) used as a naming convention for private functions in
this repo.

Change-Id: I18964f8469f52c294276527d92cb6bf9f48c2576
2015-05-04 19:28:01 +00:00
Matthias Mullie da07893647 Display red badge based on time of notifications vs last time panel was opened
I tried to stick as close to the existing code as possible.

Special:Notifications is slightly different from the overlay,
however. I made it add .mw-echo-unread class for consistency,
but that JS doesn't record seen time (it only loads older
entries), not does the CSS fadeout apply there (it marks
everything as read as soon as it's displayed, so different
behavior from overlay)

PS: I'm not sure about browser compat for the fadeout. But
even if some obscure browsers don't support this, meh. It's
not an "important" feature that can't be missed.

Bug: T94634
Change-Id: Ibb201823fb52ef8a3d5eaa39b0b724ede8d271d1
2015-05-01 11:39:45 -07:00
Erik Bernhardson 8ee843fab5 Hygiene: Dont quote object property keys
Change-Id: I93d669a26f85b4eb5c5e0e06e314b89894f12385
2014-09-12 16:00:07 -07:00
jdlrobson 4ff74ddd50 Hygiene: Alter how initialisation of the overlay works
Restructure code so MobileFrontend can make use of it
Kill ext.echo.desktop

Change-Id: I984373ba54206d447c54a435dbf60e8f6e814be1
2014-09-12 22:49:51 +00:00
bsitu d9f697414f mw.echo.overlay.updateCount() no longer exists
If you have an unread notifications not in the initial
load of special page, clicking load more would throw
an error

Bug: 69714
Change-Id: I9af588780b2ab8481ba252ddc21bad0601de7a0b
2014-09-05 21:37:12 +00:00
Erik Bernhardson f5985169cc Allow .mw-echo-title-heading outside special page
This class was only being applied to notification output
on special pages and not in the overlay, move it so it can.

Additionally:
* bolds .mw-echo-title-heading same as the anchors it works with
* clean up a repeated rule against `.mw-echo-title a`

Change-Id: I579252399b39746f5aa2cfc51b5cd3b9b8b2cdb0
2014-09-04 18:59:30 -07:00
jdlrobson 5ff3189146 Prevent horizontal scroll bars in Firefox
Use inline block and width to force truncation of the flow topics

Bug: 69563
Change-Id: I62fc95a58dbdf0f21e36e67e1941e4e35585e2d2
2014-08-14 13:21:49 -07:00
bsitu 7f4f6c5228 Truncate text in Echo notifications
Automatically truncate text with ellipsis on single lines of title

Change-Id: I0ef9eeb9f9d3403f79ee9960b075fb7062150a1d
2014-08-12 23:53:52 +00:00
jdlrobson 430628ccc1 Hygiene: Port all Echo css to less.
No changes.
Makes styling code more readable.

Change-Id: Ie45f2cd3671bee5b88ba92ca2946d6e77cd59508
2014-08-04 11:43:27 -07:00
Legoktm a09d4cbaf5 Revert "New hooks for external integration to notification intiialization"
No usecase has been provided, and additionally the hooks
are not documented. Bartosz also points out that
mw.hook calls are asynchronous and memorized.

This reverts commit 9d3561afaf.

Change-Id: If735b46996fab3def835a54223412ef6d3105395
2014-07-26 01:05:35 +00:00
Erik Bernhardson 9d3561afaf New hooks for external integration to notification intiialization
Adds two new hooks to allow extensions to tie into the notification
loading process.  Between these two hooks and the new isInitialized()
method any extension can run code whenever a notification is displayed.

Change-Id: If351835be5f65ca098e2d235ea8c8e4dc40ae2b4
2014-07-21 16:08:56 -07:00
Thiemo Mättig e205992d0b Remove unused code and fix missing/broken documentation
General code cleanup as reported by the PHPStorm static code
analysis. I hope it's not a problem that I made a lot of very
different (but all very tiny) changes in a single patch. If you
want to merge this but you think it's better to split it into
several patches first, please tell me.

Change-Id: I2e2c4bb47f8d20e038d28e236e2ff813b30504af
2014-06-04 04:54:00 +00:00
bsitu 3b3ed1e3bc Fix some notification badge related issue
* In some languages like persian, the number 0 is represented as '.', we can't compare
  '.' with either 0 or '0' to detect the no-notification status of the badge

* The markread API doesn't respect uselang param, it would return 0 instead of . in a url with uselang=fa

Note: we need to provide raw and formatted count in the API since client side javascript
      doesn't provide fancy function like $wgLang->formatNum()

bug: 54575

Change-Id: I0a49828253ec346ed27c5b9a976f8bdff4e1fa90
2013-10-02 11:25:05 -07:00
kaldari 08fc83b6de Cleaning up Echo 'base' module.
Removing unused functions and declaring correct dependencies.

Targetting to desktop and mobile so it can be used by both.

Also removing dismiss-related code from the formatter.

Change-Id: Icccce64cfb3c564ab468a93ccdba9c5a61687fd5
2013-09-23 11:29:49 -07:00
bsitu 2b57fbd3c2 Split the Echo API into their own write/read APIs
Change-Id: I0ab85c91c6fbe17e9a1c7dc9e504980f629a5065
2013-09-18 14:28:41 -07:00