Commit Graph

16040 Commits

Author SHA1 Message Date
Robin Ward 75e92e1bd7 REFACTOR: The Favcount library needs global variables
This moves the library into our lib folder, and refactored it to more
modern Javascript. I've kept the MIT license at the top of the file.

Doing this allows us to import it as a library in Ember CLI and ditch
yet another global variable.
2020-11-17 15:04:17 -05:00
Robin Ward 410214e5a9 FIX: In newer embers, it's `triggerKeyEvent` not `keyEvent` 2020-11-17 14:46:23 -05:00
Mark VanLandingham 504aaad838
DEV: New plugin-outlet under preferences interface nav (#11266) 2020-11-17 12:36:17 -06:00
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
Paweł Kowalski 8619c1fd47 Optimize assets/images 2020-11-17 09:53:33 -05: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
Kris 2cb2f864d4
Remove extra padding, follow-up to 8be04ff (#11258) 2020-11-16 23:10:03 -05:00
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
Arpit Jalan b81326a7dd
UX: draft delete button was looking odd on user stream (#11232) 2020-11-13 17:21:06 +05:30
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
Kris 694c7f2c98
reduce min-width for better spacing, follow-up to 1455421 (#11177) 2020-11-09 17:05:09 -06: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
Kris 8be04ff7f7
UX: Give furigana and other top-overflowing elements a little space (#11154) 2020-11-09 16:03:36 +11:00
Kris 4c0d027a5a
UX: truncate long nav items in dropdown menu (#11156) 2020-11-09 16:02:40 +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
Jordan Vidrine d384e744a8
UI: Fix button overlapping longer group names in group card (#11104)
This commit fixes the group buttons from overlapping long group names in the group card.
2020-11-03 09:37:26 -06: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
Vinoth Kannan 347423007a
DEV: remove instagram login site settings and auth classes. (#11073)
Instagram removed the support for login and should use Facebook login instead.
2020-10-30 09:09:56 +05:30
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