Commit Graph

560 Commits

Author SHA1 Message Date
Navin 3fdba0019b Extract callbacks and validations for Post
Move Post create callbacks to PostCreate
Extract Post validations
Move stripped_length_validator to lib/validators
2013-06-09 20:47:04 +02:00
Robin Ward 26a81b30c2 When rebaking, update the links even if the cooked content didn't change. Someone
might be linking to us even if we don't have a link.
2013-06-08 21:53:33 -04:00
Chris Hunt d741798d9c Add onebox for GitHub pull requests 2013-06-08 11:01:06 -07:00
Sam 63c0c59114 Merge pull request #985 from avdi/clarify-jobs-dissection
Clarify job args dissection using destructuring assignment.
2013-06-07 15:44:34 -07:00
Robin Ward f4d70b922d Merge pull request #986 from chrishunt/fix-local-onebox
Link to category slug instead of name in onebox
2013-06-07 14:23:53 -07:00
Robin Ward b2a6755a48 Merge pull request #984 from Supermathie/moreentropy
More entropy for foreign titles
2013-06-07 14:23:26 -07:00
Chris Hunt 1df5a50324 Link to category slug instead of name in onebox 2013-06-07 12:31:39 -07:00
Robin Ward 463be6fadf Merge pull request #982 from jd-erreape/add_scopes_to_roleable
Added role scopes to roleable
2013-06-07 12:08:26 -07:00
Avdi Grimm 8cdd5d95fc Clarify job args dissection using destructuring assignment. 2013-06-07 15:02:21 -04:00
Michael Brown bb77d2c38b More entropy for foreign titles
* Treat strings with non-ASCII characters as having more entropy
2013-06-07 14:47:07 -04:00
Robin Ward 1056b94b56 Don't apply styling unless the HTML template is active 2013-06-07 12:39:35 -04:00
Robin Ward 1b5ec42173 FIX: Regression where a topic rollback would not properly report errors to the client. 2013-06-07 12:36:37 -04:00
Juan de Dios Herrero 36fe8fbc6d Added role scopes to roleable 2013-06-07 18:26:06 +02:00
Robin Ward 3ae72259a6 Merge pull request #979 from iancmyers/strong-parameters
All parameters for #create in PostsController pass through strong_parameters
2013-06-07 09:17:29 -07:00
Juan de Dios Herrero 1b92d9d7f8 Added roleable module for User model 2013-06-07 12:33:48 +02:00
Ian Christian Myers b61e10f9ad All parameters for #create in PostsController pass through strong_parameters.
We are now explicitly whitelisting all parameters for Post creation. A nice side-effect is that it cleans up the #create action in PostsController. We can now trust that all parameters entering PostCreator are of a safe scalar type.
2013-06-07 01:29:25 -07:00
Sam 5fa20ce357 more progress towards full migration to moment.js 2013-06-07 18:27:42 +10:00
Robin Ward 49f8e5a5d1 Merge pull request #976 from abbat/patch-1
Update js_locale_helper.rb
2013-06-06 14:38:56 -07:00
Robin Ward 8f32aed944 Only use HTML templates for the digest email. 2013-06-06 15:08:56 -04:00
Robin Ward 7bc80c2dcf Changed HTML Digest template. Removed margins, shrunk logo. 2013-06-06 14:45:32 -04:00
Anton Batenev 621d949033 Update js_locale_helper.rb
Fix "undefined method `end_with?' for 1:Fixnum" when field name in YML file is not quoted number like:

```
    user_action_groups:
      1: "Likes Given"
      2: "Likes Received"
```

