Commit Graph

45 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
Sam Saffron e2bcf55077 DEV: move send => public_send in lib folder
This handles most of the cases in `lib` where we were using send instead
of public_send
2019-05-07 12:25:44 +10:00
tshenry 48d0465f72 FEATURE: Improve avatar education link (#7240)
* Make profile_path more direct to setting

* Add id to profile picture setting for easy linking
2019-03-22 02:20:48 -07:00
Gerhard Schlager 24e5be3f0c FIX: Relative links in translations should work with subfolder 2018-11-08 23:31:05 +00:00
Lucas Nicodemus 1907338834 FIX: No longer educate users who are editing
A user editing a post will no longer get composer messages that are
meant for new users posting replies and threads. These messages don't
make sense in an edit context at all -- they're usually discussing
making salient replies or topics, or adding avatars. They make even less
sense when a user is an admin attempting to change the default topics
for the first time.

Since these messages actually do make sense for a user when they have a
low post count, though, they're still going to occur. They just occur
when a user is creating new content (and thus, more likely to read the
notice), not during edits.

This is in response to this issue:
https://meta.discourse.org/t/education-message-for-editing-wiki-topic/66682
2018-10-04 13:20:13 +08:00
Régis Hanol 272646c1df FIX: only show the sequential replies warning for regular posts 2018-07-04 22:51:19 +02:00
Guo Xiang Tan ad5082d969 Make rubocop happy again. 2018-06-07 13:28:18 +08:00
Guo Xiang Tan 2f65393706 REFACTOR: Use `Topic#private_message?` to reduce duplication. 2018-03-05 15:39:22 +08:00
Arpit Jalan 7b4e6d508b improve reviving_old_topic education message 2018-01-26 00:06:53 +05:30
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Robin Ward 14410b71fb Convert server side paths to use `/u/` 2017-03-30 10:23:24 -04:00
Robin Ward d27575176a Enforce a minimum amount of posters in a topic for `get_a_room` 2017-02-28 16:47:16 -05:00
Robin Ward cfc0cc936f FIX: Get a room wasn't enforcing sequential properly 2017-02-19 16:00:28 -05:00
Robin Ward 5a4c393231 UX: Include the username and link of the user for get_a_room 2017-02-08 15:27:07 -05:00
Robin Ward f1e7bca3c9 FEATURE: Warn a user when they're replying to the same user too much 2017-02-03 17:00:54 -05:00
Guo Xiang Tan 857986e2c0 FIX: Don't change return value to blank string. 2016-11-09 11:13:56 +08:00
Guo Xiang Tan 9fd317306c FIX: Do not show educational message for PMs. 2016-11-04 17:06:53 +08:00
Robin Ward 431179dd25 FEATURE: Prompt users when they are entering duplicate links 2016-06-07 14:47:22 -04:00
Robin Ward 6aaa484baa REFACTOR: Move composer messages to store 2016-06-07 14:47:22 -04:00
Arpit Jalan e65a7370ef FIX: disable avatar education message when 'allow_uploaded_avatars' is
disabled
FEATURE: setting to disable avatar education message
2015-12-14 22:47:35 +05:30
Arpit Jalan dd8b773059 UX: use pastel blue background for topic education pop-ups 2015-12-04 09:19:55 +05:30
Robin Ward c4eee825de FIX: Missing site name key 2015-11-27 17:23:43 -05:00
Robin Ward 7181e3cb75 FIX: Missing new education keys 2015-11-27 17:00:43 -05:00
Régis Hanol 540933dce3 don't notify users about sequential replies in messages 2015-11-27 19:29:44 +01:00
Robin Ward 5e93140f85 FEATURE: Can override any translation via an admin interface 2015-11-27 11:35:19 -05:00
Arpit Jalan 3eb0288adb UX: reviving old topic popup should not have red warning background 2015-11-25 16:31:17 +05:30
Régis Hanol c57a1b393f clean up 'checked_for_custom_avatars' user history entries 2015-01-02 12:37:17 +01:00
Robin Ward bc53d48bd7 Renaming site contents to site text 2014-09-24 16:08:14 -04:00
Sam 59d04c0695 Internal renaming of elder,leader,regular,basic to numbers
Changed internals so trust levels are referred to with

TrustLevel[1], TrustLevel[2] etc.

This gives us much better flexibility naming trust levels, these names
are meant to be controlled by various communities.
2014-09-05 15:20:52 +10:00
Robin Ward a188ba77dc FIX: Don't raise an exception when `last_posted_at` is nil 2014-06-23 11:38:27 -04:00
Robin Ward 449f81785f FIX: If there is no `last_posted_at` don't raise an exception 2014-06-23 11:38:27 -04:00
Sam 6c1c8be794 Work in progress, keeping avatars locally
This introduces a new model to store the avatars and 3 uploads per user (gravatar, system and custom)

user can then pick which they want.
2014-05-27 10:08:03 +10:00
Louis Rose 1574485443 Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
2014-05-06 14:41:59 +01:00
riking dc230cb7e4 Only warn about necromancy when replying 2014-03-19 17:04:42 -07:00
Neil Lalonde 659e7fa4ce FEATURE: Warn when reviving a topic that has been inactive for X days. Setting warn_reviving_old_topic_age controls when the warning is shown. Set it to 0 to disable this feature. 2014-03-12 10:44:12 -04:00
riking e0063920b7 Style 'urgent' composer popups differently
The two "bad behavior" composer popups get the 'urgent' class, which colors them red.
2014-03-06 15:35:47 -08:00
Vikhyat Korrapati 2f38316bfc Don't notify about dominating private messages. 2014-02-07 05:49:45 +05:30
Robin Ward 1cac9fa257 New users can only post `newuser_max_replies_per_topic` times per topic. 2013-12-19 13:45:55 -05:00
Robin Ward 4ce81e1b01 Rename "Best Of" to "Summary" 2013-11-18 12:48:26 -05:00
Robin Ward 99b6a62fcb New composer message for people dominating a topic 2013-09-17 14:38:39 -04:00
Robin Ward 16dc0a7001 New user education notification was off by one. Also, remove the "basic" restriction on the
"posting too often" message.
2013-09-17 12:12:03 -04:00
Robin Ward b39d39dbb6 FIX: Use `post_count` instead of `topic_reply_count` in education for replies. 2013-09-14 00:32:18 -04:00
Robin Ward c365bd0070 Notify users posting sequential replies that there's a better way to do it. 2013-09-13 13:49:34 -04:00
Robin Ward 7d9a84b496 New User Education goes through a server side ComposerMessages check. Composer message for users
who don't have avatars.
2013-09-13 12:23:53 -04:00