Commit Graph

17049 Commits

Author SHA1 Message Date
Jarek Radosz 6afba42985
UX: Tweak spacing in the admin dashboard (#13557)
Even margins, indented `li > ul`, no extra space inside parens `( sha )`.
2021-06-28 23:35:31 +02:00
Rafael dos Santos Silva d860e2717b
UX: Adds 'Processing Upload' to the composer status area during upload optimization (#13556) 2021-06-28 18:22:22 -03:00
Rafael dos Santos Silva 99da221034
FIX: Handle image decoding failure in composer image optimization (#13555)
There are some hard limits in browser Canvas implementations, that will
throw a runtime exception when crossed. Since those limits are platform
dependent, the best we can do is catch it and back off from trying to
optimize a problematic file.

For example, a 60MB PNG can be processed fine by Chrome but Firefox will
fail trying to extract the ImageData from the CanvasRenderingContext2D
with NS_ERROR_FAILURE.

Also cleans up the media-optimization-utils and add post-resize size logs
2021-06-28 18:21:39 -03:00
Mark VanLandingham d03aee4642
UX: Horizontal scroll bar on top of user directory (when needed) (#13553) 2021-06-28 15:10:38 -05:00
Jarek Radosz 04baca593b
UX: Tweak the timestamp line in Twitter onebox (#13551)
Fixed alignment and made the color less intrusive to make the actual content pop out more.
2021-06-28 15:04:33 +02:00
Dan Ungureanu d015907668
FIX: Remove extra margin from share topic modal (#13549)
The styling between the "Create Invite" and "Share Topic" modals is
shared. The margin that was used to organize inputs in a list is not
needed for the "Share Topic" modal.
2021-06-28 15:52:44 +03:00
Arpit Jalan 3dda926cb2
FIX: only delete the word/phrase when the 'x' icon is clicked (#13547) 2021-06-28 15:14:18 +05:30
Andrei Prigorshnev 6be4699954
FIX: topic level bookmark button (#13530)
We changed (https://github.com/discourse/discourse/pull/13407) behaviour of the topic level bookmark button recently. That PR made the button be opening the edit bookmark modal when there is only one bookmark on the topic instead of just removing that bookmark as it was before.

This PR fixes the next problems that weren't taken into account in the previous PR:

1. Everything should work fine even on very big topics when a bookmarked post is unloaded from the post stream. I've added code that loads the post we need and makes everything work as expected
2. When at least one bookmark on the topic has a reminder, we should always be showing the icon with a clock on the topic level bookmark button
3. We should show correct tooltips for the topic level bookmark button
2021-06-28 12:24:23 +04:00
Martin Brennan a6b9289477
DEV: Remove old group form code (#13542)
We don't use this group form anymore
since
964da21817
when we revamped the UI
2021-06-28 14:57:51 +10:00
Alan Guo Xiang Tan fd8016d678 DEV: Remove unused attributes from topic-tracking-state. 2021-06-28 11:02:49 +08:00
Roman Rizzi fa4e5e8dad
FEATURE: Render emojis on GitHub labels when oneboxing an issue. (#13531) 2021-06-25 14:48:36 -03:00
Bianca Nenciu 8ab6fd88ef
UX: Add notice when watched words are regexes (#13493)
There is a big difference between regular watched words and regular
expressions and this has been confusing in the past. This notice adds
an explanation.

This commit also reorganizes the code of the test modal.
2021-06-25 12:08:52 +03:00
awesomerobot 895df9c239 UX: margin improvement for mobile alerts 2021-06-25 09:18:06 +08:00
Penar Musaraj cb9e004121
UX: Make bulk select checkbox easier to target (#13517)
Adds a label element around the checkbox, so that user can more easily
hit the element. Quite useful when checking many items in topic list.
2021-06-24 11:46:26 -04:00
Mark VanLandingham 180c0c4dc3
FIX: Translation of plugin directory column on mobile (#13516) 2021-06-24 10:11:24 -05:00
Robin Ward a2b744ae25 DEV: Allow plugin tests to run in Ember CLI qunit 2021-06-24 10:13:35 -04:00
Andrei Prigorshnev cf1e8b2764
FEATURE: Accept the flag modal on CTRL + ENTER and CMD + ENTER (#13497)
We want to submit the flag modal on pressing CTRL + ENTER and CMD + ENTER.

Here's how our modals work:

Every modal can be dismissed by pressing ESC. This behaviour can be disabled for a specific modal if we need to.
Every modal can be submitted by pressing ENTER if the cursor wasn't on a text area or a form at the moment of pressing.
Now, the flag modal is actually a one big form and pressing ENTER doesn't submit it. I've added submitting by CTRL+ENTER but at first it was interfering with the basic modal submitting by ENTER. It's a pretty tricky thing to fix because we use the keyup event for submitting by ENTER and we need to use the keydown event for submitting with modifiers (because submitting by CMD+ENTER on Macs doesn't work with keyup).

Eventually, I fixed the problem just by adding a possibility to disable default submitting on ENTER (in the same way as we already have the possibility of disabling dismissing on ESC). Then I disabled default submitting for the flag form and implemented submitting by CTRL+ENTER and CMD+ENTER. This way everything is simple and robust. I did it only for the flag modal but it'll be easy and safe to add the same behaviour to another modal.
2021-06-24 14:13:38 +04:00
Kris 1702922a7c
UX: Fix mobile alert spacing (#13506) 2021-06-23 15:21:17 -04:00
Kris 958340b632
UX: Make it easier to hide the emoji on signup (#13509) 2021-06-23 15:20:54 -04:00
Mark VanLandingham 7c94efd6c9
FIX: Table header translations on admin users list (#13505) 2021-06-23 13:19:30 -05:00
Jordan Vidrine 385535f421
UX: Hide email columns when `Hide Emails` is selected (#13502)
* UX: Scroll user list container when emails are present
2021-06-23 12:42:16 -05:00
Joe 7e5ad9aaaa
UX: improve lightbox gallery zoom/navigation (#13500)
This PR improves navigation within lightboxes that contain multiple images for both touch and non-touch devices.

Currently, if a gallery contains multiple large images, and you click on the one currently displayed, two things happen. 

1. we zoom in
2. we navigate to the next image

a0bbc346cb/app/assets/javascripts/discourse/app/lib/lightbox.js (L43-L49)

So, you get taken to the next image, and it shows zoomed in, even when the intention was to zoom in on the previous image.

Magnific popup has an option to disable image-click navigation in galleries. This PR toggles that on for non-touch devices.

The result is that if you click on an image in a gallery on a non-touch device, we zoom in on that image instead of navigating to the next one.

This has no impact on arrow/keyboard navigation.

Magnific popup also has an API when images change; we reset the zoom class when that happens. So, when you navigate to the next image, it won't be zoomed in.

For touch devices, clicking on the image will navigate to the next one without zooming in. Users can pinch-zoom if they want to see more details on touch devices.

I used jQuery for this because both Magnific popup and our implementation for this are based on jQuery. No point making a few lines use vanilla for this when the rest doesn't.
2021-06-24 00:32:17 +08:00
Rafael dos Santos Silva fa4a462517
FEATURE: Optimize images before upload (#13432)
Integrates [mozJPEG](https://github.com/mozilla/mozjpeg) and [Resize](https://github.com/PistonDevelopers/resize) using WebAssembly to optimize user uploads in the composer on the client-side.

NPM libraries are sourced from our [Squoosh fork](https://github.com/discourse/squoosh/tree/discourse), which was needed because we have an older asset pipeline.
2021-06-23 12:31:12 -03:00
Penar Musaraj cfc60f41f0
DEV: Rename emoji icon (#13499) 2021-06-23 11:12:48 -04:00
Dan Ungureanu 2c2e81486c
FEATURE: Split Add Members into Add Users & Invite (#13482)
Add Members could also invite new users via emails, but that was a less
known fact. Splitting the previous modal into two more accessible
modals should make this feature more discoverable.
2021-06-23 17:31:25 +03:00
Martin Brennan 30c7a9b06d
DEV: Fix failing directory-columns ember CLI tests (#13490)
Since #13488 the ember cli CI tests are failing.
2021-06-23 13:26:37 +10:00
Mark VanLandingham 75afd50cea
FIX: Absolute path for directory-columns.json (#13488) 2021-06-22 19:28:58 -05:00
Mark VanLandingham 7fc3d7bdde
DEV: Plugin API to add directory columns (#13440) 2021-06-22 13:00:04 -05:00
Jarek Radosz fe5923da06
DEV: Do not re-throw in popupAjaxError (#13462)
Effectively reverts 3ddc33b07c

Makes the failure states testable; see the uncommented test.

I don't think we're re-catching these errors anyway?

_update:_
We did in a single instance in discourse-code-review but it wasn't really intentional and I fixed it in https://github.com/discourse/discourse-code-review/pull/73
2021-06-22 19:29:20 +02:00
Bianca Nenciu ee87d8c93b
FEATURE: Make max number of favorite configurable (#13480)
It used to be hardcoded to 2 and now it uses max_favorite_badges site
setting. When zero, it disables favorite badges.
2021-06-22 18:58:03 +03:00
Penar Musaraj 4a4cceca4d
DEV: Remove leftover reference to intersection-observer (#13478)
Followup to f343cfd, should fix the build.
2021-06-22 10:04:33 -04:00
Penar Musaraj f343cfd92e
DEV: Remove IntersectionObserver polyfill (#13445) 2021-06-22 09:30:44 -04:00
Joffrey JAFFEUX 1a6759a5d9
FIX: ensures average is applied on last incomplete segment (#13472) 2021-06-22 12:26:52 +02:00
Gerhard Schlager fa470cf6fe
Fix i18n issues reported on Crowdin (#13191)
* Pluralize `js.topics.bulk.dismiss_new_with_selected`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-fr#57320

* Pluralize `js.topics.bulk.dismiss_read_with_selected`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-fr#57316

* Pluralize `js.topics.bulk.dismiss_button_with_selected`

* Replaces concatenated string used by `js.topic.suggest_create_topic`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-fr#41834

* Less confusing `admin_js.admin.watched_words.test.modal_title`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-sv#44992

* Delete unused `backup.location.*` keys
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-fr#46330

* Replace "reviewable" with "reviewable items"
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-fr#56952

* Remove "ago" from `emails.incoming.missing_attachment`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-sv#46038

* Remove "/Posts" from `js.keyboard_shortcuts_help.application.dismiss_new_posts`
  Because the shortcut doesn't do anything to posts anymore.
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-de#43180

* Pluralize `user.cannot_delete_has_posts`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-he#57490
2021-06-22 11:29:35 +02:00
Jarek Radosz b78ab82284 DEV: Fix a flaky/leaky test
* pretender wasn't catching the request because it ran after this test finished
* restore wasn't needed, we do `sinon.restore()` after each test

The error was:
```
↪ Unit | Model | user::resolvedTimezone [✔]
↪ Unit | Utility | url::routeTo with prefixUnhandled request in test environment: /forum/u/chuck.json (PUT)
Error: Unhandled request in test environment: /forum/u/chuck.json (PUT)
    at Pretender.server.unhandledRequest (discourse/tests/setup-tests:173:15)
    at Pretender.handleRequest (pretender:400:14)
    at FakeRequest.send (pretender:169:21)
    at Object.send (jquery:10100:10)
    at Function.ajax (jquery:9683:15)
    at performAjax (discourse/app/lib/ajax:174:19)
    at eval (discourse/app/lib/ajax:183:11)
    at invokeCallback (ember:63104:17)
    at publish (ember:63087:9)
    at eval (ember:57463:16)
 [✘]
```

A minimal reproduction:
`http://localhost:3001/qunit?seed=3&testId=da76996b&testId=e52a53e7`
2021-06-22 09:49:09 +08:00
Martin Brennan f9a1d2bb81
DEV: Try fix flaky dismiss keyboard specs (#13452)
Also add extra logging for test failures
2021-06-22 09:21:50 +10:00
Jarek Radosz c3e4389b81
DEV: Add missing import, de-jQuerify (#13461) 2021-06-22 08:09:49 +10:00
Kane York c72bf1d732 FEATURE: Improvement to history stack handling on server errors
The exception page is shown before Ember can actually figure out what the final destination URL we're going to is.
This means that the new page is not present in the history stack, so if we attempt to use the history stack to go back, we will actually navigate back by two steps.
By instead forcing a navigation to the current URL, we achieve the goal of going "back" with no history mucking.

Unfortunately, the actual URL that was attempted is not available. Additionally, this only works for the on-screen back button and not the browser back.

Additionally, several modernizations of the exception page code were made.
2021-06-21 11:09:23 -07:00
Kane York f25c55b5be FIX: Render detailed_404 page from 403 responses
This was previously broken by 59ef48c0b9 (#11425, #11424).

Centralize the logic into the exception controller, which avoids the problematic bug and makes it easy to add additional detailed 404 pages in the future.
2021-06-21 11:09:23 -07:00
Bianca Nenciu 15aa213a61
FIX: Show link count only once for oneboxes (#13444)
Sometimes oneboxes contain the same link multiple times and the link
count was shown for each of them. This commit adds link count only to
the most important link, that being either a heading or the header of
the onebox.
2021-06-21 19:14:57 +03:00
Joffrey JAFFEUX 8c213fa98b
FIX: correctly implements average for reports (#13447)
- Also now marks time_to_first_response as an averaged chart
- Averaged charts will now be marked as such in the UI
2021-06-21 10:35:11 +02:00
Alan Guo Xiang Tan 44aa46ca05 Code review comments. 2021-06-21 11:06:58 +08:00
Penar Musaraj 497aae062a
UX: Fix jump-to-post layout on mobile (#13443) 2021-06-18 16:37:17 -04:00
Penar Musaraj fcc02412c0
UX: Fix mobile progress bar button alignment (#13442) 2021-06-18 15:23:57 -04:00
Joffrey JAFFEUX 6b3adeed0f
UX: daily automatic grouping for less than 34 days instead of 30 (#13437) 2021-06-18 19:54:16 +02:00
Bianca Nenciu 1e992d9193
FIX: Do not check for duplicate links in Onebox (#13345)
If a user posted a URL that appeared inside a Onebox, then the user
got a duplicate link notice. This was fixed by skipping those links in
Ruby.

If a user posted a URL that was Oneboxes and contained other links that
appeared in previous posts, then the user got a duplicate link notice.
This was fixed by skipping those links in JavaScript.
2021-06-18 18:55:24 +03:00
Bianca Nenciu 74f7295631
FIX: Add word boundaries to replace and tag watched words (#13405)
The generated regular expressions did not contain \b which matched
every text that contained the word, even if it was only a substring of
a word.

For example, if "art" was a watched word a post containing word
"artist" matched.
2021-06-18 18:54:06 +03:00
Penar Musaraj 5b17902263
UX: Use button instead of anchor in filtered replies bar (#13439) 2021-06-18 10:40:56 -04:00
Penar Musaraj e305365168
FEATURE: Use responsive image sizes in post stream (#13343) 2021-06-18 09:15:03 -04:00
Penar Musaraj e9e2827636
FIX: Mobile layout for watched words admin UI (#13427) 2021-06-18 08:57:13 -04:00
Joffrey JAFFEUX c9bd4b4c64
FIX: ensures validValues is an array (#13435)
Before this fix the setting object would have exceptions on 3 fields: computedNameProperty, computedValueProperty and validValues

```
TypeError: Cannot read property 'forEach' of undefined
    at Class.validValues (http://localhost:4200/assets/admin.js:10468:19)
    at Class.<anonymous> (http://localhost:4200/assets/vendor.js:82492:19)
    at http://localhost:4200/assets/vendor.js:28633:34
    at untrack (http://localhost:4200/assets/vendor.js:26641:7)
    at ComputedProperty.get (http://localhost:4200/assets/vendor.js:28632:13)
    at Class.CPGETTER_FUNCTION [as validValues] (http://localhost:4200/assets/vendor.js:26259:25)
    at Class.r (<anonymous>:1:83)
```
2021-06-18 14:02:21 +02:00
Joffrey JAFFEUX d88f792eb1
DEV: removes maximum limit on tag list site setting (#13436) 2021-06-18 12:53:30 +02:00
Joffrey JAFFEUX cbd01a0cca
REFACTOR: removes unused code (#13412)
This has been fully useless since this fix https://github.com/discourse/discourse/pull/12865

The removed test is not actually real life behavior, category should be on a topic type not a fruit.
2021-06-18 11:55:49 +02:00
Martin Brennan 7f916ad06d
FIX: Dismiss new keyboard shortcut not working (#13430)
The dismiss new keyboard shortcut (x,r) has been broken since
7a79bd7da3. A fix was done and JS
tests were added in 006d52f32b
and b01e4738ab but the test was not
quite correct and so the bottom dismiss new button was not clicked.

This also fixes an issue with our keyboard shortcut click handling.
If multiple elements matched the selector they were all clicked. Now
we just click the first match.
2021-06-18 13:56:23 +10:00
Kane York faca5c09fd
FIX: Use correct property for jump-up embedded post link (#13425)
Fixup for 77d33ebe21 #13320 which added the customShare property but did not update all uses
2021-06-17 13:17:56 -07:00
Penar Musaraj 36162cf396
FIX: Adding multiple auto tags in watched words admin UI (#13421) 2021-06-17 13:42:16 -04:00
Mark VanLandingham 95b51669ad
DEV: Revert 3 commits for plugin API to add directory columns (#13423) 2021-06-17 12:37:37 -05:00
Mark VanLandingham 854d965679
FIX: translations of table headers in group members directory 2021-06-17 11:08:18 -05:00
Andrei Prigorshnev 3b87271647
FEATURE: Open the edit bookmark modal when clicking on the topic level bookmark button (#13407)
If you click on a bookmark in the post stream you get an Edit Bookmark modal. This does not happen if you click the topic bookmark button.

We want to open the Edit modal too if there is only one bookmark on a topic (it doesn't matter on the first post or not). The other behaviour if there are > 1 bookmarks in the topic is to prompt the user to confirm delete of all the bookmarks in the topic. This behaviour will stay as-is.

I have done some refactoring in this PR, and still, there is a place for improvement. For example, we don't call post.deleteBookmark() method when deleting several bookmarks. I just don't want to refactor too much in one PR.
2021-06-17 19:24:06 +04:00
Mark VanLandingham 0c42a29dc4
DEV: Plugin API to allow creation of directory columns with item query (#13402)
The first thing we needed here was an enum rather than a boolean to determine how a directory_column was created. Now we have `automatic`, `user_field` and `plugin` directory columns.

This plugin API is assuming that the plugin has added a migration to a column to the `directory_items` table.

This was created to be initially used by discourse-solved. PR with API usage - https://github.com/discourse/discourse-solved/pull/137/
2021-06-17 09:06:18 -05:00
Bianca Nenciu ea2833d0d8
FIX: Update post's raw from server response (#13414)
The client used to update the raw, but sometimes the server changed the
raw text, which resulted in false edit conflicts.
2021-06-17 11:53:29 +03:00
Joffrey JAFFEUX 90bd88627a
FIX: prevents mode to be forced to unexisting mode (#13413) 2021-06-17 10:07:51 +02:00
Joffrey JAFFEUX 4c3d2267b4
FIX: ensure we dont collapse data multiple times (#13399)
Note that this commit will also disable daily grouping for datasets with more than 30 data points. This will also smartly do the grouping by month when grouping a full year.
2021-06-17 09:15:20 +02:00
Martin Brennan a2d69ff479
FIX: Move allow_unknown_sender_topic_replies outside SMTP/IMAP box (#13410)
This setting applies to both SMTP and IMAP for the group inbox,
so it should be outside those boxes in a standalone setting.
2021-06-17 11:40:01 +10:00
Martin Brennan 6bf97a47a7
FEATURE: Add last updated details to SMTP/IMAP group settings UI (#13396)
Adds the last updated at and by SMTP/IMAP fields to the UI, we were already storing them in the DB. Also makes sure that `imap_mailbox_name` being changed makes the last_updated_at/by field update for IMAP.
2021-06-17 08:21:06 +10:00
Robin Ward 651b8a23b8
FIX: Ember CLI was losing some preloaded data (#13406)
The `bootstrap.json` contains most preloaded information but some routes
provide extra information, such as invites.

This fixes the issue by having the preload request pass on the preloaded
data from the source page, which is then merged with the bootstrap's
preloaded data for the final HTML payload.
2021-06-16 13:45:02 -04:00
Andrei Prigorshnev 82ebc706aa
FIX: The topic level bookmark button stops working if choose ‘No’ on the clearing all bookmarks confirmation modal (#13374)
Steps to reproduce the bug:
- Create bookmarks for several posts on a topic
- Click the topic level bookmark button, it’ll open the modal that asks to confirm clearing all bookmarks from the topic
- Choose No
- Try to push the topic level bookmark button again - it won’t work

And it's fixed with this commit
2021-06-16 18:42:21 +04:00
David Taylor 0f9d31a85e
FIX: Make avatar-flair component fail gracefully group info missing (#13398)
This can happen when an avatar-flair component is rendered to an anonymous user on a login_required site (e.g. when they are redeeming an invite). The lack of group information was causing an error to be raised. With this commit, it now simple skips rendering the flair.
2021-06-16 11:22:11 +01:00
Martin Brennan 03fc31e23b
FIX: Skip failing tests for composer (#13394)
Since merging urgent fix 3a3a2abdb7
these tests are broken. We need to skip these until someone with
better knowledge of this can take a look.
2021-06-16 11:42:43 +10:00
Bianca Nenciu 3a3a2abdb7
FIX: Update raw and cooked immediate after edit (#13387)
* Revert "DEV: skips three tests following cc1e73  (#13386)"

This reverts commit 2be201660a.

* FIX: Do not refresh post stream twice

This also improves the test suite and simulates a long running request

* FIX: Update local copy of raw
2021-06-16 10:50:27 +10:00
Andrei Prigorshnev 00255d0bd2
FEATURE: make date pickers in the bookmarks UI and topic timer UI consistent with all other pickers (#13365)
Next Week should mean next Monday, Next Month - the first day of the next month, and so on.

Also, we'll be using the name "Next Monday" instead of "Next Week" because it's easier to understand. No one can get confused by next Monday.
2021-06-15 16:54:00 +04:00
Joffrey JAFFEUX 2be201660a
DEV: skips three tests following cc1e73 (#13386)
* DEV: skips two tests following cc1e73

Following the fix in cc1e73b8e4 we now refresh the whole stream which causes expected states of these tests to not exist anymore.

I'm skipping theses tests while we decide for a better fix.
2021-06-15 11:59:03 +02:00
Vinoth Kannan 9b200aba16
FIX: respect nofollow exclusion setting in topic featured links. (#11858)
Previously, nofollow attribute is not removed even when a domain is added to the `exclude_rel_nofollow_domains` site setting.
2021-06-15 15:27:43 +05:30
Sam cc1e73b8e4
FIX: refresh post stream after in-place post updates (#13384)
Changing the staged attribute on a post means we also need to re-render.

Previously certain edits would not issue a refresh leaving a post greyed out.
2021-06-15 16:40:52 +10:00
Dan Ungureanu ff4fb9c771
DEV: Add plugin API to extend search results (#12966) 2021-06-15 15:32:41 +10:00
Robin Ward 96c14c1968
FIX: Some absolute links were causing full page reloads (#13377) 2021-06-15 12:30:36 +10:00
Martin Brennan af15bf1350
FIX: Show group Email settings if just SMTP enabled (#13362)
We previously only showed the link to the Email section
of group settings if both SMTP and IMAP were enabled for
a site, but this is not necessary now, only SMTP can be
enabled by itself so we should show the section if SMTP
is enabled.
2021-06-15 10:09:25 +10:00
Kane York c780ae9d25
FEATURE: Add a messages view for all official warnings of a user (#12659)
Moderators are allowed to see the warnings list, with an access warning.

https://meta.discourse.org/t/why-arent-warnings-easily-accessible-like-suspensions-are/164043
2021-06-14 14:01:17 -07:00
Jordan Vidrine 7d8483f698
FIX: Adjust styling of first notification (#13366)
* UX: Fix first notification layout
2021-06-14 13:48:32 -05:00
Jarek Radosz a470e880bd
FIX: De-prioritize composer category on navigation (#13372) 2021-06-14 17:38:57 +02:00
David Taylor c44650eec5
FIX: Do not render user-avatar-flair element when user has no flair (#13369)
Rendering an empty flair element with the css `background-image: url();` causes the browser to attempt an image request against the current document URL. Making duplicate requests for the document URL can cause some unusual race conditions, especially related to cookies. If this user-avatar-flair element was present on the site homepage (e.g. if categories+latest is the homepage), then it can prevent the signup flow from working correctly.

This commit updates the user-avatar-flair component to be a transparent wrapper around the avatar-flair component. If the user has no flair, no avatar-flair element will be rendered. This avoids the `background-image: url();` situation, and fixes the auth flow.

This commit also removes the duplicate avatar flair rendering from the `latest-topic-list-item` component. This wasn't particularly obvious, since the duplicate flairs were being rendered directly on top of each other.
2021-06-14 15:12:57 +01:00
Andrei Prigorshnev 178b294a62
FIX: flaky javascript tests with fake timers (#13235)
The problem was happening in component integration tests on the rendering stage, sometimes the rendering would never finish.

Using time moments in the future when faking time solves the problem. Unfortunately, I don't know why exactly it helps. It was just a lucky guess after some hours I spent trying to figure out what's going on. But I've done a lot of testings, so looks like it really works. I'll be monitoring builds for some time after merging this anyway.

Unit tests seem to work alright with moments in the past. And we don't fake time in acceptance tests at the moment but I guess they would very likely be flaky with time moments from the past since they also do rendering.

I'm actually thinking of moving all fake time moments to the future (including moments in unit tests) to decrease the chances of flakiness. But I don't want to do everything in one PR, because I can accidentally introduce new flakiness.

A pretty easy way of picking time moments in the future for tests is to use the 2100 year. It has the same calendar as 2021. If a day is Monday in 2021 it's Monday in 2100 too.
2021-06-11 13:51:27 +04:00
Alan Guo Xiang Tan 4681c670c0 DEV: Remove test that is no longer providing value. 2021-06-11 12:45:37 +08:00
Robin Ward 052c841550
FIX: Clicking on a URL with a different url prefix did not work (#13349)
Before this fix if your forum was set up with a subfolder and you
clicked on a link to a different subfolder it would not work. For
example:

   subfolder: /cool
   link is: /about-us

Previously it would try to resolve /about-us as /cool/about-us. With
this fix it redirects to /about-us correctly.
2021-06-11 11:44:30 +10:00
Bianca Nenciu ef906fa1da
FIX: Do not reload post if raw is present (#13335)
Editing a post that was just posted caused it to be reloaded and made a
request to the server. This had an additional side effect where the
model instances used by post stream and composer would be different and
changes did not propagate correctly.
2021-06-11 11:00:41 +10:00
Sam 3fefdb1973
A11Y: Adjust heading rules on topic lists (#13353)
Previously due to "rowheader" role we would read out topic titles twice.

This adjusts it so we apply the heading role only to the topic link.
In turn this makes navigation through topic lists more accurate (h) only
lands you on topic links. It also reduces the amount of duplicate reading
NVDA does.

Before:

Topic title link new topic link support link b481 link 19h link 2 button...

After:

Topic title link


This reduces noise, up and down once you land on a topic link can give you
more context.
2021-06-10 10:59:30 +10:00
Penar Musaraj 8fee32d277
A11Y: Don't mark multiple form labels as applying to the same element (#13289)
Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2021-06-09 11:06:56 -04:00
Robin Ward 77d33ebe21
FIX: Lots of plugin tests were using old, non-Ember compat CLI APIs (#13320) 2021-06-09 10:58:55 -04:00
Jeff Wong f12551afd3
PERF: Animate request animation frame (#13337)
* PERF: requestanimationframe for better performance on pan events
* PERF: temporarily remove items on animate
2021-06-09 04:26:52 -10:00
Grayden 7ba35e0d71
UX: Improvements for reordering categories (#13013)
* UX: Improvements to reorder categories UX

Before, moving a category from, for example, position 25 to position 0 would result in switching the positions of the two categories at those positions.

Category A at position 0 would move to position 25, and Category B at position 25 would move to position 0.

Instead of switching positions, the reorder categories function should retain the order of categories except for the one being moved.

So, Category B at position 25 would still move to position 0, but Category A is merely bumped down to position 1.

This improves the UX because if a user *really* wants to switch the two categories, it results in one extra step. However in the other (what I think is normal) case, it saves the 24 other switches the user has to make to get Category A back to position 1 (you can imagine the user having to click the up arrow button repeatedly to return Category A to the top of the page). Now, imagine trying to do this with a site with 100s of categories. Yikes!

The UX improvement described above is what this commit accomplishes by redesigning the `move()` method of the reorder-categories controller. It adds some overhead to adjust the positions of all categories in between the origin and target positions, but in testing this is not noticible to the user. It's better for the computer to do extra work than the user.

* UX: Allow decimal input in reorder-categories for more precise positioning.

A common UX pattern when reordering a list of items is to allow a user to specify a target position as a decimal between two valid integer positions. The user is indicating they want the target list item to move in between the list items at the positions on either side of the target position.

For example, say there are three categories Category A at position 0, Category B at position 1, and Category C at position 3.

To move Category C in between Categories A and B, a user can now simply update Category C's position to 0.5.
2021-06-09 13:01:06 +03:00
Osama Sayegh 940eb28e31
FIX: Theme tests should work in production (#13333)
The `ember_jquery` bundle contains production builds of Ember and jQuery
which doesn't work with tests. This commits introduces a new
`theme_qunit_vendor` bundle which is copy of the `vendor` bundle but
doesn't contain `ember_jquery`.

This commit is a partial revert of
409c8585e4
2021-06-08 22:03:59 +03:00
Mark VanLandingham d500d0cc99
FEATURE: Add group filter to user directory (#13330) 2021-06-08 13:20:08 -05:00
Andrei Prigorshnev 49c231c993
UX: add a hint that tags can be included in tag groups (#13326) 2021-06-08 20:14:34 +04:00
Jarek Radosz 21e8a33177
DEV: Clean up QUnit tests (#13328)
* DEV: Use `query` helper instead of `queryAll()[0]`
* DEV: Replace `queryAll().length` w/ `exists()`/`count()`
* DEV: Use `exists()` instead of `count() > 0`, `count() === 0`
* DEV: Use `count()`/`exists()` instead of `find().length`
2021-06-08 17:54:12 +02:00
David Taylor 9811a1c5d9
DEV: Allow `transformed` values to be used in all widget hbs statements (#13331)
Previously, the `transformed.blah` shortcut could only be used in top-level hbs statements like {{transformed.blah}}. When attempting to use it in a sub-expression like `{{concat "hello" transformed.world}}`, it would raise a "transformed is not defined" error.

This commit updates the shortcut logic to make `transformed.blah` and `attrs.blah` work consistently in all hbs expressions.

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2021-06-08 16:46:07 +01:00
Andrei Prigorshnev 9e426d33c7
FEATURE: Don't show the draft checkmark when drafts are saved (#13292)
We don't want to show the draft checkmark in the composer when drafts are saved, as it’s a little bit distracting to see it keeps appearing and disappearing. Only in the case of error does it need to show anything, we will be showing a "drafts offline" warning as we did it before.

An important detail is that the warning was appearing and disappearing all the time too. Now, the warning won’t be flashing while a user is typing, it’ll be disappearing only when the draft was eventually saved.
2021-06-08 13:22:49 +04:00
Bianca Nenciu 393dafce7d
FIX: Hide image resize controls in staged edit content (#13313) 2021-06-08 11:58:18 +03:00
Martin Brennan 9d7b6779fb
DEV: Remove suppression of popupAjaxError if isTesting (#13325)
I made a change in https://github.com/discourse/discourse/pull/13083/files to suppress re-throwing the error from popupAjaxError if isTesting() but that causes issues in other places instead. If I remove it I get this error in the group email test I added, so I am removing that test here too.
2021-06-08 16:33:59 +10:00
Jarek Radosz 45971d8c3c
FIX: Search menu regression (#13321)
Turns out the extra `<span>` is crucial. (TODO: this codepath needs tests…)
2021-06-08 03:30:26 +02:00
Jeff Wong 7c12ca89cb
Update menu swipe (#13277)
* DEV: replace swipe events to use translate rather than left/right

translate is better for animations. also use native css animations for opening
and closing.

* a11y: respect prefers reduced motion on mobile timeline

* DEV: reduce jquery usage

* DEV: add tests for menu swipe events

test is run in 50% zoom/transform which means offsets and x of touch events need to be halved

Refactor test window to use a transform rather than non-standard zoom property

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2021-06-07 12:31:16 -07:00
Jarek Radosz 1cd189aabf
UX: Fix search topic titles wrapping (#13315)
A followup to e3b0abc and a replacement PR for #13298.
Fixes long topic titles wrapping to a separate line in the dropdown search results.

Also replaces divs that were incorrectly nested inside spans.
2021-06-07 21:26:22 +02:00
Kris b29132ebdc
UX: Fix bulk-select icon and button alignment (#13299) 2021-06-07 14:40:37 -04:00
Mark VanLandingham 0cba4d73c1
FEATURE: Add user custom fields to user directory (#13238) 2021-06-07 12:34:01 -05:00
Kris 2334c3622e
UX: group dropdown filter height should match (#13300) 2021-06-07 13:22:36 -04:00
Kris 2fb1eaa868
UX: more consistent mobile spacing (#13297) 2021-06-07 13:22:28 -04:00
jbrw 09bc95d46b
FIX: Quoting Oneboxed content should exclude formatting (#13296)
* FIX: Quoting Oneboxed content should exclude formatting

When a post is quoted that includes Oneboxed content, we should not include the formatting generated by the Onebox. Rather, we should attempt to collapse the link referenced by the Onebox to a single line text link.

* DEV: fix tests
2021-06-07 13:03:53 -04:00
Régis Hanol 3477c8a2a9
SECURITY: XSS in bookmarks list (#13311)
We should use `fancy_title` instead of `title` when displaying a topic title to ensure only the allowed html is not escaped.
2021-06-07 16:49:57 +02:00
Penar Musaraj 6759e5e396
DEV: Do not always include software update HTML in DOM (#13291) 2021-06-07 09:40:03 -04:00
awesomerobot 2110fd2638 UX: Improve tag truncation in scrolled header 2021-06-07 16:44:03 +08:00
Bianca Nenciu 46cd355046
FIX: Allow any other tag to be a synonym (#13290)
Tag-chooser component expects an array of blocked tags, but was passed
a string instead. That made tag-chooser to not allow any tags that were
a substring of the current one.
2021-06-04 21:51:53 +03:00
Penar Musaraj c4e801852f
A11Y: Improve topic details toggle button label (#13287) 2021-06-04 13:28:18 -04:00
Penar Musaraj 2c6ceec9ea
A11Y: Add aria-label to modal close button (#13288) 2021-06-04 13:28:04 -04:00
Penar Musaraj 78029fd913
A11Y: Include aria-label for avatar images in widgets (#13286) 2021-06-04 13:26:08 -04:00
Robin Ward 5d2b836ae5
DEV: Move pretty-text into vendor and use that (#13273)
In Ember CLI addons get put into the vendor bundle, as opposed to their
own bundle like we're doing in the Rails app. We never use pretty-text
without our vendor bundle so this should have no difference on
performance.

We need to keep the pretty-text bundle for server side cooking.
2021-06-04 11:01:59 -04:00
Andrei Prigorshnev 476dfaed2f
FIX: Composer doesn't show an error message in case of a network issue and stops updating draft after (#13268) 2021-06-04 16:15:47 +04:00
Martin Brennan b01e4738ab
DEV: Add more keyboard shortcut acceptance tests (#13280)
This adds acceptance tests for keyboard shortcuts to
dismiss new and unread topics.

Also, I cleaned out a few old specs for the unit test for
keyboard-shortcuts. Some were introduced way back in
5100c2bbd2
but then supplanted by
9548876c2d
and never cleaned up, so they were doing nothing.

Follow up to https://review.discourse.org/t/fix-dismiss-topics-keyboard-shortcut-not-working-pr-13260/22157/4?u=martin
2021-06-04 14:04:20 +10:00
Kris e3b0abc575
UX: Revert some search dropdown styles (#13274) 2021-06-03 22:54:22 -04:00
Kris cd9941e0ca
UX: more consistent setting/edit buttons (#13276) 2021-06-03 18:33:36 -04:00
jbrw 9d8bc6a405
FIX: Return `naturalWidth` and `naturalHeight` for Composer image sizes (#13271)
Rather than returning the size of the currently rendered image in the composer window (which is dependent on browser settings such as window size and zoom level), return the actual dimensions of the image file itself.

(Also see commit abac614492 which was an earlier attempt to fix this by excluding Oneboxed images entirely. That was reverted as the CSS selector didn’t work on all browsers.)
2021-06-03 16:21:56 -04:00
Penar Musaraj 9a449ac534
UX: Adjustments to tag groups layout (#13269) 2021-06-03 13:58:28 -04:00
Arpit Jalan b27674597c
FIX: redirect non-staff user to homepage when deleting own topic (#13267) 2021-06-03 20:27:29 +05:30
Osama Sayegh 3249312c81
FIX: Escape periods in current user's username before generating `RegExp` (#13247)
If we don't escape periods, they are interpreted as wildcards and it
becomes impossible to visit profiles of other users whose usernames
match. E.g., if your username was `a.c` and attempted to visit `abc`'s
profile, you would be incorrectly redirected to your own profile.
2021-06-03 14:15:38 +10:00
Kris f3e021ad45
UX: Update search panel styles, consistency (#13262) 2021-06-03 14:14:24 +10:00
jbrw b57dca90fc
Revert "FIX: Ignore `allowlistgeneric` Onebox image sizes (#13240)" (#13261)
This reverts commit abac614492.

The CSS selector I was trying to use does not appear to be widely supported.
2021-06-02 21:36:46 -04:00
Martin Brennan 006d52f32b
FIX: Dismiss topics keyboard shortcut not working (#13260)
This issue is a result of
7a79bd7da3,
where the ID for the bottom Dismiss Topic buttons changed to
dismiss-topic-bottom.
2021-06-03 11:20:20 +10:00
jbrw abac614492
FIX: Ignore `allowlistgeneric` Onebox image sizes (#13240)
* FIX: Ignore `allowlistgeneric` Onebox image sizes

The size of an image contained within the preview pane of a Composer window may vary depending on the configuration of the browser displaying the Composer (e.g., dimension of browser window, zoom level, etc.).

Presently, the dimensions of the images from the browser creating the post containing the Onebox will be used to render the Onebox to anyone who views the post. It is safer to let the backend figure out the dimensions of the images. Therefore, exclude `.onebox.allowlistedgeneric` images from the list of `image_sizes` sent to the backend.

* DEV: Replace jQuery selector with pure JS

* DEV: remove more jQuery
2021-06-02 20:02:13 -04:00
Jordan Vidrine 188ac1c51f
FIX: Add check for if element doesnt exist on ensureDropClosed (#13256) 2021-06-02 13:44:21 -05:00
Penar Musaraj d3e9a028f5
SECURITY: Do not allow unauthorized access to category edit UI (#13252) 2021-06-02 13:18:45 -04:00
Bianca Nenciu e81a5182b3
FEATURE: Stage post edits immediately (#13249)
After editing a post, it is refreshed by two ways. One of them is
triggered by the client side which will route the client to the edited
post and force a reload this way. The other way is via Message Bus.

This commit ignores both of the ways and tries to update the post
immediately and then refresh the post stream.
2021-06-02 17:30:36 +03:00
Dan Ungureanu 447d8dfc44
UX: Use icons as bulleted list in invite modal (#13229) 2021-06-02 16:28:54 +03:00
Bianca Nenciu d9484db718
FIX: Split link watched words from replace (#13196)
It was not clear that replace watched words can be used to replace text
with URLs. This introduces a new watched word type that makes it easier
to understand.
2021-06-02 15:36:49 +10:00
Martin Brennan e15c86e8c5
DEV: Topic tracking state improvements (#13218)
I merged this PR in yesterday, finally thinking this was done https://github.com/discourse/discourse/pull/12958 but then a wild performance regression occurred. These are the problem methods:

1aa20bd681/app/serializers/topic_tracking_state_serializer.rb (L13-L21)

Turns out date comparison is super expensive on the backend _as well as_ the frontend.

The fix was to just move the `treat_as_new_topic_start_date` into the SQL query rather than using the slower `UserOption#treat_as_new_topic_start_date` method in ruby. After this change, 1% of the total time is spent with the `created_in_new_period` comparison instead of ~20%.

----

History:

Original PR which had to be reverted **https://github.com/discourse/discourse/pull/12555**. See the description there for what this PR is achieving, plus below.

The issue with the original PR is addressed in 92ef54f402

If you went to the `x unread` link for a tag Chrome would freeze up and possibly crash, or eventually unfreeze after nearly 10 mins. Other routes for unread/new were similarly slow. From profiling the issue was the `sync` function of `topic-tracking-state.js`, which calls down to `isNew` which in turn calls `moment`, a change I had made in the PR above. The time it takes locally with ~1400 topics in the tracking state is 2.3 seconds.

To solve this issue, I have moved these calculations for "created in new period" and "unread not too old" into the tracking state serializer.

When I was looking at the profiler I also noticed this issue which was just compounding the problem. Every time we modify topic tracking state we recalculate the sidebar tracking/everything/tag counts. However this calls `forEachTracked` and `countTags` which can be quite expensive as they go through the whole tracking state (and were also calling the removed moment functions).

I added some logs and this was being called 30 times when navigating to a new /unread route because  `sync` is being called from `build-topic-route` (one for each topic loaded due to pagination). So I just added a debounce here and it makes things even faster.

Finally, I changed topic tracking state to use a Map so our counts of the state keys is faster (Maps have .size whereas objects you have to do Object.keys(obj) which is O(n).)

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2021-06-02 09:06:29 +10:00
Kris 9e5b8544a1
UX: Fix "last visit" line overlap in Chrome (#13232) 2021-06-01 17:33:29 -04:00
Gerhard Schlager 41ee5b7c86
FIX: Don't store translated trust level names in anonymous cache (#13224)
Refactors `TrustLevel` and moves translations from server to client

Additional changes:
  * "staff" and "admin" wasn't translatable in site settings
  * it replaces a concatenated string with a translation
  * uses translation for trust levels in users_by_trust_level report
  * adds a DB migration to rename keys of translation overrides affected by this commit
2021-06-01 22:11:48 +02:00
Robin Ward 409c8585e4
DEV: Remove `ember_jquery` in most situations (#13237)
In Ember CLI, the vendor bundler includes Ember/jQuery, so this brings
our app closer to that configuration.

We have a couple pages (Reset Password / Confirm New Email) where we need
`ember_jquery` without vendor so the file still exists for those cases.
2021-06-01 15:32:51 -04:00
Andrei Prigorshnev fd64268b0d
FIX: translation issue on the bookmark modal (#13231) 2021-06-01 19:13:58 +04:00
Jarek Radosz eb6a6446ee
FIX: Update non-Ember CLI ember-buffered-proxy (#13227)
This version matches the one we have in discourse/package.json.

Fixes an issue with saving topic name form w/o any changes.
2021-06-01 16:49:03 +02:00
Meghna 10c4fe5025
UX: fix PM header title alignment (#13223) 2021-06-01 14:36:56 +05:30
Joffrey JAFFEUX 1cd0424ccd
FEATURE: lets users favorite 2 badges to show on user-card (#13151) 2021-06-01 10:33:40 +02:00
Sam c5174e6982
FIX: MessageBus would stall after 20 minutes of inactivity (#13219)
Previous to this change we would switch off MessageBus updating after 20
minutes.

This ensures that when the user becomes present again we turn on long polling.

Without long polling updates can be delayed for minutes.
2021-06-01 12:23:51 +10:00
Krzysztof Kotlarek 73f11d568d
FEATURE: extend widget-dropdown to accept disabled option (#13020)
The widget should accept the disabled option.
In that case, CSS class "disabled".
In addition, after click dropdown will not be shown.

Also, the option to disable a specific value in a dropdown is included
2021-06-01 09:49:11 +10:00
Roman Rizzi 9ecd17b083
FIX: TL4 users cannot unhide posts. (#13211)
"PostsGuardian#can_unhide_post?" only returns true if the user is a staff member. We shouldn't let TL4 users see the Unhide post button.
2021-05-31 16:39:25 -03:00
Jarek Radosz 869518e3d2
FEATURE: Show all categories in composer (#13213)
…and just prioritize the current one, instead of hiding other categories.

Context: when you open the composer by clicking "New Topic" button when in a category, or by clicking "New Topic" in the share-popup, the category selector shows only the current category and its children (and "Uncategorized"). You can still find other categories, but you have to search by name.
This PR changes that, so you now can see all the categories in the dropdown, and those that are relevant (again: current, children and uncategorized) are displayed before all other categories.

tldr: don't make choosing other categories harder - make choosing relevant ones easier.
2021-05-31 20:50:23 +02:00
Jarek Radosz be92f4e959
UX: Fix the PM title icon alignment (#13214)
No extra margin to the left of the input, and the icon is one pixel lower.
2021-05-31 20:47:41 +02:00
Faizaan Gagan 8085fc6d39
DEV: add an option in user-chooser to list staged users (#13201)
* DEV: add an option in user-chooser to list staged users

* included rspec tests

* force boolean
2021-05-31 12:02:32 -04:00
Jarek Radosz 0922a69c62
UX: Align the bulk-select icon (#13210) 2021-05-31 15:27:59 +02:00
Jarek Radosz e06a206131
DEV: Remove `cache` option from `ajax()` (#13142)
1. It defaults to `cache: true` already
2. Setting it to `false` for non-GET request doesn't do anything
3. We were correcting `cache: false` GET requests to use `cache: true`

…so setting it to anything at all, for any type of request doesn't make sense (anymore)
2021-05-31 14:41:35 +02:00
Osama Sayegh b81b24dea2
Revert "DEV: Topic tracking state improvements (#12958)" (#13209)
This reverts commit 002c676344.

Perf regression, we will redo it.
2021-05-31 17:47:42 +10:00
Dan Ungureanu f3fdc7a6e8
FIX: Maintain notification order by priority (#13186)
When the client received a new notification, it prioritized only PM
notifications instead of maintaining the priority order. Later, the
check for missing notification deleted all notifications that were
in the wrong order because it could not match the IDs.

The correct order puts high_priority AND unread notifications first.
Low priority or read notifications (including high priority, but read
notifications) come after.
2021-05-31 09:27:13 +03:00
Martin Brennan 002c676344
DEV: Topic tracking state improvements (#12958)
Original PR which had to be reverted **https://github.com/discourse/discourse/pull/12555**. See the description there for what this PR is achieving, plus below.

The issue with the original PR is addressed in 92ef54f402

If you went to the `x unread` link for a tag Chrome would freeze up and possibly crash, or eventually unfreeze after nearly 10 mins. Other routes for unread/new were similarly slow. From profiling the issue was the `sync` function of `topic-tracking-state.js`, which calls down to `isNew` which in turn calls `moment`, a change I had made in the PR above. The time it takes locally with ~1400 topics in the tracking state is 2.3 seconds.

To solve this issue, I have moved these calculations for "created in new period" and "unread not too old" into the tracking state serializer.

When I was looking at the profiler I also noticed this issue which was just compounding the problem. Every time we modify topic tracking state we recalculate the sidebar tracking/everything/tag counts. However this calls `forEachTracked` and `countTags` which can be quite expensive as they go through the whole tracking state (and were also calling the removed moment functions).

I added some logs and this was being called 30 times when navigating to a new /unread route because  `sync` is being called from `build-topic-route` (one for each topic loaded due to pagination). So I just added a debounce here and it makes things even faster.

Finally, I changed topic tracking state to use a Map so our counts of the state keys is faster (Maps have .size whereas objects you have to do Object.keys(obj) which is O(n).)
2021-05-31 09:22:28 +10:00