(yamllint.com validates such file as valid YML file)
2013-06-06 22:20:17 +04:00
Robin Ward f268b882fd The posts rebake task should regenerate links too. 2013-06-06 13:52:30 -04:00
Robin Ward b062b4a98e Unapproved users should not receive digest emails. Fixes #974 2013-06-06 11:45:18 -04:00
Juan de Dios Herrero 96d23ddd8d Refactored user_name suggestion methods into a module to reduce the complexity of User model 2013-06-06 16:40:10 +02:00
Robin Ward 6384518599 Allow images in the daily digest for top scoring posts 2013-06-05 18:55:27 -04:00
Neil Lalonde 0dc678c1e7 Version bump to v0.9.2.5 2013-06-05 18:46:11 -04:00
Robin Ward 4d1e8356b8 FIX: Again, try to get a flexible absolute logo_url 2013-06-05 18:23:43 -04:00
Robin Ward 0b97ea6345 Better HTML emails, smarter email digests, new email section in admin with digest preview 2013-06-05 17:47:25 -04:00
Neil Lalonde b55182b983 Use PostDestroyer when deleting all of a user's posts; deleting a post removes its flags and resets its flag counts 2013-06-05 16:05:13 -04:00
Robin Ward dfba2b6e0a FIX: Strip links from google indexed bios when the users are new. 2013-06-05 15:28:10 -04:00
Régis Hanol 01855b70b4 FIX: Have onebox ignore internal links 2013-06-05 20:53:07 +02:00
Sam 870e59883b secure the links on the topic pages, eliminated deleted topics as well. 2013-06-05 16:10:26 +10:00
Sam 45129ccc58 Merge pull request #955 from novemberkilo/master
Reduce complexity of PostCreator
2013-06-04 17:18:45 -07:00
Régis Hanol e3e55d4dad fix image uploads on s3/imgur 2013-06-05 00:35:42 +02:00
Neil Lalonde 2465c9c724 Add min_private_message_title_length site setting so private messages can have short titles 2013-06-04 17:59:23 -04:00
Navin a4b73b2473 Simplify PostCreator - Introduce TopicCreator
Extract code to smaller methods
2013-06-04 20:13:01 +02:00
Robin Ward f22a6a8a18 Merge pull request #948 from iancmyers/findery-onebox
Added Findery and Zappos entries to the Oneboxer::Whitelist.
2013-06-04 10:34:16 -07:00
Robin Ward 4392a17b54 Strip out links when displaying a new user's bio 2013-06-04 12:06:25 -04:00
Ian Christian Myers cbf3845e99 Added Findery and Zappos entries to the Oneboxer::Whitelist.
Both Findery and Zappos support OpenGraph and work with the OpenGraphOneboxer. Added a comment at the top of whitelist.rb asking developers to check for OpenGraph support prior to creating a custom Onebox.
2013-06-04 08:34:14 -07:00
Neil Lalonde c4904aacc0 Automatically flag someone as a spammer if their posts get at least X spam flags from N users while their trust level is 'new user'. Staff can clear and set this status from the user record in admin. 2013-06-03 16:37:40 -04:00
Sam da22c0f359 omit single quotes from slug 2013-06-03 09:08:34 +10:00
Navin 59938883f0 Delete unused PostAnalyser module 2013-06-02 10:01:14 +02:00
Sam 037cbfd648 Merge pull request #926 from netzpirat/fix-s3-images
Don't append the base url to absolute image urls without protocol.
2013-05-30 21:33:37 -07:00
Sam d6d3f74405 Merge pull request #901 from xtream/master
Refactored AvatarLookup
2013-05-30 21:30:39 -07:00
Sam 2e87974cb5 fix very wonky logic around hostname calculation 2013-05-31 08:48:34 +10:00
Sam 160567e372 Revert "fix wonky logic figuring out host name"
This reverts commit 114fcb4734.
2013-05-31 08:41:29 +10:00
Sam 114fcb4734 fix wonky logic figuring out host name 2013-05-31 08:39:52 +10:00
Neil Lalonde b82a5dfd56 Move logic to reject slugs that are just numbers into the slug module 2013-05-30 11:54:02 -04:00
Michael Kessler d2e45cb8fd Don't append the base url to absolute image urls without protocol. 2013-05-30 17:17:07 +02:00
Victor Cruz Dueñas 5d2a6e3994 refactored and tested AvatarLookup
less array copying

