Commit Graph

57 Commits

Author SHA1 Message Date
Loïc Guitaut
f7c57fbc19 DEV: Enable unless cops
We discussed the use of `unless` internally and decided to enforce
available rules from rubocop to restrict its most problematic uses.
2023-02-21 10:30:48 +01:00
Ted Johansson
25a226279a
DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893)
The #pluck_first freedom patch, first introduced by @danielwaterworth has served us well, and is used widely throughout both core and plugins. It seems to have been a common enough use case that Rails 6 introduced it's own method #pick with the exact same implementation. This allows us to retire the freedom patch and switch over to the built-in ActiveRecord method.

There is no replacement for #pluck_first!, but a quick search shows we are using this in a very limited capacity, and in some cases incorrectly (by assuming a nil return rather than an exception), which can quite easily be replaced with #pick plus some extra handling.
2023-02-13 12:39:45 +08:00
Daniel Waterworth
666536cbd1
DEV: Prefer \A and \z over ^ and $ in regexes (#19936) 2023-01-20 12:52:49 -06:00
David Taylor
6417173082
DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
Gerhard Schlager
c75b6cd999
UX: Update "education.dominating_topic" and raise default percentage (#19154)
See /t/82396
2022-11-22 21:11:53 +01:00
Arpit Jalan
2ee721f8aa
FEATURE: add composer warning when user haven't been seen in a long time (#18340)
* FEATURE: add composer warning when user haven't been seen in a long time

When a user creates a PM and adds a recipient that hasn't been seen in a
long time then we'll now show a warning in composer indicating that the
user hasn't been seen in a long time.
2022-09-27 22:06:40 +05:30
Bianca Nenciu
ff367e22fb
FEATURE: Make allow_uploaded_avatars accept TL (#14091)
This gives admins more control over who can upload custom profile
pictures.
2021-08-24 10:46:28 +03:00
Kris
bde6f7e9b0
UX: Update "get a room" composer message (#14104) 2021-08-23 18:34:23 -04:00
Arpit Jalan
c481f2ce16
UX: do not show selected composer education messages on whisper post (#14078)
This commit disables the "sequential_replies" and "duplicate_link"
education message on composer when creating a whipser post.
2021-08-19 09:32:32 +05:30
Kris
5f6b9e36ed
UX: New text and style for dominating topic message (#13789) 2021-07-20 13:58:38 -04:00
Mark VanLandingham
1d85574d52
FIX: Don't show the get a room composer message in private categories (#12702) 2021-04-14 12:34:13 -05:00
David Taylor
821bb1e8cb
FEATURE: Rename 'Discourse SSO' to DiscourseConnect (#11978)
The 'Discourse SSO' protocol is being rebranded to DiscourseConnect. This should help to reduce confusion when 'SSO' is used in the generic sense.

This commit aims to:
- Rename `sso_` site settings. DiscourseConnect specific ones are prefixed `discourse_connect_`. Generic settings are prefixed `auth_`
- Add (server-side-only) backwards compatibility for the old setting names, with deprecation notices
- Copy `site_settings` database records to the new names
- Rename relevant translation keys
- Update relevant translations

This commit does **not** aim to:
- Rename any Ruby classes or methods. This might be done in a future commit
- Change any URLs. This would break existing integrations
- Make any changes to the protocol. This would break existing integrations
- Change any functionality. Further normalization across DiscourseConnect and other auth methods will be done separately

The risks are:
- There is no backwards compatibility for site settings on the client-side. Accessing auth-related site settings in Javascript is fairly rare, and an error on the client side would not be security-critical.
- If a plugin is monkey-patching parts of the auth process, changes to locale keys could cause broken error messages. This should also be unlikely. The old site setting names remain functional, so security-related overrides will remain working.

A follow-up commit will be made with a post-deploy migration to delete the old `site_settings` rows.
2021-02-08 10:04:33 +00:00
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