Commit Graph

71 Commits

Author SHA1 Message Date
Sam Saffron d0d5a138c3
DEV: stop freezing frozen strings
We have the `# frozen_string_literal: true` comment on all our
files. This means all string literals are frozen. There is no need
to call #freeze on any literals.

For files with `# frozen_string_literal: true`

```
puts %w{a b}[0].frozen?
=> true

puts "hi".frozen?
=> true

puts "a #{1} b".frozen?
=> true

puts ("a " + "b").frozen?
=> false

puts (-("a " + "b")).frozen?
=> true
```

For more details see: https://samsaffron.com/archive/2018/02/16/reducing-string-duplication-in-ruby
2020-04-30 16:48:53 +10:00
Justin DiRose 9101227266
FEATURE: Demote muted categories on category list (#9226) 2020-03-17 15:33:15 -05:00
David Taylor 7640914552
UX: Include muted categories on the category page by default (#8842)
* DEV: Add data-notification-level attribute to category UI

* Show muted categories on the category page by default

This reverts commit ed9c21e42c.

* Remove redundant spec - muted categories are now visible by default
2020-02-03 10:40:02 -08:00
Vinoth Kannan ba5b78a348
FEATURE: support to mute all categories by default. (#8295)
Instead of enabling `suppress_from_latest` setting on many categories now we can enable `mute_all_categories_by_default` site setting. Then users should opt-in to categories for them to appear in the latest and categories pages.
2019-11-08 08:28:11 +05:30
Krzysztof Kotlarek 427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +10:00
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Maja Komel 996e5e5dfa FIX: category list order using category featured topics (#7283) 2019-04-25 11:07:19 +02:00
Maja Komel 714a0d87df UX: order categories based on latest activity for all page styles (#7196)
follow up on 32db3ac2
2019-03-19 09:35:32 +01:00
Maja Komel 32db3ac228 UX: order categories based on recent activity when using categories_and_latest_topics layout (#7166) 2019-03-15 17:14:49 +11:00
Saurabh Patel b63b399799 DEV: remove uploaded_meta_id column from category (#6725)
* DEV: remove uploaded_meta_id column from category

* remove uploaded_meta part
2019-01-10 09:37:21 +08:00
Saurabh Patel 9e3143445b DEV:add uploaded_meta option in category for category meta image (#6724) 2018-12-07 16:24:07 +01:00
Penar Musaraj ed9c21e42c FEATURE: hide muted categories from /categories list (#6531) 2018-10-26 11:34:39 +11:00
Guo Xiang Tan ad5082d969 Make rubocop happy again. 2018-06-07 13:28:18 +08:00
Sam 720e1965e3 FEATURE: add category suppress from latest
In the past we used suppress_from_homepage, it had mixed semantics
it would remove from category list if category list was on home and
unconditionally remove from latest.

New setting explicitly only removes from latest list but leaves the
category list alond
2018-02-22 09:56:35 +11:00
Gerhard Schlager 38269c416d FIX: return regular notification level for categories when not set by user 2017-12-30 20:36:58 +01:00
Guo Xiang Tan bd0efb8525 Fix the build. 2017-08-01 17:57:26 +09:00
Guo Xiang Tan 1197750e7d PERF: Allow plugins to preload custom fields for topics in `CategoryList`. 2017-08-01 17:27:28 +09:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Neil Lalonde 262016604d FEATURE: each category can control how many topics to show on categories page 2017-03-01 15:12:57 -05:00
Guo Xiang Tan 9a800107cb FIX: Associate category logo and background to uploads record. 2016-12-12 17:37:28 +08:00
Régis Hanol 4d6028ea2d UX: new 'category_page_style' site setting 2016-08-22 23:01:43 +02:00
Régis Hanol eb953c0904 FIX: /categories page on mobile 2016-08-19 01:47:00 +02:00
Régis Hanol 6d1d7b7c8f UX: new /categories layout 2016-08-17 23:23:16 +02:00
Sam 02002afd3f clean up hack 2016-02-19 17:08:08 +11:00
Sam c230c11707 FEATURE: stop removing empty categories users have access to from /categories page
This is particularly important for heirarchies of categories where a parent is empty

Also, if we hide the blank category, how are we going to create the first topic?

Old behavior was hacky.
2016-02-19 17:03:23 +11:00
Régis Hanol 0de00308af FIX: categories' notification_level wasn't serialized when hitting /categories 2015-09-15 14:58:22 +02:00
Régis Hanol d5a2029026 FIX: category permissions weren't properly loaded when /categories is the homepage
FIX: don't scope to a specific category when creating a new topic from /categories
2015-09-07 18:52:53 +02:00
Régis Hanol a501947d67 FEATURE: suppress categories from the homepage 2015-09-02 20:25:18 +02:00
Neil Lalonde 611b5f996e FIX: unpinned topics shouldn't remain pinned on categories page 2015-06-10 14:36:55 -04:00
Sam 6f7a89dcaa PERF: use preloader trick to load topic categories 2014-11-17 18:03:11 +11:00
Régis Hanol 7f498a8795 FIX: N+1 query on /categories page 2014-09-09 15:32:58 +02:00
Robin Ward 462dcadd01 FEATURE: Subcategory list on parent subcategory page. 2014-07-02 16:47:43 -04:00
Neil Lalonde 2cd55b1fa2 FIX: topics in private sub-categories were visible to everyone on the categories page 2014-06-16 15:12:14 -04:00
Neil Lalonde 68747c8d2d FIX: category_list_spec would sometimes fail. It was passing only by luck. 2014-05-21 10:37:37 -04:00
Neil Lalonde 27cbc06563 Add fixed_category_positions site setting to handle whether categories are ordered by specified positions or by activity. 2014-05-16 11:33:52 -04:00
Neil Lalonde fa4bc90fbb Remove another N+1 query from categories page 2014-03-18 15:24:29 -04:00
Neil Lalonde 5f34a621b5 Revert "Merge pull request #1896 from nickborromeo/category-list" 2014-03-12 16:41:15 -04:00
Nick Borromeo 5104c7365f Refactor find_relevant_topics and find_categories
This breaks down two private methods into smaller methods for
readability. This also moves logic into the Category model class.
2014-03-11 22:16:13 -07:00
Neil Lalonde 46d1c8c1e0 FIX: n+1 queries in CategoryList 2014-02-24 15:07:46 -05:00
Neil Lalonde 89908cdb47 Admins don't see uncategorized on /categories if it has no topics and allow_uncategorized_topics is false 2014-01-15 14:11:36 -05:00
Sam ea307931a7 fix spec, categories without position are now always at the end of the list 2013-12-17 14:36:07 +11:00
Neil Lalonde 341adc93a4 Allow categories with null position, which means sort them based on activity. Mix absolutely positioned (position is not null) categories with null position categories. 2013-12-16 15:13:57 -05:00
Neil Lalonde 50bd05663c Fix category ordering on categories page. I broke it. 2013-12-12 17:13:35 -05:00
Neil Lalonde 6fa2e68742 Show more than one topic per category on the wide categories page. Disable support for the 2-column categories page. The category_featured_topics site setting controls how many topics to show. 2013-12-12 15:52:30 -05:00
Robin Ward b93ca1089e List subcategories on categories page 2013-10-31 18:02:24 -04:00
Sam 666264879c change it so all topics MUST include a category, we store a special uncategorized category to compensate
this cleans up a bunch of internals and removes some settings
2013-10-24 12:08:02 +11:00
Sam 6067795780 categories can now be re-ordered 2013-10-21 15:25:20 +11:00
Sam 6f32cb52d6 minor styling changes, kill n+1 query 2013-10-18 11:23:08 +11:00
Sam 1ee49798b2 work in progress wide category list 2013-10-18 11:10:10 +11:00
Neil Lalonde 24617dd776 Show empty categories with descriptions to everyone 2013-08-22 11:55:20 -04:00