Commit Graph

13100 Commits

Author SHA1 Message Date
David Taylor c62f082754
UX: Only link the icon for site setting history (#11265)
Linking the whole site setting name makes it tricky to copy/paste the name, which is common when asking/answering support queries.
2020-11-17 15:59:55 +00:00
Robin Ward 3fc5671e40 REFACTOR: Allow us to import `keyEvent`
This change should be quite safe as it only adds extra support for
imports rather than global variables.
2020-11-17 09:43:08 -05:00
Arpit Jalan 2fde06ba08
UX: handle large email addresses on email skipped and bounced tabs (#11259) 2020-11-17 18:01:40 +05:30
Arpit Jalan 473f7bfe7b
FIX: do not allow a tag to be synonym of its own (#11246)
https://meta.discourse.org/t/adding-synonym-to-the-same-tag-gets-stuck/169801/
2020-11-17 06:52:31 +05:30
Martin Brennan a9b20fa827
DEV: Allow overiding calculation of top offset for card contents base (#11254) 2020-11-17 12:05:59 +11:00
David Taylor 475b4892e3
DEV: Remove 'diff local changes' when updating remote themes (#11247)
Since 65e123498b, it is now impossible to make local changes to remote themes, so this warning is not needed.
2020-11-16 19:28:12 +00:00
Dan Ungureanu bc8423a1bf
FEATURE: Add auto update field to themes (#11102)
Themes marked for auto update will be automatically updated when
Discourse is updated. This is triggered by discourse_docker or
docker_manager running Rake task 'themes:update'.
2020-11-16 14:44:09 +02:00
Arpit Jalan 0853208d67
FIX: save draft when either title or reply is present (#11243)
Here's how draft saving process works currently:

- if only title is present (no reply) the draft is saved
- if only reply is present (no title) the draft is saved
- if both title and reply are present, and reply length is less than
`min_post_length` and the title length is less than
`min_topic_title_length`, then the draft is saved
- if both title and reply are present, and reply length is less than
`min_post_length`, then the draft is not saved

The current draft saving conditions are complex to understand and is
causing confusion as seen here: https://meta.discourse.org/t/draft-is-not-being-saved-when-creating-a-new-pm/149990/6?u=techapj

This commit updates the process to always save the draft if either title
or reply exists.
2020-11-16 16:43:50 +05:30
Justin DiRose 65e123498b
FIX: Disallow editing of remote themes (#11189)
Allowing the editing of remote themes has been something Discourse has advised against for some time. This commit removes the ability to edit or upload files to remote themes from Admin > Customize to enforce the recommended practice.
2020-11-13 09:57:49 -06:00
Robin Ward 0d0ae5e67f REFACTOR: Add support for `currentRouteName` in test helpers
This replaces the global `currentPath`
2020-11-13 09:31:09 -05:00
Krzysztof Kotlarek bd0b558a89
FIX: paste the spreadsheet to the composer (#11163)
* FIX: paste the spreadsheet to the composer

If we paste spreadsheet with the missing label we receive
`"	this \n1	2"`

If we trim whitespace at the beginning then our later calculation to determine if it is a table is incorrect:

```
      const columns = rows.map((r) => r.split("\t").length);
      const isTable =
        columns.reduce((a, b) => a && columns[0] === b && b > 1)
```

https://meta.discourse.org/t/pasting-from-spreadsheet-wont-work-if-corner-cell-is-empty/169443
2020-11-13 13:01:22 +11:00
Roman Rizzi ffd1b7c234
Revert "topic fixup" (#11223)
The review queue page fails to load with the error: "TypeError: category is null"

This reverts commit 19b7cdd21f.
2020-11-12 15:15:25 -03:00
Penar Musaraj 89fc11e93b
UX: Layout changes to edit category page (#11222) 2020-11-12 12:51:25 -05:00
Mark VanLandingham fa29c2e7b9
DEV: Refactor default new group permissions (#11221) 2020-11-12 10:37:33 -06:00
Penar Musaraj 698b7ace10
FIX: Reset category edit page button state (#11218)
Fixes two small issues:
- buttons stayed disabled after deleting a category
- on a newly-created category, the Edit button was missing on the category landing page
2020-11-12 10:03:58 -05:00
Arpit Jalan df003eaf7b
FIX: add a way to cancel initialization of new draft (#11106) 2020-11-12 19:13:52 +05:30
David Taylor 5be78bb2d9
FIX: Use `filters` parameter instead of `filter` for staff action log (#11217)
Fixing this also means that ember takes care of JSON encoding the query parameter

Follow-up to a4441b3984
2020-11-12 13:31:28 +00:00
David Taylor a4441b3984
FEATURE: Link site setting titles directly to their change log (#11215)
This makes it much easier to check the staff action logs for a specific site setting. A small history icon will appear when hovering over a site setting name. On click, you will be taken to the pre-filtered staff action log for the site setting.
2020-11-12 12:07:36 +00:00
Gerhard Schlager 6d4711ca10
DEV: Fix lint (#11213) 2020-11-12 12:15:55 +01:00
Kris a90c18e033
DEV: Account for below-site-header and above-site-header outlets when positioning timeline and usercards (#10434) 2020-11-12 11:45:09 +01:00
Jarek Radosz cd6dbd3e9c
FIX: Restore (deprecated) ability to overwrite a property (#11207)
It should be a `readOnly` but some themes/plugins still pass the `categories` property into this component, so…
2020-11-11 22:16:20 +01:00
Jarek Radosz ae8c96ed35 DEV: Wait for debounced functions
Modern Ember testing environment requires calling `await settled()` to wait for delayed runloop-aware functions.
2020-11-11 13:32:42 -05:00
Jarek Radosz 80ef210730 Imports lint 2020-11-11 13:32:29 -05:00
Jarek Radosz b1bbcb2415 DEV: Use topic property setter 2020-11-11 13:32:29 -05:00
Jarek Radosz cb4c9eeab8 DEV: Don't eagerly find and assign Topic.category 2020-11-11 13:32:29 -05:00
Jarek Radosz 19b7cdd21f topic fixup 2020-11-11 13:32:29 -05:00
Jarek Radosz 20108f834c DEV: Don't overwrite computed props in tests 2020-11-11 13:32:29 -05:00
Jarek Radosz 25524a213d DEV: Remove duplicated code
Fixes "overwriting computed property" warnings
2020-11-11 13:32:29 -05:00
Jarek Radosz 883da89c70 DEV: Replace a full computed prop with readOnly 2020-11-11 13:32:29 -05:00
Jarek Radosz 44de03e409 Imports 2020-11-11 13:32:29 -05:00
Jarek Radosz 0fc944889b DEV: Replace observers in User model 2020-11-11 13:32:29 -05:00
Jarek Radosz fe2c3e3e38 DEV: Replace the Topic.category observer
Fixes an issue in Ember CLI environment
2020-11-11 13:32:29 -05:00
Gerhard Schlager 811c610108
DEV: Assign id to button for easier finding via CSS selectors (#11200) 2020-11-11 18:33:23 +01:00
Roman Rizzi 331517abe6
UI: Blur review queue images. (#11187)
We blur images by default to protect reviewers against NSFW content. To see the image, they'll have to hover over it.
2020-11-11 14:09:42 -03:00
Arpit Jalan 80759c9619
UX: add a confirmation dialog for draft deletion (#11198) 2020-11-11 22:02:52 +05:30
Arpit Jalan 6ea9eb0260
UX: add a link to invites on quick access profile panel (#11202) 2020-11-11 22:02:27 +05:30
David Taylor 255633578c
DEV: Move logout redirect logic to server and add plugin hook (#11199)
This will allow authentication plugins to provide single-logout functionality by redirect users to the identity provider after logout.
2020-11-11 15:47:42 +00:00
Dan Ungureanu ab314218d3
FEATURE: Implement edit functionality for post notices (#11140)
All post notice related custom fields were moved to a single one.
2020-11-11 14:49:53 +02:00
Bianca Nenciu 84e2915e71
UX: Increase the hit area of pinned topics on mobile (#11147)
It used to be only the topic title, but that area has been increased to
include the excerpt too.
2020-11-11 13:46:53 +02:00
Vinoth Kannan 67de0367ff
UX: add stock suspension reasons to suspend dialog. (#10990) 2020-11-11 01:01:28 +05:30
Arpit Jalan 00b41437b0
FIX: hide sso email behind a button click and log views (#11186) 2020-11-11 00:42:44 +05:30
Dax74 cf4be109e2
UX: increase limit of custom user fields (#11192)
Increase limit of custom user fields from 20 to 30
2020-11-10 19:54:01 +01:00
Penar Musaraj fc4910b556
FIX: Use more specific selector for header (#11185) 2020-11-10 11:53:56 -05:00
Penar Musaraj 0b7f43fba8
REFACTOR: Remove SweetAlert dependency (#11183) 2020-11-10 11:31:54 -05:00
Mark VanLandingham 47a91742b0
Revert "DEV: Move popups left if application.hbs wrapper is moved by theme" (#11184)
This reverts commit 95c871be3e.
2020-11-10 10:14:04 -06:00
Roman Rizzi 5ae82c0492
FIX: Show hidden posts to staff members. (#11171)
When looking at the list of a user's deleted posts, those that are also hidden are not listed. Context: https://meta.discourse.org/t/flagged-deleted-posts-do-not-show-up-on-users-profile/168527
2020-11-10 12:34:22 -03:00
Jordan Vidrine 0f38fc42e2
FIX: Remove duplicate category description (#11178)
This commit removes the duplicate category description on sub categories in the category list. I believe this went unnnoticed because we are hiding these by default.
2020-11-10 09:32:24 -06:00
Daniel Waterworth 3a5080b469
FIX: Renaming and deleting tags (#11169)
The REST adapter generates paths with the /tags/ prefix indescriminately,
but individual tag paths have been moved under the /tag/ prefix to allow
tags with names that would otherwise cause ambiguity like c.
2020-11-10 10:57:25 +00:00
Krzysztof Kotlarek 586c8efbd8
FEATURE: the ability to permanently destroy the private message (#11115)
PostDestroyer should accept the option to permanently destroy post from the database. In addition, when the first post is destroyed it destroys the whole topic.

Currently, that feature is limited to private messages and creator of the post. It will be used by discourse-encrypt to explode encrypted private messages.
2020-11-10 15:40:48 +11:00
Penar Musaraj 57bd85af31
UX: Minor cosmetic fixes to the wizard (#11172)
- Does not force users to type a description or a welcome topic
- Adds * marker for required text fields (site title and email)
2020-11-09 15:14:57 -05:00
Daniel Waterworth ec4c2a58ea
FIX: Paths with categories and tags were being generated incorrectly (#11167)
Paths prefixed with /tag/ are exclusively for when the tag name is the
next string in the path. Therefore, when a category is being used as
context, the path should start with /tags/ instead.
2020-11-09 12:34:52 +00:00
David Taylor a0095d6e52
UX: Show theme git branch for private repositories (#11166) 2020-11-09 11:33:38 +00:00
Joe 3414566466
UX: Remove label and add danger class to remove draft button (#11165) 2020-11-09 15:28:39 +08:00
Kris 1455421433
UX: truncate long usernames in multi-username notifications (#11153)
* UX: truncate long usernames in multi-username notifications

* remove extra class, clarify comments
2020-11-09 16:06:52 +11:00
Justin DiRose 09b8a61f65
FEATURE: Add Google Universal Analytics v4 as an option (#11123)
Per Google, sites are encouraged to upgrade from Universal Analytics v3 `analytics.js` to v4 `gtag.js` for Google Analytics tracking. We're giving admins the option to stay on the v3 API or migrate to v4. Admins can change the implementation they're using via the `ga_version` site setting. Eventually Google will deprecate v3, but our implementation gives admins the choice on what to use for now.

We chose this implementation to make the change less error prone, as many site admins are using custom events via the v3 UA API. With the site stetting defaulted to `v3_analytics`, site analytics won't break until the admin is ready to make the migration.

Additionally, in the v4 implementation, we do not enable automatic pageview tracking (on by default in the v4 API). Instead we rely on Discourse's page change API to report pageviews on transition to avoid double-tracking.
2020-11-06 14:15:36 -06:00
Mark VanLandingham 95c871be3e
DEV: Move popups left if application.hbs wrapper is moved by theme
We have a div that is inside #main because of the history of Ember explained here. Once we have Ember cli, we can use optional feature flags and disable creating this div with application-template-wrapper: false, and refactor this code and any plugins that rely on that div being present (some plugin regarding remote collaboration??).
2020-11-06 09:46:26 -06:00
Sam 2d4455161b
FIX: Correct "no tags" route in tag drop-down (#11142)
We refactored routes and removed /tags/none... instead is should be /tag/none
2020-11-06 10:28:57 +11:00
Jarek Radosz 1ca6434d40
DEV: Remove i18n-patches (#11139)
* DEV: Move toHumanSize patch into I18n proper
  The patch wasn't loaded in Ember CLI environment causing translation discrepancies.

* DEV: Remove String.prototype.i18n
  I don't think this patch is needed. Let the CI prove me wrong. :P
2020-11-06 00:08:36 +01:00
Krzysztof Kotlarek 9bfce1a8dd
FIX: trim no-break space in to-markdown (#11130)
No-break spaces were the reason for double spaces when pasting text to the composer.

https://meta.discourse.org/t/extra-spaces-added-to-markdown-with-rich-text-pasted/112769
2020-11-06 09:36:36 +11:00
Jarek Radosz 1b52cdedb1
DEV: Move more tests into modules (#11119)
Models, services, mixins, utilities, and most of the controllers
2020-11-05 20:23:28 +01:00
jbrw bba73fc15e
FEATURE: Allow category group moderators to delete topics (#11069)
* FEATURE - allow category group moderators to delete topics

* Allow individual posts to be deleted

* DEV - refactor for new `can_moderate_topic?` method
2020-11-05 12:18:26 -05:00
Penar Musaraj 707ed01f33
UX: Wider canvas buttons in wizard (#11124) 2020-11-05 09:55:35 -05:00
Kris 3ee216c036
FIX: include header offset relative to window (#11114) 2020-11-04 21:14:17 -05:00
Roman Rizzi fa12302e77
FIX: Update review settings. (#11125)
We didn't update review settings even if the UI says it was successfully saved. After #11097, we started to clone each setting and store the changes there instead, but we still use the original objects when we perform the save action.
2020-11-05 12:26:59 +11:00
Arpit Jalan 3397e0e38b
UX: sort user badges by Gold > Silver > Bronze. (#11117) 2020-11-04 22:17:47 +05:30
Arpit Jalan 0cb4109cbb
FIX: group notification level cannot be null (#11109)
Group's `default_notification_level` cannot be null so there is no need
to provide "none" translation for group notification level dropdown.
2020-11-04 07:29:00 +05:30
Bianca Nenciu d2116f0029
FIX: Show error message if user is already silenced or suspended (#10988)
Users could be silenced or suspended by two staff members at the same time and
would not be aware of it. This commit shows an error message if another penalty
has been applied.
2020-11-03 17:38:56 +02:00
Dan Ungureanu 3c51647872
DEV: Remove legacy tag and category routes (#10338)
* DEV: Remove client-side legacy tag and category routes

* DEV: Remove server-side legacy tag routes

* DEV: Refactor ListController#set_category

* FIX: Remove reference to discovery.parentCategory

* FIX: Refactor TagsController#set_category_from_params

* FIX: Build correct canonical URL for tags and categories

* DEV: Fix deprecation notice in Ruby 2.7

* DEV: Replace use of removed legacy tag route

* DEV: Add deprecation notices for old routes and controllers
2020-11-03 16:57:58 +02:00
David Taylor 5140ec9acf
DEV: Cleanup ignored user logic (#11107)
- IgnoredUser records should all now have an expiring_at value. This commit enforces that in the DB, and fixes any corrupt rows
- Changes to the ignored user list are now handled by the `/u/{username}/notification_level` endpoint. This allows setting expiration dates on the ignore. This commit removes the old logic for saving a list of usernames in the user preferences.
- Many specs were calling `IgnoredUser.create`. This commit changes them to use `Fabricate(:ignored_user)` for consistency
2020-11-03 12:38:54 +00:00
Vinoth Kannan 9b593435b6
FIX: hide 'category read only banner' in categories list page. (#11072)
Previously, while navigating away from single category page to categories list page "category read only" banner is not hiding automatically.
2020-11-03 16:59:58 +11:00
Kris b9fb1cebcd
Refactor: tags/show should use d-navigation (#10927) 2020-11-02 17:35:02 -05:00
Kris c5a4907800
Revert "FIX: adjust user card position, follow-up to da5841d (#11036)" (#11074)
This reverts commit 863f86c3a3, I misdiagnosed this issue
2020-11-02 14:25:17 -05:00
Justin DiRose 03cd5baed9
FIX: Make addNavigationBarItem subfolder compatible (#11101)
@danielwaterworth suggested taking a look at this when reviewing a plugin using this API. 

When declaring a new nav item using `addNavigationBarItem` and including the `href` attribute, we don't currently process that URL to be subfolder compatible. 

Nav bar items coming in via the API are considered `ExtraNavItem` and the `href` value is passed straight through to the `buildItems` method, vs using the computed href method. This PR adds a simple `getURL` call on that href value to ensure it's subfolder-safe.

I also accounted for the `customHref` function in the API to make those URLs subfolder safe as well.

<!-- 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. -->
2020-11-02 11:30:23 -06:00
Penar Musaraj 5041ebe612
UX: Fix confusing admin UI for color scheme updates (#11100) 2020-11-02 11:28:04 -05:00
Penar Musaraj f5a726e52b
FIX: Disabled action buttons on newly-created category (#11080)
Ensures the newly created category record gives the current user permission to create a new topic and sets her notification level to the default (regular).
2020-11-02 09:36:27 -05:00
Robin Ward 88c2cbb6d6
REFACTOR: Remove `window.sinon` and `window.MouseTrap` from tests (#11092)
Also allow us to reset mousetrap in a teardown method.
2020-11-02 11:44:52 +01:00
Gerhard Schlager b73234b75c
FIX: Show an example username in Review Settings (#11097)
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2020-11-02 11:13:30 +01:00
Arpit Jalan b6aaff74be
UX: update labels to indicate that invite link will be generated (not copied) (#11077) 2020-10-31 07:10:13 +05:30
Justin DiRose 7b312b7bc6
FIX: Category drop shows undefined (#11090)
After 5fc239b535, the category dropdown
was showing "undefined" for the "all-categories" and "no-categories"
messages. This commit introduces a check to run the HTML parser only if
we're dealing with a real category, which fixes the above issue.
2020-10-30 14:20:10 -05:00
Jarek Radosz c777ca4af1
DEV: Skip randomly failing tests (#11089)
😢 Not their time to shine yet.
2020-10-30 18:21:03 +01:00
Jarek Radosz a17d54d0bf
DEV: De-arrowify tests (#11068)
Using arrow functions changes `this` context, which is undesired in tests, e.g. it makes it impossible to setup things like pretender (`this.server`) in `beforeEach` hooks.

Ember guides always use classic functions in examples (e.g. https://guides.emberjs.com/release/testing/test-types/), and that's what it uses in its own test suite, as do various addons and ember apps.

It was also already used in Discourse where `this` was required. Moving forward, it will be needed in more places as we migrate toward ember-cli.

(I might later add a custom rule to eslint-discourse-ember to enforce this)
2020-10-30 17:37:32 +01:00
Roman Rizzi 7912ce4002
UI: Slow mode tweaks. (#11081)
We remove the slow mode composer message and provide better messages when rejecting new posts and edits. The client now validates if the user tries to post again immediately. Finally, we replaced the `hourglass-end` icon with the `hourglass-start` one.
2020-10-30 11:22:56 -03:00
Vinoth Kannan af4938baf1
Revert "DEV: enable cors to all cdn get requests from workbox. (#10684)" (#11076)
This reverts commit e3de45359f.

We need to improve out strategy by adding a cache breaker with this change ... some assets on CDNs and clients may have incorrect CORS headers which can cause stuff to break.
2020-10-30 16:05:35 +11:00
Arpit Jalan 8f7f5204db
UX: inform staff users that new users will be auto-approved on invite (#11062)
When `must_approve_users` is enabled then staff users assume that all
users will have to be approved manually. But in case of invite we
auto-approve users if they are invited by users. This commit adds an
info on the bottom of invite modal informing staff users that new users
will be auto-approved as soon as they accept invite.
2020-10-30 08:41:14 +05:30
Gerhard Schlager cc74c3f9ab
FEATURE: Batch process topic bulk actions (#10980)
Topics are processed in chunks of 30 in order to prevent timeouts.
2020-10-30 12:02:35 +11:00
Rafael dos Santos Silva ec35b353a7
FEATURE: Add a CSS class to the HTML element on background connection error (#10991)
This is a way to detect that Discourse isn't able to receive online updates from
the server, and will be used to trigger an UI warning to the user that the session
is working on offline mode.

Meta request https://meta.discourse.org/t/offline-indicator/123000?u=falco
2020-10-30 11:59:02 +11:00
Vinoth Kannan 2d5bb516a6
FIX: keep tag filter value when changing the category dropdown. (#11065)
Previously, while filtering the topics by tag, selecting a category loses the selected tag value.
2020-10-30 11:56:20 +11:00
Robin Ward 5e110a5770 FIX: Search filters text was not able to be overridden
This is because the translations were being applied when the JS files
were parsed, which is before the overrides are loaded.

The solution is to return the filters in a function which is executed
when they are needed.
2020-10-29 16:01:00 -04:00
Robin Ward 435a9913a4 REFACTOR: Replace global `find` with `queryAll`
In newer Embers jQuery is removed. There is a `find` but it only returns
one element and not a jQuery selector. This patch migrates our code to a
new helper `queryAll` which allows us to remove the global.
2020-10-29 14:45:51 -04:00
Sam d10b6dc498
FEATURE: Allow admins to opt out of chunked encoding (#11060)
Most proxies out there will work with chunked encoding transfer. However
some proxies buffer, causing large delays which in turn force the message
bus client to disable chunked encoding. This wastes a request to the message
bus causing superfluous load on the server.

Also

- enableLongPolling is already default true in the client, no need to set it
- remove confusing comment about zepto
2020-10-29 16:25:46 +11:00
Krzysztof Kotlarek 8e7c746e56
FEATURE: Ask user to confirm topic deletion when views exceed a certain amount (#11006)
Before deleting a topic that has a high number of views (default of 5000), the user will be prompted with a confirmation popup. This works for all delete buttons on the topic located in: topic-timeline, topic-admin-menu, topic-footer-buttons, and post-menu if the post's ID is 1.

The delete button will be disabled while deletion is in progress, to prevent any unwanted behavior.

A site setting is also available to change the minimum amount of views required to display the confirmation popup.

All kudos are going to @RickyC0626. I only rebased with master and added few qunit tests to ensure that this feature works as expected.

Original PR: #10459
2020-10-29 14:18:43 +11:00
Roman Rizzi 2f32336081
FIX: Staff can create and edit posts even if a topic is in slow mode. (#11057)
Additionally, ninja edits are no longer restricted.
2020-10-28 16:47:50 -03:00
Vinoth Kannan e3de45359f
DEV: enable cors to all cdn get requests from workbox. (#10685)
Now all external requests from the service worker will be in CORS mode without credentials.
2020-10-28 23:36:19 +05:30
Robin Ward b302321451 REFACTOR: Test assertions should be imported.
Previously they were global functions.
2020-10-28 11:39:06 -04:00
ti0 f809e6eda7 Add upload-actions plugin outlet 2020-10-28 10:42:04 -04:00
Penar Musaraj ab6894ea36
Add routing for category edit screens (#11027)
Also fixes category editing for instances with slug generation set to "none".
2020-10-28 09:59:38 -04:00
Arpit Jalan 6d4cfbf120
FIX: show 'quote' button when topic is closed but composer is open (#11054) 2020-10-28 19:25:06 +05:30
Krzysztof Kotlarek dbec3792b7
FIX: pretty text allow list (#10977)
Reword whitelist to allowlist in pretty-text.
This library is used by plugins so we need deprecation notice.
2020-10-28 13:22:06 +11:00
Penar Musaraj 12724ac6e4
FIX: iPad DiscourseHub app layout issues (#11048)
- fixes height of user dropdown menu
- fixes offset when jumping to a post
- removes landscape-specific CSS padding (following a fix in the app repo)
2020-10-27 15:12:24 -04:00
jbrw 35cfca1f3f
FIX: Hide delete button if user cannot delete and/or flag a post (#11045)
* FIX: Hide delete button if user cannot delete and/or flag a post

* Move canFlag conditional
2020-10-27 13:02:31 -04:00
Robin Ward e634513568 Move `click` and `fillIn` to imports
Previously they were global functions.
2020-10-27 08:55:56 -04:00
Joffrey JAFFEUX 5fc239b535
FIX: converts html to text to use it as title attribute (#11009) 2020-10-27 11:05:10 +01:00
Kris 863f86c3a3
FIX: adjust user card position, follow-up to da5841d (#11036) 2020-10-27 12:35:18 +11:00
Robin Ward 1e4c0d1857 Remove more global variables from tests.
* Use `sinon` instead of `sandbox` and require an import.
* You need to import `currentURL` to use it.
2020-10-26 13:32:11 -04:00
Arpit Jalan 5ce006aea1
UX: prioritize "invite by link" option (for staff users) (#11028)
UX: update locale for single/multiple invites tab
2020-10-26 21:59:17 +05:30
Robin Ward f2a17feb3a Use response helper
These tests were using a much more verbose API. `response` is much
simpler.
2020-10-26 12:14:36 -04:00
Robin Ward e246208756 Add new `cloneJSON` method for cloning an object
This is useful in tests where `deepMerge` would retain references to old
objects.
2020-10-23 14:48:05 -04:00
Penar Musaraj 6f5d8cad51
UX: Move category editing/creation to its own page (#10973)
* Move new/edit category modals to its own page

* Fix JS tests

* Minor fixes to new-category UI

* Add mobile toggle

* Use global pretender endpoint so plugins can benefit too

* Alignment fix

* Minor review fixes

* Styling refactor

* Move some SCSS out of the modal
2020-10-23 12:49:02 -04:00
Robin Ward 3b8220cb3b FIX: State is leaking between tests, causing flakey failures
It seems `deepMerge` sometimes keeps references around. This code
performs a true copy and fixes the issue.
2020-10-23 10:33:06 -04:00
Roman Rizzi c0848a5cc4
FIX: Only include last_posted_at if there's a topic_user object. (#11011)
Trying to include this attribute when topic_user is nil causes an error when visiting a topic as anon. Additionally, we don't display the slow mode banner for these users.
2020-10-23 11:31:59 -03:00
Jordan Vidrine f85f5eb179
FIX: Add check for youtube thumbnail (#11000)
This commit adds a check for the youtube thumbnail class when enforcing max-image-dimensions.
2020-10-23 08:40:49 -05:00
Robin Ward 919f488358 REFACTOR: All remaining acceptance tests converted to new format
Also contains fixes to leaky state in pretender.
2020-10-23 09:28:13 -04:00
Joffrey JAFFEUX 281bf0b345
FIX: optimizes sk body position in RTL mode (#10997) 2020-10-22 16:08:11 +02:00
David Taylor 85f827ee1c
UX: Remove forgot password button from login-preferences (#10998)
Showing this button is confusing for sites which are using external authentication. Clicking 'log in' already pops up the login modal, which includes a forgot password link when appropriate.
2020-10-22 14:34:10 +01:00
Martin Brennan 0d63eb4124
FEATURE: Add detection of post date to use in bookmark modal (#10981)
This PR introduces a feature that will detect a date inside the post that a user is bookmarking, and offer that date as an option in the bookmark modal.

The logic is that we get the first date/time detected in the post. If it does not have a time, just a date, then we default to 8:00am for the time.
2020-10-22 16:23:46 +10:00
Sam 7b3b05f229
FEATURE: CTRL-SHIFT-ENTER and SHIFT-Click do not scroll on post (#10965)
This allows for an advanced feature where hitting control on click or
CTRL-SHIFT-ENTER will lead to a post being made but the browser not to
scroll to the end.
2020-10-21 08:55:58 +11:00
Bianca Nenciu 94cbfa92e1
FEATURE: Show a placeholder instead of videos in preview (#10962)
Adding a video in composer and then continuing to type into it will make the
video element flicker and restart playback on every keystroke, as the preview
is rendered. In certain configurations, this can lead to some performance
problems too.

Onebox already does the same for external videos.
2020-10-20 19:01:32 +03:00
Robin Ward a65b426b8a REFACTOR: Convert many more acceptance tests to the new format 2020-10-20 11:08:12 -04:00
Robin Ward b3b9cf7c5d REFACTOR: New format for acceptance tests
This gets us closer to how newer Ember versions want to do things, but
with a bit of Discourse flair.

`acceptance` now takes a function as a parameter, and tests need to be
declared in that new function context.

A new helper, `needs`, is passed as a parameter. You can use it to set
up the test the way you want.
2020-10-20 11:08:12 -04:00
Roman Rizzi fbb1fb9270
FIX: Ensure slow mode duration is correctly edited and displayed. (#10945)
* FIX: Ensure slow mode duration is correctly edited and displayed.

This commit fixes a bug where you were forced to set hours, minutes, and seconds or you won't be able to set the slow mode. Also, the duration was not displayed correctly due to the seconds not being truncated.

Additionally, we'll always display the hours, minutes, and seconds inputs for clarity and remove the blue banner.

* Set slow mode modal tweaks.

Uses labels instead of placeholders.
Input fields only visible when custom option selected.
Replace "Custom Duration" with "Pick Duration".

Additionally, place the `Set slow mode` button at the bottom of the topic actions menu.

* Perform the slow_mode validation also on the client-side before saving trying to save the post. This way, the post won't be staged.
2020-10-20 06:52:03 -03:00
Kris da5841de0b
REFACTOR: Remove position fixed from the header and use sticky instead (#10781)
This removes fixed positioning from d-header and the topic timeline.

Plugins, themes and components that use the above/below header plugin outlet will likely need some margin/padding adjustments.
2020-10-19 17:26:38 -04:00
jbrw a74805d3f8
FIX: moderators can add/remove group owners (#10960)
If `SiteSetting.moderators_manage_categories_and_groups` is enabled, a moderator shoud be able to add/remove group owners.
2020-10-19 16:30:21 -04:00
Robin Ward 5597aeb1b9 Revert "FEATURE: CTRL-SHIFT-ENTER and SHIFT-Click do not scroll on post (#10939)"
This broke "composePrivateMessage" (and possibly others) because `d-button` now passes the event as a
second argument, and that action has an optional second argument.
2020-10-19 14:07:35 -04:00
Arpit Jalan 6051a3da68
FIX: enable "remove tags" button only when tagging is enabled (#10957)
UX: remove tags button does not qualify to be a danger button
2020-10-19 22:08:11 +05:30
Sam c8e0547bcc
FEATURE: CTRL-SHIFT-ENTER and SHIFT-Click do not scroll on post (#10939)
* FEATURE: CTRL-SHIFT-ENTER and SHIFT-Click do not scroll on post

This allows for an advanced feature where hitting control on click or
CTRL-SHIFT-ENTER will lead to a post being made but the browser not to
scroll to the end.
2020-10-19 17:21:50 +11:00
Gerhard Schlager 1ac010db3c
FIX: "Sorry an error has occurred" was shown when flagging a post (#10948) 2020-10-18 13:47:54 +02:00
Roman Rizzi 1ff45dc194
FIX: Only TL4 users and staff should be able to see the disable slow mode button (#10942) 2020-10-16 17:52:31 -03:00
Roman Rizzi 21c53ed249
FEATURE: Topic slow mode. (#10904)
Adds a new slow mode for topics that are heating up. Users will have to wait for a period of time before being able to post again.

We store this interval inside the topics table and track the last time a user posted using the last_posted_at datetime in the TopicUser relation.
2020-10-16 16:24:38 -03:00
Robin Ward b460a6d059 REFACTOR: Continue to converge on what Ember CLI wants us to do
* The creation of a testing div is specific to Rails, so that is
moved back out of setupTests();

* We've removed the `Discourse` globals from the acceptance helpers in favor of
`setApplication`/`getApplication`.

* We pass the container to setupTests because there is no
`__container__` in later Ember versions.

* `App` is now `app` because it's not a constant or class, it's an
instance of an application.
2020-10-16 10:53:13 -04:00
Gerhard Schlager 7adf71a203
Fix i18n issues reported on Crowdin (#10925)
* Pluralize `discourse_narrative_bot.dice.not_enough_dice`
  The number of dice requires a pluralized string.
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/278/en-ar#51346

* Always use "two-factor" instead of "second factor" or "two factor"
  Using different terms for the same thing is quite confusing.
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-nl#40096

* Remove whitespace before ellipsis for consistency
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-nl#53978

* Remove unused strings from locale file

* Correct grammar in `site_settings.review_media_unless_trust_level`
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#54018

* Correct grammar in `reviewables.reasons.contains_media`
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#54020

* Correct grammar in user notifications
  It also adds a link to the /about page in order to give the user a clue who the site admins are.
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#54084

* Use "log in" instead of "login" when it's a verb
  This fixes multiple issues:
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-nl#40940
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#47858
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#49458

* Replace "Github" with "GitHub"

* Remove "discourse.org" from title of 503 error page

* Replace weirdly formatted multi line string

* Pluralize `js.composer.group_mentioned_limit`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41158

* Remove unused string and pluralize `js.topic.feature_topic.confirm_pin_globally`
  This kinda fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42114 as `js.topic.feature_topic.confirm_pin` wasn't used anymore.

* Pluralize `js.user.second_factor_backup.remaining_codes`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40054

* Pluralize `js.composer.error.tags_missing`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41184

* Pluralize `js.post.errors.too_many_dragged_and_dropped_files`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42408

* Remove unused `js.posts_long` and `js.likes_long`
  This fixes the following issues in an unexpected way:
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42974
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42994

* Pluralize `js.bootstrap_mode_enabled`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#38726

* Remove unused `long_form` from `post_action_types`
  This more or less fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-ar#47158

* Pluralize `js.presence.replying` and `js.presence.replying`
  This fixes the following issues:
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/282/en-ar#51588
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/282/en-ar#51590

* Pluralize `js.user.second_factor_backup.manage`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40044

* Stop using concatenated strings for "Recently Used Devices"
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40308

* Pluralize `js.category_row.topic_count`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41056

* Pluralize `js.select_kit.invalid_selection_length`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41072

* Pluralize `js.notifications.membership_request_consolidated`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41416
2020-10-16 15:24:58 +02:00
Bianca Nenciu 43e52a7dc1
DEV: Remove gifsicle dependency (#10357)
Dependency on gifsicle, allow_animated_avatars and allow_animated_thumbnails
site settings were all removed. Animated GIF images are still allowed, but
the generated optimized images are no longer animated for those (which were
used for avatars and thumbnails).

The added 'animated' is populated by extracting information using FastImage.
This field was used to selectively reoptimize old animations. This process
happens in the background.
2020-10-16 13:41:27 +03:00
Sam 14cb587b7e
PERF: don't ask for new posts while loading new posts (#10937)
Previous to this change we had no protection to ensure we wait on a request
for more posts prior starting another request.

In outlier cases if 10 people post at the same time on a topic a flood of
requests could start.

To improve this situation we now ensure that we are done asking for new posts
prior to asking for the next batch.

Also addresses some style issues raised previously and moves init to top
of class.
2020-10-16 10:51:58 +11:00
Sam 110e9a455b
FEATURE: when we fail to ship topic timings attempt to retry (#10916)
* FEATURE: when we fail to ship topic timings attempt to retry

This change amends it so

1. Topic timings are treated as background requests and subject to more
 aggressive rate limits.

2. If we notice an error when we ship timings we back off exponentially

The commit allows 405, 429, 500, 501, 502, 503 and 504 errors to be retried.

500+ errors usually happen when self hosters are rebuilding or some other
weird condition.

405 happens when site is in readonly.
429 happens when user is rate limited.

The retry cadence is hardcoded in AJAX_FAILURE_DELAYS, longest delay is
40 seconds, we may consider enlarging it.

After the last delay passes we give up and do not write timings to the
server.

* Address feedback

- Omit promise, no need to use promises in sendNextConsolidatedTiming
- Correct issue where >= -1 was used and > -1 was intended
- Use objects for consolidated timings instead of Array
- Stop using shift/unshift and instead use push / pop which are faster

* Move consolidated timing initialization to constructor

* Remove TODO and just console.warn if we have an issue
2020-10-16 09:49:55 +11:00
Jeff Wong e9eeea26b2
DEV: rewrite _penalize without async (#10935)
* DEV: rewrite _penalize without async

async is not yet supported in object methods due to uglifyjs.
2020-10-15 11:48:13 -07:00
Jeff Wong d68ad82a9e
FEATURE: add penalty options for take action (#10926)
* FEATURE: add penalty options for take action

Add the ability to silence or suspend users from the "take action"
button when moderators are flagging posts. This allows for a more streamlined
active moderation workflow, when moderating against a topic directly.
2020-10-15 10:48:52 -07:00
Joffrey JAFFEUX e062b94e7f
REFACTOR: merges redirectTo implementation into one function (#10919) 2020-10-15 19:26:05 +02:00
Robin Ward 51d10db7f2 REFACTOR: Import `visit` helper rather than using a global variable 2020-10-15 13:22:05 -04:00
Joffrey JAFFEUX da00c80e90
FIX: styleguide is only a parent url and is accessed with /styleguide (#10930) 2020-10-15 11:06:37 +02:00
Jordan Vidrine e8ebaad771
FIX: Check for link target attribute on link clink (#10923)
* FEATURE: Add ability to add target to link

This commit will add the ability for a link's target attribute to be specified.

Allowing`target: "_blank"` to work properly.
2020-10-14 15:01:39 -05:00
jbrw 099bf97dca
Tag groups can belong to groups (#10854) 2020-10-14 13:15:54 -04:00
Jordan Vidrine e22370a8e1
FEATURE: Add category slug to body class on tag pages if it is part of a category (#10911)
This commit will add the category slug class to the body if the tag is a child of a category.

Currently, when visiting a tag topic list only the tag name is added to the body class.
2020-10-14 11:52:45 -05:00
Joffrey JAFFEUX 73d207a568
DEV: load styleguide assets only when needed (#10918) 2020-10-14 16:29:40 +02:00
Penar Musaraj 2b5ca8af12
FIX: Wizard theme preview when logo is missing (#10914)
Fixes empty theme previews in the wizard, a bug introduced by yours
truly in a4356b99af
2020-10-13 20:06:09 -04:00
Justin DiRose 8c77b84aac
Revert "FEATURE: Upgrade analytics.js to gtag.js (#10893)" (#10910)
Reverting due to a few unforseen issues with customizations.
2020-10-13 12:20:41 -05:00
Justin DiRose f4034226c2
FEATURE: Upgrade analytics.js to gtag.js (#10893)
Per Google, sites are encouraged to upgrade from `analytics.js` to `gtag.js` for Google Analytics tracking. This commit updates core Discourse to use the new `gtag.js` API Google is asking sites to use. This API has feature parity with `analytics.js` but does not use trackers.
2020-10-13 11:24:06 -05:00
Mark VanLandingham b19e8ea206
FIX: Error messages from editing user being swallowed (#10908) 2020-10-13 10:37:33 -05:00
Bianca Nenciu 25b8ed740b
DEV: Make site setting type uploaded_image_list use upload IDs (#10401)
It used to be a list of concatenated upload URLs which was prone to
break.
2020-10-13 16:17:06 +03:00
Joffrey JAFFEUX a73fd4227f
FIX: disabled option for sk was not working correctly (#10900)
Name was incorrect and it was only removing cursor events and not changing style.
2020-10-13 11:31:07 +02:00
Sam 32393f72b1
PERF: backoff background requests when overloaded (#10888)
When the server gets overloaded and lots of requests start queuing server
will attempt to shed load by returning 429 errors on background requests.

The client can flag a request as background by setting the header:
`Discourse-Background` to `true`

Out-of-the-box we shed load when the queue time goes above 0.5 seconds.

The only request we shed at the moment is the request to load up a new post
when someone posts to a topic.

We can extend this as we go with a more general pattern on the client.

Previous to this change, rate limiting would "break" the post stream which
would make suggested topics vanish and users would have to scroll the page
to see more posts in the topic.

Server needs this protection for cases where tons of clients are navigated
to a topic and a new post is made. This can lead to a self inflicted denial
of service if enough clients are viewing the topic.

Due to the internal security design of Discourse it is hard for a large
number of clients to share a channel where we would pass the full post body
via the message bus.

It also renames (and deprecates) triggerNewPostInStream to triggerNewPostsInStream

This allows us to load a batch of new posts cleanly, so the controller can
keep track of a backlog

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2020-10-13 16:56:03 +11:00
jbrw ac31fe8321
FEATURE - SiteSetting to disable user option to hide their profiles and presences (#10885)
* FEATURE - SiteSetting to disable user option to hide their profiles and presences
2020-10-09 17:18:44 -04:00