Avoid N queries
2013-05-30 11:04:05 +02:00
Sam c2e597c57c missing message format files 2013-05-30 17:03:47 +10:00
Sam c26d70e68a make precompile happier 2013-05-30 16:58:31 +10:00
Sam 8874c9ea75 Add message format support that can be used on complex localization strings
Add message about new and unread topics at the bottom of topics
move localization helper into lib
2013-05-30 16:49:57 +10:00
Sam e93b7a3b20 more progress towards live unread and new counts, unread message implemented, still to implement delete messages 2013-05-30 16:49:57 +10:00
Sam 73834370a5 work in progress, live unread and new counts 2013-05-30 16:49:57 +10:00
Robin Ward 3dfb9f0c2f FIX: Searching for post content without intitial results was not working 2013-05-29 17:52:49 -04:00
Neil Lalonde 19b4680944 Version bump to v0.9.2 2013-05-29 16:54:06 -04:00
Robin Ward 487c25cbd7 Merge pull request #919 from nirnanaaa/master
Staff scope defined in User model but not used in staff_constraint
2013-05-29 12:18:19 -07:00
Robin Ward 8182a9d10c Merge pull request #918 from chrishunt/chrishunt/quiet-tests-please
Clean up test output
2013-05-29 12:17:04 -07:00
nirnanaaa 00c1c4691d there is a scope in User model but not used in staff_constraint 2013-05-29 19:54:23 +02:00
Robin Ward 9717a344c3 Refactor: Less reliance on views for logic for topic list 2013-05-29 13:28:07 -04:00
Chris Hunt e94e9b7621 Set UTF-8 charset for plain text email part 2013-05-29 09:54:36 -07:00
Robin Ward b3678125dc FIX: Don't cast ids to ints, as user results have string ids. 2013-05-28 16:59:22 -04:00
Neil Lalonde 29bf540a34 Add the sidekiq-failures gem so that we can diagnose failed jobs 2013-05-28 14:56:46 -04:00
Robin Ward 320b35bf90 Merge pull request #910 from novemberkilo/master
WIP - Reduce complexity of Post#raw_links
2013-05-28 10:07:41 -07:00
Navin 1d5952a92f Extract analysis type methods to a module and refactor Post#raw_links 2013-05-28 16:41:18 +02:00
Sam 88972b99a5 refactor 2013-05-28 09:48:47 +10:00
Sam d2f2a8e218 refactoring 2013-05-28 09:13:53 +10:00
Sam bf4bdbefe0 fix redis leak in rate limiter
change key name so there is no overlap with old non-list key
2013-05-28 08:58:45 +10:00
Neil Lalonde ed1b0ed0f1 Send user_count and a better url for your forum with the version check request 2013-05-27 16:30:11 -04:00
Robin Ward 20e88f18ee FIX: Removes some duplicates in search results when the search context is a user. 2013-05-27 15:18:55 -04:00
Robin Ward 197909246c Weigh staff likes higher when calculating scores. New site setting: `staff_like_weight`
can set the factor (default is 3)
2013-05-27 12:46:08 -04:00
Robin Ward 7d763a6f0c Bad merge. Oddly not caught by autospec. 2013-05-27 10:56:55 -04:00
Robin Ward e1781240a6 Merge branch 'refactoring' of git://github.com/mattvanhorn/discourse
Conflicts:
	lib/text_sentinel.rb
