Commit Graph

2224 Commits

Author SHA1 Message Date
Kane York 63b8b3c849
Revert "Reland "DEV: Add checks that assets do not modify cookies to smoke-test.js" (#9774)" (#9783)
This reverts commit 186c471c44.
2020-05-14 12:04:09 -07:00
Kane York 186c471c44
Reland "DEV: Add checks that assets do not modify cookies to smoke-test.js" (#9774)
* Revert "Revert "DEV: Add checks that assets do not modify cookies to smoke-test.js (#9504)" (#9773)"

This reverts commit 732776e2ce.

* FIX: Run cookie tests only after logging in
2020-05-14 11:35:16 -07:00
Robin Ward aa2d040526 DEV: Update ESLint to remove I18n global
Also fixes missed imports in core.
2020-05-14 10:18:12 -04:00
Joffrey JAFFEUX 42e5a5bb39
DEV: do not append/prepend if callback returns nothing (#9778) 2020-05-14 14:38:03 +02:00
Guo Xiang Tan d7e230c1b9
UX: Introduce composer-actions when editing a post. 2020-05-14 15:56:08 +08:00
Vinoth Kannan c014b93854
UX: don't disable "create account" button & display error message for required fields. (#9643) 2020-05-14 12:15:33 +05:30
Kane York 732776e2ce
Revert "DEV: Add checks that assets do not modify cookies to smoke-test.js (#9504)" (#9773)
This reverts commit 5cb806827a.
2020-05-13 16:41:18 -07:00
Kane York 5cb806827a
DEV: Add checks that assets do not modify cookies to smoke-test.js (#9504)
This adds three new checks to the smoke test: that assets and service-worker.js do not
clear invalid cookies, but normal application routes do.

This functions as a test that the nginx config correctly strips out Set-Cookie responses
from the service-worker.js file.
2020-05-13 16:29:18 -07:00
Robin Ward eab560fe2a
DEV: import I18n instead of global usage (#9768)
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
Co-authored-by: Robin Ward <robin.ward@gmail.com>

Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2020-05-13 16:23:41 -04:00
Martin Brennan 50e63f5202 Skip later today test again :'( 2020-05-13 16:58:26 +10:00
Martin Brennan 0e09c5837f DEV: Try once more to make acceptance test fake timers work
In my original PR (#9647) I attempted to solve the problem of
using fake timers in acceptance tests by using the new sinon
clock.tickAsync methods. This way of doing things seems to be flawed,
however, as we are getting random spec timeouts starting with the
bookmark acceptance test where this was introduced.

I think I was going about things the wrong way. This commit introduces
a new function with callback (acceptanceUseFakeClock) that sets up the
fake timers using sinon.useFakeTimers with the shouldAdvanceTime option
set to true. This advances time at a normal rate of 20ms per tick, which
means that we are not freezing any time and existing setTimeout funcs.
should proceed as normal. Along with this the callback passed will
run clock.reset() at the end to make sure all the timers are cleaned
up correctly.

There is an optional third parameter after the callback, which is the
timezone. If the user is logged in for the acceptance test then their
timezone is used, otherwise we default to America/Denver.

Usage is (inside an acceptance test):

```
test("Name of the test", async assert => {
  // first parameter is time to start fake clock at
  await acceptanceUseFakeClock("2020-05-04T13:00:00", async () => {
    // test code goes here e.g. await visit("/url");
  });
});
```
2020-05-13 15:16:07 +10:00
Martin Brennan a64cf265fd
FIX: Change /bookmarks URL back to topic list and add bookmark poster avatars (#9759)
* Changes the /bookmarks URL to show the original "topics filtered by bookmark" list instead of redirecting to user activity bookmarks (see https://meta.discourse.org/t/domain-com-bookmarks-is-showing-domain-com-u-user-activity-bookmarks-with-reminders/149252/12)
* Add the user avatar for the user who made the post that is bookmarked
2020-05-13 14:03:24 +10:00
Joffrey JAFFEUX e73e9aa7f2
DEV: skip failing test (#9755) 2020-05-12 18:32:12 +02:00
Joffrey JAFFEUX 286b4e535e
DEV: allows buttons to define aria-label (#9747) 2020-05-11 22:09:44 +02:00
jjaffeux 0deb05740f Revert "DEV: allows to define an ariaLabel on d-button (#9716)"
This reverts commit 7a95dd4841.
2020-05-11 19:19:13 +02:00
Joffrey JAFFEUX 7a95dd4841
DEV: allows to define an ariaLabel on d-button (#9716)
* DEV: allows to define an ariaLabel on d-button

This topic also adds this function to topic-footer-buttons, simplifies the whole logic of titile/label/arialabel in d-button and adds tests for these properties.

* typo
2020-05-11 18:42:51 +02:00
Jarek Radosz fe2d5da623 DEV: Remove obsolete commented out tests
Commented out in 2016 in ff74bd7e28
2020-05-11 18:19:21 +02:00
Jarek Radosz 7d3c4a5f13
FIX: Show category name in badge preview on edit (#9726) 2020-05-11 17:05:40 +02:00
Martin Brennan 12d4d51d81
FIX: CurrentUser now must be passed to resolveTimezone and user card local time issues (#9734)
* This is to prevent user's timezones being changed accidentally
e.g. by admin looking at a user
* This problem only occurred via the user card, however the user card
was still calling userTimezone even if the setting to display user
time in card was disabled
2020-05-11 11:01:47 +10:00
Jarek Radosz 8f5a651e51 DEV: No need for double `await` 2020-05-10 19:54:07 +02:00
Bianca Nenciu 8149bfbaf1
FEATURE: Filter settings by plugin (#9692) 2020-05-10 14:07:45 +03:00
Joffrey JAFFEUX 9bf11a8c68
DEV: allows select-kit to prevent autofocus of header after onChange (#9718) 2020-05-09 10:26:23 +02:00
Joffrey JAFFEUX a40649409e
DEV: calling preload-store is deprecated (#9703) 2020-05-08 17:04:28 +02:00
Robin Ward f9608c0af5 DEV: Remove INLINE_ONEBOX_* constants
There were two constants here, `INLINE_ONEBOX_LOADING_CSS_CLASS` and
`INLINE_ONEBOX_CSS_CLASS` that were both longer than the strings they
were DRYing up: `inline-onebox-loading` and `inline-onebox`

I normally appreciate constants, but in this case it meant that we had
a lot of JS imports resulting in many more lines of code (and CPU cycles
spent figuring them out.)

It also meant we had an `.erb` file and had to invoke Ruby to create the
JS file, which meant the app was harder to port to Ember CLI.

I removed the constants. It's less DRY but faster and simpler, and
arguably the loss of DRYness is not significant as you can still search
for the `inline-onebox-loading` and `inline-onebox` strings easily if
you are refactoring.
2020-05-07 16:14:38 -04:00
Martin Brennan 6fb0f36ce1
FEATURE: Optionally delete bookmark when reminder sent (#9637)
We now show an options gear icon next to the bookmark name.

When expanded we show the "delete bookmark when reminder sent" option. The value of this checkbox is saved in local storage for the user.

If this is ticked, when a reminder is sent for the bookmark the bookmark itself is deleted. This is so people can use the reminder functionality by itself.

Also remove the blue alert reminder section from the "Edit Bookmark" modal as it just added clutter, because the user can already see they had a reminder set:

Adds a default false boolean column `delete_when_reminder_sent` to bookmarks.
2020-05-07 13:37:39 +10:00
Martin Brennan 7e303f9320
DEV: Upgrade sinon and fix time based bookmark tests (#9647)
Update sinon.js to 9.0.2 to access async fake timers https://sinonjs.org/releases/v9.0.2/fake-timers/ which can then be used with acceptance tests (previously useFakeTimers didn't work with await, e.g. for visit).

Fix the bookmark acceptance test that was time based to use these new fake timers.

Add a fakeTime function that uses moment and the provided date string + timezone to freeze time using useFakeTimers and return a clock.

Add a timeStep function that accepts a clock from fakeTime and a function to run. Once the function is run we call clock.tickAsync(1000) to progress the fake clock forward 1s to progress promises/callbacks.
2020-05-07 09:10:32 +10:00
Robin Ward 7acb25db12 FIX: preload-store was moved 2020-05-06 15:55:52 -04:00
Robin Ward 01929e3505 DEV: Move `preload-store` to `discourse/lib/preload-store`
It's only used inside Discourse so it needn't be its own module
2020-05-06 15:28:06 -04:00
Joffrey JAFFEUX c99ecba68f
DEV: improves sk api (#9653)
- reduces the API to 3 actions for now: appendContent/prependContent/onChange
- well tested
- removes all previous APIS which were only half supported or too dangerous as they could collide with other plugins or core behaviors
- this plugins also puts every sk test helpers in one file
2020-05-06 17:16:20 +02:00
Robin Ward 2edee74718 FIX: Flaky tests. Due to CSS transitions opacity might not be 0 yet. 2020-05-05 13:45:14 -04:00
Robin Ward 612284cef3
DEV: Remove `Discourse.RAW_TEMPLATES` (#9630)
We were sharing `Discourse` both as an application object and a
namespace which complicated things for Ember CLI. This patch
moves raw templates into `__DISCOURSE_RAW_TEMPLATES` and adds
a couple helper methods to create/remove them.
2020-05-05 12:15:03 -04:00
Zdravko Curic 8010e1ab2e
DEV: Add remove button function to PluginAPI (#9627) 2020-05-05 09:18:02 -04:00
David Taylor 04e4932307
DEV: Skip time-dependent bookmark test 2020-05-05 09:50:50 +01:00
Martin Brennan 5cf6984a1a
FIX: Pre-select Later Today on bookmark edit if the time is the same (#9636)
If the user chooses "Later Today" as the reminder for a bookmark, then edits that bookmark, we should pre-select "Later Today" if that time has not changed (e.g. later is still 6pm). We do this to avoid confusion instead of opening the custom date + time section.
2020-05-05 16:28:31 +10:00
Martin Brennan 6aa9014509
UX: Bookmark removal tweaks (#9635)
* Do not show confirmation modal if deleting bookmark from list unless the bookmark has a reminder
* Remove the deleted bookmark from the in-memory array for the user list so a full reload of the list is not needed and scrolling is maintained
2020-05-05 14:56:04 +10:00
tshenry b8b1cbbfb9
UX: Improve second factor UI (#9526)
This will make a few minor improvements to the second factor user interface. Highlights include:

- Using the site's title to prefix the backup code filename. If non-ascii characters are detected, then prefix "discourse" instead.
- Add icons and change the text on some of the buttons for better clarity and consistency
- Add an education link to the security key modal
2020-05-05 11:05:25 +10:00
Joffrey JAFFEUX a2c85f0845
DEV: use the existing parsePostData function (#9629) 2020-05-04 18:35:04 +02:00
Joffrey JAFFEUX 0e4db91870
FIX: save bookmark reminder on tap unless custom (#9611) 2020-05-02 10:31:44 +02:00
Robin Ward f182e61def DEV: Remove global Handlebars 2020-05-01 14:12:09 -04:00
Jeff Wong 2cb9e85d14
FEATURE: add category banner for why a user cannot post (#9576)
* FEATURE: add category banner for why a user cannot post

Adds a category banner for why a user is unable to post in a category.

Also adds an extra alert for the user when a user is unable to create a topic in a
category and they still try and click on the disabled-looking new topic
button.
2020-04-30 10:39:11 -07:00
Joffrey JAFFEUX 1b2db44678
FEATURE: allows to limit visible reports and tabs in dashboard (#9598) 2020-04-30 17:31:04 +02:00
Martin Brennan 10f9f295dc
DEV: Add acceptance tests for bookmarks with reminders (#9592) 2020-04-30 14:58:26 +10:00
Sam Saffron d6df92b074
DEV: correct bad test
Test was unlisting a topic and then checking for the unlist info
in the whisper field
2020-04-30 14:27:24 +10:00
Martin Brennan ca539fdccf
FIX: Rename all instances of bookmarkWithReminder to just bookmark (#9579)
* Rename all instances of bookmarkWithReminder and bookmark_with_reminder to just bookmark
* Delete old bookmark code at the same time
* Add migration to remove the bookmarkWithReminder post menu item if people have it set in site settings
2020-04-30 10:09:22 +10:00
Joffrey JAFFEUX a1b9150512
DEV: adds a caret option to widget dropdown (#9588) 2020-04-29 19:37:21 +02:00
Martin Brennan 6cf31f16f7
FIX: Change bookmarks-with-reminders URL back to bookmarks for user activity (#9566)
* Bookmarks with reminders is a core feature now, no need to have a separate URL
* Keep around the old /u/:username/activity/bookmarks-with-reminders route for backwards compat in Ember but just redirect to user activity bookmarks.
2020-04-29 10:53:37 +10:00
Martin Brennan 17ca47af1a
FIX: Remove timezone in brackets from user card (#9567)
For clarity and to save space remove the timezone in brackets e.g. (EDT) from the user card. Also add a title to the user time span to say it is Local Time.
2020-04-29 08:45:38 +10:00
mentalstring 67f3fe14aa
FEATURE: support SSO website and location overrides
Add location and website + the ability to override using SSO using the `sso_overrides_location` and `sso_overrides_website` site settings.
2020-04-28 16:06:35 +10:00
Martin Brennan 66b5b8cf29
FIX: Local time not updating between user cards (#9564)
The local time was not updating between user cards because the computed property was not used correctly.

There's an old saying in Tennessee — I know it's in Texas, probably in Tennessee — that says, fool me once computed properties, shame on — shame on you. Fool me — you can't get fooled again.
2020-04-28 13:23:43 +10:00
Joffrey JAFFEUX ad978b93ab
FIX: Correctly shows no bookmark message (#9548) 2020-04-28 11:19:35 +10:00