Commit Graph

24 Commits

Author SHA1 Message Date
Ted Johansson 7228882378
FIX: Don't error out on non-stringy tags parameter (#180)
We're expecting the tags parameter to be a string. But the client can send an array or a nested parameter (thanks to the Rack protocol.) We're seeing exceptions in logs where the application is erroring out because of this.

As of this commit we raise a Discourse::InvalidParameters exception if we get a non-stringy tags parameter.
2024-10-21 14:13:21 +08:00
Bianca Nenciu e90a3193df
FIX: Load complete category objects (#167)
Not all categories are preloaded when lazy_load_categories is enabled.
In this case, the category objects that are loaded through /docs.json
must be complete.
2024-04-04 10:23:42 +03:00
Loïc Guitaut 3e7b7c4061
DEV: Fix new Rubocop offenses (#166) 2024-02-29 18:14:03 +01:00
Jean d4ab4080db
FEATURE: add setting to show tags by group (#138)
* FEATURE: add setting to show tags by group
2023-06-09 11:02:17 -04:00
David Taylor 724100044c
DEV: Introduce syntax_tree for ruby formatting (#118) 2022-12-29 13:31:34 +01:00
Penar Musaraj b23790e85d
UX: Expand category filters even when already filtered (#112) 2022-11-28 15:16:24 -05:00
Frank 6b3f2576c3
FEATURE: add a global setting to support custom docs url path (#107)
* FEATURE: add a global setting to support custom docs url path

This commit adds a GlobalSetting `docs_path` to support custom docs url
path for sites that do not want docs page to live at `/docs` and have a
customized path.

* Fixed the route declaration

* Test and linting

* Update server.en.yml

* Fixed doc test

* Fixed linting.

* Testing qunit test fix

* Fixed tests

* Prettified tests

* Changed the implementation from SiteSetting to GlobalSetting instead.

* Fixed tests

* Cleanup

* Using Site instead of .js.erb to pass GlobalSetting.docs_url to the front end.

Also fixed front end tests

* Remove references to obsolete site setting

* remove unused fixture file

* Rename `docs_url` to `docs_path` and use camelCase in JavaScript

* Add serializer tests

Co-authored-by: Arpit Jalan <er.ajalan@gmail.com>
2022-11-17 11:33:38 +05:30
David Taylor d941844fa8
DEV: Bump rubocop-discourse (#106)
* DEV: Bump rubocop-discourse

* Fix rubocop violations
2022-10-03 22:20:09 +02:00
Bianca Nenciu 45386920ca
FIX: Use new robots.txt API (#101)
The old robots.txt was invalid because "User-agent: *" was found twice
in robots.txt. Using the API will generate correct robots.txt.
2022-07-13 19:53:56 +03:00
Krzysztof Kotlarek 7c54952414
FIX: TopicViewItem and TopicUser for doc topics (#80)
When a documentation topic is viewed, corresponding TopicViewItem and TopicUser should be created.

A method from a TopicController is called, however, specs should warn us if ever that core method would change.
2022-02-01 16:38:54 +11:00
Krzysztof Kotlarek 72cdd8d415
FIX: ignore category filter when incorrect param (#59)
Category filter accepts ids of categories. If value is manipulated, we should ignore it.
2021-09-27 14:52:27 +10:00
Justin DiRose f32aebdba0
FEATURE: Rename from Knowledge Explorer to Docs (#27)
After internal discussion, the team decided to rename this plugin to `discourse-docs`. No substantial changes made here aside from a settings migration.
2021-01-18 10:38:09 -06:00
Justin DiRose 63a8181fa4
FIX: Results count not always properly shown (#21)
There was a weird case where when filtering topics by solved status did not properly show the count of filtered topics. I took this opportunity to lightly refactor the backend. There was a duplicate size operation when we searched and when calculating pagination. I've eliminated the second size call and refactored the front end to be a little bit simpler while solving the bug.
2020-12-01 13:51:42 -06:00
Krzysztof Kotlarek ab66d70fdd
FIX: flaky order in spec (#16)
In Spec we were creating two topics:
```ruby
  fab!(:topic) { Fabricate(:topic, category: category) }
  fab!(:topic2) { Fabricate(:topic, category: category) }
```

Because we didn't set title explicitly it was using sequence from Fabricator
```ruby
  title { sequence(:title) { |i| "This is a test topic #{i}" } }
```

If you have two titles `This is a test topic 9` and `This is a test topic 10` Spec testing if topics are sorted will fail. Therefore, we should explicitly set topic title when creating test instances to avoid that randomness.
2020-11-05 14:48:02 +11:00
Justin DiRose 6e974250f9
FIX: Sort query was ambiguous (#15)
After implementing changes to tagging, this introduced ambiguity in the SQL query for sorting by activity. This commit fixes the ambiguity by explicitly defining the table from where the columns are used. Also adds tests to check for regressions in the future.
2020-11-04 16:46:55 -06:00
Justin DiRose 7959355159
FIX: Query name collision with multiple filters (#12)
If using more than two tags to filter, we'd run into an SQL alias
collision on a few joins. Resolved by ensuring unique names are used across the query.
2020-10-14 09:27:19 -05:00
Justin DiRose 22c2387b76
FIX: Topics not always properly shown (#11)
There was a bug with the logic in how we were checking for matching tags
and categories in KE settings. If only tags were set, topics would not
show.
2020-10-13 10:32:22 -05:00
Justin DiRose 0e1c7c7216
FEATURE: Add onebox metadata (#10)
Currently linking directly to Knowledge Explorer topics shows a generic onebox, which isn't super helpful in some cases.

This commit mimics how the theme creator plugin handles adding metadata to special occurrences. However, to get this to work, how the plugin handles showing topic contents needed to be refactored. Instead of hitting the existing topic route, the plugin implements its own version of this, including adding restrictions for topics that are not in a selected Knowledge Explorer category or tag.
2020-10-01 09:32:28 -05:00
Justin DiRose 14861e3321
FEATURE: Move route to /docs
After further discussion about the route, we landed on /docs as a better
choice. This commit makes that change.
2020-07-14 10:07:18 -05:00
Justin DiRose 25ca793555
FEATURE: Move to '/e'
'/knowledge-explorer' was proving a bit too verbose, so we're changing
it to '/e'. The former route should redirect to the new one.
2020-07-13 10:23:21 -05:00
Sam Saffron 80da6a5620 FEATURE: search entire knowledge base body as well as title
Previously search was only searching through the title of topics

This introduces full text search.

It also means we get automatic stemming which gives far better results.
2020-02-07 11:53:13 +11:00
Justin DiRose 10ec8b47a8 FEATURE: Category filtering 2019-11-06 11:27:30 -06:00
Justin DiRose a34e4468c1
REFACTOR: Handle queries in more robust, customizable way
* Create custom query lib file

* Get topic list by category

* Get topic list with both categories and tags

* Count tags and pass back to controller in object

* Filter topic list by param-passed tag list

* FIX: Correctly serialize topic list data

* Filter results by search term (title only

* Debug commit

* Working multi-tag filtering

* FIX: case insensitive search terms

* Begin refactor of front end for new api changes

* REFACTOR: Use model for refreshing data
Instead of just using a route, which introduces full page refreshes, use
the route to pull the data initially, then update it using a model as to
refresh only the relevant parts of the page.

* Working topic load

* FIX: Visual alignment

* Refactor tests to follow new patterns

* Fixes suggested by eviltrout

* FEATURE: Load more topics

* FIX: Paginate records on return to the front end in a better fashion

* FIX: Prevent loadMore while loading more

* Fix pagination of topics to truncate list properly

* Inherit rubocop from discourse

* Make rubocop happynated

* Set list to unordered
2019-10-31 15:09:50 -05:00
Justin DiRose 5d0da1fe0a Spec tests & minor refactors 2019-10-02 16:24:40 -05:00