2013-05-27 10:42:20 -04:00
Chris Hunt 13c4266c74 Allow Chinese characters in Topic titles 2013-05-26 13:56:42 -07:00
Matt Van Horn d5958f8779 Sliding window rate limiting
Switched the algorithm to use a circular buffer
based on a redis list
2013-05-25 12:37:28 -07:00
Neil Lalonde c2d98d229a Version bump to v0.9.1 2013-05-25 11:21:58 -04:00
Robin Ward 2dedd2bd6e When a user context is present, priortize all their posts ahead of
just the topic's OP before adding more.
2013-05-24 17:45:40 -04:00
Matt Van Horn e5e904aa4e minor refactorings 2013-05-24 13:36:33 -07:00
Matt Van Horn 247a0b3ea1 small refactor of RateLimiter for clarity 2013-05-24 13:36:33 -07:00
Matt Van Horn c9fcee8490 simplify, clarify TextSentinel
codeclimate pointed this out. I agree it is better
to simplify and reveal intentions.
2013-05-24 13:36:33 -07:00
Robin Ward 1313c0f094 FIX: When using a search context, *prefer* the context's results, don't restrict to only them. 2013-05-24 16:17:09 -04:00
Robin Ward bd779834e5 Use search context for filtering search results by current category or user 2013-05-24 14:04:26 -04:00
Robin Ward 84bc798afa Merge pull request #891 from GlitchMr/iPhone-casing
Thread title fixer should ignore special cases like iLetter
2013-05-24 07:02:34 -07:00
Sam ca2dee52db moved comments to the bottom, they are way less intrusive there 2013-05-24 12:48:32 +10:00
Sam 2cd95bc649 lets try out annotations 2013-05-24 12:35:14 +10:00
Robin Ward eb0c102931 Migration logic from SearchView to a controller, where it should be. 2013-05-23 17:42:57 -04:00
Robin Ward 9d0e830786 Search code now uses ActiveRecord instead of SQL. 2013-05-23 16:26:51 -04:00
Konrad Borowski 8bc4264c98 Thread title fixer should ignore special cases like iLetter 2013-05-23 21:31:08 +02:00
Robin Ward 8e8d9af2bf Use classes instead of a complicated nested hash for search results 2013-05-23 12:44:47 -04:00
Robin Ward 0bd61df34c Merge pull request #884 from mattvanhorn/refactor_topic
Refactor topic
2013-05-23 07:26:22 -07:00
Matt Van Horn 806255b3c4 refactor Topic validation
introduce a couple of custom validators
fix minor discrepancies in tests
copy I18n error message keys to default location
clean up validation invocation
move some responsibilities out of validator into class
2013-05-22 22:31:52 -07:00
Sam fcc7192fd2 User tracking state implementation progress for live unread / new counts 2013-05-23 15:22:06 +10:00
Robin Ward 7a31630837 Search Refactor: Remove some manual SQL, make search data tables more idomatic Rails/AR 2013-05-22 16:31:13 -04:00
Robin Ward b9a310f4b1 Search Refactor: Let's use a class to keep track of our state rather
than passing params everywhere. Also make the private API private.
2013-05-22 15:22:06 -04:00
Matt Van Horn 872995db57 refactor guardian class for clarity & correctness
introduce NullUser to avoid type-checking
DRY up code
reduce number of multiple returns
remove some redundant/impossible logic branches
add pending test for possible bug
add test & fix for ability to flag archived posts
add #secure_category? method to topic class
Fix bug that prevented flagging of archived topics
Rename NullUser to AnonymousUser
DRY up can_<action>? methods
Fix some ownership logic, and a test, for Guardian
2013-05-22 01:09:34 -07:00
Sam da6a88634b improve best filter so it properly excludes all admin messages from count as well 2013-05-22 15:14:47 +10:00
Sam c4d8085fc5 remove moderator status posts from best feed 2013-05-22 15:04:53 +10:00
Robin Ward 27828c5ec2 Merge pull request #871 from avdi/refactoring-with-josh-and-avdi
Various refactorings towards Ruby/Rails idiom from Josh Susser and Avdi Grimm
2013-05-21 07:18:50 -07:00
Sam b5eff93a9d update message bus to support per client filtering
start work on user_tracking_state
fix can_ban? in guardian
expose protected scopes on topic_query we need
move guardian spec to use build as opposed to creating topics / posts / users
start work on user tracking spec
2013-05-21 16:39:51 +10:00
Sam 559c1e52aa protect against crash in prd 2013-05-21 10:08:33 +10:00
Sam e91ed83586 the private message stream is different to normal streams, improving the ui a bit and collapsing conversations 2013-05-20 16:44:06 +10:00
Sam b9c4bf9870 I fixed the multithreading issue with connection management a while back, remove mutex, it only slows down job processing 2013-05-20 10:31:17 +10:00
Sam 80fb20816c get rid of nonsense 404.html
correct 404 handling for invalid pages
2013-05-20 10:29:49 +10:00
Sam 24c997966e Merge pull request #861 from sanderdatema/post_creator
Set created_at manually through PostCreator
2013-05-19 16:34:45 -07:00
Sam e068edf362 Merge pull request #860 from chrishunt/chrishunt/page-out-of-range
Show posts for last page when page out of range
2013-05-19 16:33:57 -07:00
Sam ceddb6e0da fix bug where non-multisite environment would run out of connections 2013-05-20 00:23:10 +10:00
Chris Hunt c2a4f16f24 Show posts for last page when page out of range 2013-05-18 13:11:01 -07:00
Sander Datema 286a06bd4e Set created_at manually through PostCreator 2013-05-18 21:24:29 +02:00
Chris Hunt 9c092366e0 Add explicit 'spec' rake tasks
This doesn't require auto-loading of rspec-rails and puts the 'spec'
task in the rake task list (rake -T)
2013-05-17 16:02:43 -07:00
Josh Susser and Avdi Grimm 5659b66729 Refactor select().map() to use pluck.
Remove a method already provided by ActiveRecord.
2013-05-17 15:11:37 -04:00
Neil Lalonde f3282e33a3 Add tabs to category create/edit modal. Categories can have a default auto-close setting that applies to all new topics created in the category. Add rspec-given and write some integration tests. Tests for topic auto-close with category default 2013-05-17 11:05:35 -04:00
Sam 8f46653345 refactor 2013-05-17 09:03:52 +10:00
Robin Ward d554a59102 Support for a new site setting: `newuser_spam_host_threshold`. If a new user posts a link
to the same host enough tiles, they will not be able to post the same link again.

