Commit Graph

21 Commits

Author SHA1 Message Date
Daniel Waterworth 55a1394342 DEV: pluck_first
Doing .pluck(:column).first is a very common pattern in Discourse and in
most cases, a limit cause isn't being added. Instead of adding a limit
clause to all these callsites, this commit adds two new methods to
ActiveRecord::Relation:

pluck_first, equivalent to limit(1).pluck(*columns).first

and pluck_first! which, like other finder methods, raises an exception
when no record is found
2019-10-21 12:08:20 +01: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 1d649e147b FEATURE: show avatar flair on group, badges and directory pages (#6732) 2018-12-06 12:18:52 +01:00
Régis Hanol 131b7f5da5 make 🤖 rubocop happy 2018-05-16 16:35:04 +02:00
Joe Buhlig 3cd4c82c49 Allow parameters for group and username filters on directory (#5815) 2018-05-16 16:20:17 +02:00
Gerhard Schlager 92a831bae6 FEATURE: user directory returns staged users during search 2017-11-19 01:17:31 +01:00
Guo Xiang Tan 77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Guo Xiang Tan 91d3929f52 Merge pull request #5078 from lelelelemon/master
change count>0 to exists
2017-08-24 09:24:42 +09:00
junwen yang 8124f26a6e change count>0 to exists 2017-08-23 22:54:51 +00:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Guo Xiang Tan 18d032ad91 PERF: Remove ordering by username.
* Ordering by username results in a very expensive query
for very little upside UX wise.
2016-10-15 01:13:58 +08:00
Sam 736cbf3d2d FEATURE: add parameter that allows you to filter directory items on user
adding ?username= will filter directory_items.json by the username
2015-12-30 15:00:00 +11:00
Robin Ward 82124b3222 UX: Login to decide when to show you near the top of the directory
Don't show yourself there if you are close to the top already.
2015-04-02 14:51:49 -04:00
Robin Ward 2cc5858163 Add site setting to disable User Directory, include restricted info 2015-03-26 11:26:19 -04:00
Robin Ward 33e35930b0 FIX: Server error when no results on user directory while logged in 2015-03-25 11:18:46 -04:00
Robin Ward 8fd339b994 Include the current user at the top AND in the user directory 2015-03-24 16:19:15 -04:00
Robin Ward 051a2a3d14 FEATURE: Can search the user directory by name 2015-03-19 18:07:48 -04:00
Robin Ward 1931850151 UX: Always show the current user at the top of the directory 2015-03-19 15:32:23 -04:00
Robin Ward ae695d6438 UX: Show two lines per user on directory 2015-03-19 14:53:52 -04:00
Robin Ward 7ef306cd3b A bunch of tweaks to the Users directory
- Move user directory from `/directory` to `/users/`
- Defaults to 'weekly' time period
- Don't include deleted topics/posts in the results
- Move heart icon to header instead of on each row
- "Users" instead of "Users found"
2015-03-19 12:29:38 -04:00
Robin Ward 3d2d224312 FEATURE: User Directory, with sorting and time period filter 2015-03-18 15:20:34 -04:00