Additionally, the site will flag all their previous posts with links as spam and they will
be instantly hidden via the auto hide workflow.
2013-05-16 12:19:50 -04:00
Sam 04b8cd5c95 consistency check, need to also ensure delete cleans stuff up, maybe make notifications trashable 2013-05-16 17:50:14 +10:00
Sam 8b63c82f64 Merge pull request #852 from avdi/avoid-exceptions-for-flow-control
Replace exceptions for flow control with idiomatic throw/catch
2013-05-15 22:27:33 -07:00
Josh Susser and Avdi Grimm c793684d4c Replace exception used for flow control with idiomatic throw/catch. 2013-05-16 01:19:34 -04:00
Avdi Grimm 9acc0cd678 Replace exception used for flow control with idiomatic throw/catch. 2013-05-16 01:19:34 -04:00
Sam 8ac1d17c6f Merge pull request #846 from ZogStriP/fix-onebox-link-target-is-discourse-instance
FIX: Onebox link target is discourse instance
2013-05-15 22:19:22 -07:00
Sam e9ebadb414 Nuke message_bus_observer move to service class and classes
Secure all messages triggered by post creation and all user actions so they don't leak
(meaning, if you have a browser open and secure topics are created you will only get them if you are allowed to see them)
2013-05-16 15:03:16 +10:00
Robin Ward b1bfda0e11 Don't show new user education when editing a reply. 2013-05-15 15:16:42 -04:00
Neil Lalonde 2df46a9d0a Show a more useful message when redis config can't be found during init. 2013-05-15 10:08:08 -04:00
Régis Hanol 336d59391e FIX: Oneboix link target is discourse instance
This is the quickest fix to get Techcrunch oneboxing working.
The right fix would be to update the oembed onebox to work properly for the "link" type.
2013-05-13 23:12:05 +02:00
Robin Ward fff46cf5aa Can search by URL or ID 2013-05-13 17:07:58 -04:00
Robin Ward be234ce9b9 You can now 'move' the first post of a topic to another topic as a merge. In that
case, the first post is cloned instead of being deleted from the original topic.
2013-05-13 14:07:31 -04:00
Neil Lalonde 9828c87525 Topic Auto-Close: admins and mods can set a topic to automatically close after a number of days 2013-05-13 12:53:52 -04:00
Sam b6bf95e741 speed up startup (avoid loading some gems on startup)
correct group permission leaks
add Discourse.cache for richer caching support
2013-05-13 18:04:03 +10:00
Sam 9b33e826f2 clear flags on reply to notify moderators 2013-05-13 11:48:01 +10:00
Sam 30501e943c fix search 2013-05-13 11:07:21 +10:00
Neil Lalonde ba8d40d24b Version bump to v0.9.0 2013-05-10 15:31:53 -04:00
Robin Ward cf01c98d81 Experimental: Interface to Move Posts to an Existing Topic 2013-05-10 14:55:51 -04:00
Régis Hanol 297680c28d FIX: pinned topic excerpt is not properly truncated 2013-05-10 12:28:17 +02:00
Sam 5280b3a01b more group progress, UI getting there, controller mostly done
changed it so notify moderators goes to the moderators group
allow admins to grant self moderation and revoke self moderation
2013-05-09 17:37:34 +10:00
Sam 0f0fd281a8 group progress, never email banned users 2013-05-09 11:34:58 +10:00
Neil Lalonde f35a44aeae Add ability for admins and mods to send another activation email to a user, to activate an account, and deactivate an account 2013-05-08 10:10:47 -04:00
Sam 6b536dcde5 work in progress ... groups 2013-05-08 15:20:38 +10:00
Sam 381c42724f comments 2013-05-07 14:50:02 +10:00
Sam 066c2bed42 better comments 2013-05-07 14:46:46 +10:00
Sam e9fc272db7 remove acts_as_paranoid, use .trash! , .recover! and .with_deleted as needed
makes upgrading to rails 4 possible
2013-05-07 14:39:01 +10:00
Sam b0945599b7 enter will either run all specs or tell you which failed 2013-05-06 15:16:53 +10:00
Sam be1ab8b275 automatic group infrustructure 2013-05-06 14:49:56 +10:00
Sam d4a0d4f5dd Merge pull request #814 from ZogStriP/keep-reloaders-happy
prevent warning message about already defined constants
2013-05-05 17:52:22 -07:00
Sam caa3cae535 remove pointless to_sym 2013-05-06 09:51:09 +10:00
Michael Witrant 6018c2f98b use symbols in redis proxy methods 2013-05-05 15:58:37 +02:00
Michael Witrant 2031b69e6e use method name instead of __method__ (which is wrong in this situation on Debian Squeeze Ruby 1.9) 2013-05-05 13:34:54 +02:00
Régis Hanol bda04664b0 prevent warning message about already defined constants 2013-05-04 01:06:05 +02:00
Neil Lalonde 74a238b7e9 Version bump to v0.8.9 2013-05-03 16:42:29 -04:00
Sam 3eab0be4a8 deleting posts as an admin was bust 2013-05-03 17:56:23 +10:00
Sam 5ec52bd2e9 :s/moderator?/staff/g ... our naming was kind of crazy, renamed moderator? to staff 2013-05-02 17:22:27 +10:00
Sam 65cd00cf25 moderators now have teeth, more at http://meta.discourse.org/t/moderator-permission-set/6307/5
allow pms to be targetted at groups
2013-05-02 15:15:53 +10:00