Commit Graph

279 Commits

Author SHA1 Message Date
Neil Lalonde b368667703 FIX: don't validate topic title if it isn't changing. topic stats were failing to update, causing necro topic warnings and other problems. 2014-08-01 17:30:07 -04:00
Régis Hanol 44ba74789b FIX: actually retrieve the first 2 posts in a conversation about a flag 2014-07-28 22:54:03 +02:00
Régis Hanol bddffa7f9a FEATURE: flag dispositions normalization
All flags should end up in one of the three dispositions
  - Agree
  - Disagree
  - Defer

In the administration area, the *active* flags section displays 4 buttons
  - Agree (hide post + send PM)
  - Disagree
  - Defer
  - Delete

Clicking "Delete" will open a modal that offer to
  - Delete Post & Defer Flags
  - Delete Post & Agree with Flags
  - Delete Spammer (if available)

When the flag has a list associated, the list will now display 1
response and 1 reply and a "show more..." link if there are more in the
conversation. Replying to the conversation will NOT give a disposition.
Moderators must click the buttons that does that.

If someone clicks one buttons, this will add a default moderator message
from that moderator saying what happened.

The *old* flags section now displays the proper dispositions and is
super duper fast (no more N+9999 queries).

FIX: the old list includes deleted topics
FIX: the lists now properly display the topic states (deleted, closed,
archived, hidden, PM)
FIX: flagging a topic that you've already flagged the first post
2014-07-28 19:28:07 +02:00
Robin Ward fb8dda7f42 FIX: We should use `category_id` instead of `category_name` to perform
operations, now that the subcategory names are not unique.
2014-07-16 15:40:35 -04:00
Sam 2d0def9940 FIX: First Quote badge bust
Feature: track quoted posts
2014-07-15 17:47:24 +10:00
Jeff Atwood 49dbded250 remove title_sanitize setting 2014-07-14 00:18:02 -07:00
Neil Lalonde 7d5d5862c1 Import optimizations for topic creation: Prevent queuing of most jobs when importing posts and topics. Only do some recalculations at the end of the import. 2014-07-03 16:24:47 -04:00
Régis Hanol f733237075 TRIVIAL: remove default 'Read more' link in the banner 2014-06-20 19:05:26 +02:00
Régis Hanol 00117c18c3 FEATURE: dismissable banner topic 2014-06-18 20:05:19 +02:00
Régis Hanol 30611c343c ensures only one banner topic at all time 2014-06-18 20:05:18 +02:00
Sam b1d5f4440b Annotate models 2014-05-28 12:30:57 +10:00
Régis Hanol 9125453628 FEATURE: add the first 3 participants in a private message 2014-05-12 09:32:49 +02:00
Sam 3f07c1d0a1 Backend support for group invites 2014-05-09 18:22:35 +10:00
Sam a2e2d0e886 Merge pull request #2316 from mutiny/refactor-where-first
Refactor `where(...).first` to `find_by(...)`
2014-05-08 09:10:45 +10:00
Régis Hanol 21e8ae0eca BUGFIX: the /top page now shows the first non-empty period 2014-05-07 19:04:39 +02: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
Benjamin Kampmann 0cf07d41ae Move Concern from lib into app/models. refs #2279 2014-04-29 19:26:43 +02:00
Benjamin Kampmann e502122c51 Add Custom Fields on Topics 2014-04-29 19:26:42 +02:00
Sam e88e43bfb6 Merge pull request #2279 from fantasticfears/concern
move concerns to the model/concerns
2014-04-28 09:48:33 +10:00
Sam 759f4b4fe9 BUGFIX: category name is reserved in multisite 2014-04-24 09:19:59 +10:00
Erick Guan 6d45f71254 move concerns to the model/concerns 2014-04-19 12:00:40 +08:00
Régis Hanol 454f11e597 FEATURE: new title_sanitize site setting 2014-04-18 21:01:21 +02:00
Régis Hanol b014d66b65 Merge pull request #2277 from vikhyat/fix-title-html
Fix HTML tags in topic titles
2014-04-18 11:37:33 +02:00
Vikhyat Korrapati 25a080a8e1 Fix HTML tags in topic titles.
We no longer sanitize titles before saving to the database since it
would cause problems like HTML entities showing up when you try to edit
a topic title. It isn't even really necessary since we only render
fancy_title directly and never title.

The escaping logic used here is the same that is used both in lodash and
onebox. See:

1. https://github.com/discourse/onebox/pull/190/files
2. https://github.com/lodash/lodash/blob/2.4.1/dist/lodash.compat.js#L6194
2014-04-18 10:47:00 +05:30
Robin Ward 64faee0935 Break down new topic counts by category if a digest contains many. 2014-04-17 16:42:40 -04:00
Robin Ward fd4007eefc FIX: Don't sort the new topics by score since the Top logic is already
sorting them by score.
2014-04-17 15:43:24 -04:00
Robin Ward 564b1d86b0 Digest should exclude muted topics. 2014-04-17 15:27:11 -04:00
Robin Ward 89aa2380c6 Use "Top" logic for digest emails. Leave out muted categories. 2014-04-17 15:22:19 -04:00
Sam 862a6696c0 Correct annotations
allow longer usernames (up to 60)
2014-04-15 15:53:48 +10:00
Robin Ward a49b38ac35 TRIVIAL: Remove irrelevant comment :) 2014-04-14 21:00:52 -04:00
Robin Ward b909e26fa4 Also use the body of the post when looking for similar topics 2014-04-14 15:48:58 -04:00
Robin Ward 0d238db43c Exclude category definition topics from similar search 2014-04-14 15:21:05 -04:00
Sam b9d4edd91a FEATURE: display unpinned state, allow unpinning by clicking on pin 2014-04-10 10:59:02 +10:00
Régis Hanol 6373de550f update annotations 2014-04-08 17:35:44 +02:00
Sam 0372b81d11 FEATURE: allow moderators to globally pin topics 2014-04-07 16:38:51 +10:00
Robin Ward f5c7ccb4e6 New field: Whether or not to include an expandable first post for
embedded content.
2014-04-02 10:26:46 -04:00
Godfrey Chan b68dbe081c Remove deprecated finder method calls 2014-03-27 00:00:23 -07:00
Sam 090f5c99c2 FEATURE: Live update edits 2014-03-24 12:19:08 +11:00
Sam 5c148faeb9 annotations were out of date 2014-03-20 15:35:51 +11:00
Sam b19400726f BUGFIX/FEATURE: store topic changes in post revisions
History + edit notifications for title and category changes
2014-03-07 19:00:36 +11:00
Régis Hanol ac99947979 BUGFIX: topic specs were dependent on Time.now
which would fail when DST was around
2014-03-06 12:44:52 +01:00
Sam 560b5356d5 Revert "Use symbols instead of strings in order clause"
Breaks 1.9.3 compat

This reverts commit 09a2d9e12c.
2014-02-28 15:08:50 +11:00
Nick Borromeo 09a2d9e12c Use symbols instead of strings in order clause
This simply changes the strings in the order clauses in the model. The
reason of the change is because the SQL generated when using symbols
automatically name spaces the column with the table name.

Topic.order(:title).to_sql
=> SELECT "topics".* FROM "topics" ORDER BY "topics"."title" ASC

This also changes the scopes using lamba to use stabby lambas for
consistency with other scopes.
2014-02-26 22:43:03 -08:00
Sam 9551f4aeea PERF: calculate scores for topics/posts faster
Only look at topics that changed in last day for 15 minuted schedule
Do a full recalc weekly, just in case
2014-02-27 11:45:40 +11:00
Stephan Kaag f12925887c Drop Rails3 support 2014-02-17 19:42:08 +01:00
Sam be560d4eb6 Update annotations 2014-02-07 11:07:52 +11:00
Robin Ward 4981525047 REFACTOR: Fixes poor class hierarchy for listing topics
- Upgrades Ember to latest
- Fixes a bunch of bugs with page titles and missing "active" states
2014-01-18 19:26:24 +01:00
Neil Lalonde 2a33a35566 Staff can create uncategorized topics even if allow_uncategorized_topics is false 2014-01-15 15:58:29 -05:00
Neil Lalonde 52580f09af Rename favorite to starred everywhere 2014-01-10 14:54:19 -05:00
Régis Hanol 567d2bd23c add top page 2013-12-24 00:50:36 +01:00
Neil Lalonde c0e1ef75f6 Don't auto-close a topic too soon in PeriodicalUpdates 2013-12-18 14:09:49 -05:00
Sam 96fdf72d5e rails master compatability 2013-12-13 17:04:45 +11:00
Régis Hanol 06dd7ffe3c better revision history 2013-12-12 03:41:34 +01:00
Neil Lalonde 9a24d2651d Allow category to auto-close topics in X hours instead of days. FIX: the system message that says a topic was automatically closed was only counting in days. 2013-12-06 16:39:35 -05:00
Sam 2db3cfb16b annotate models 2013-12-05 17:40:35 +11:00
Neil Lalonde abed146cc7 FIX: Category description topics shouldn't auto-close 2013-12-04 10:31:25 -05:00
Neil Lalonde a9ab98ef9e Auto-close time can be entered in 3 ways, so a topic can close at any time 2013-11-27 09:52:35 -05:00
Robin Ward 4ce81e1b01 Rename "Best Of" to "Summary" 2013-11-18 12:48:26 -05:00
Robin Ward 7207cef7aa TopicQuery cleanup in advance of custom sorting:
- Move SQL method constants into a module
- Removed unused count methods
- Moved methods that don't return a TopicList into Topic
- Replaced some confusing method signatures
2013-11-13 12:26:32 -05:00
Sam d1d661f6e1 add logic that auto closes any topics that missed the queued job (due to redis flush or whatever) 2013-11-11 10:52:44 +11:00
Robin Ward 948a545cb1 Category descriptions should not appear in digests 2013-11-06 15:05:06 -05:00
Robin Ward de30af9302 Support for inviting to a forum from a user's invite page. 2013-11-06 12:56:50 -05:00
Robin Ward 6063b52d6a Support for choosing a destination category when splitting topics. 2013-10-29 15:30:06 -04:00
Manoj 9650dbb97c Refactor topics controller
Refactor: 1) TopicsController to reduce code climate complexity.
2) Topic model, addressed comments

fix typo
2013-10-28 11:42:07 +05:30
Sam 4929c5db71 FIX: when allow_uncategorized_topics was false, PMs can not be created 2013-10-25 09:33:39 +11:00
Sam 666264879c change it so all topics MUST include a category, we store a special uncategorized category to compensate
this cleans up a bunch of internals and removes some settings
2013-10-24 12:08:02 +11:00
Sam 1ee49798b2 work in progress wide category list 2013-10-18 11:10:10 +11:00
Robin Ward f8625b5510 Merge pull request #1495 from cored/refactor-topic-invite-by-email
Refactor: Topic model
2013-10-17 07:04:12 -07:00
Manoj 7c03076c2a Refactored Topic#limit_topics_per_day to reduce code climate complexity
Extracted  1) #apply_per_day_rate_limit_for, method as generic
RateLimiter , 2) #limit_first_day_topics_per_day as a separate method,
3) Added User#added_a_day_ago?, 4) Fixed private methods indentation.
2013-10-16 14:58:18 +05:30
Sam ad2ed5fe51 rate limits for topics and posts on first day
max_topics_in_first_day and max_replies_in_first_day
2013-10-10 10:32:03 +11:00
Rafael George 3a1e1e046b Refactor: Topic#invite_by_email
Extract Topic#email_already_existas_for? and Topic#grant_permission_to_user
Fix failing spec due to missing variable in extracted method
2013-10-09 13:55:02 -04:00
Neil Lalonde bccb37b6f3 When creating a topic, don't select a category by default when allow_uncategorized_topics is false. Also, added category validation on the server to enforce allow_uncategorized_topics. 2013-10-08 14:41:20 -04:00
Sam 5bf26ec34e large refactor, ship a few columns from the user table into user_stats 2013-10-07 15:04:59 +11:00
Claus Strasburger 15a973fd45 Improved private message user removal, locale edit
replaced array iteration with findProperty (will be renamed and aliased to findBy with Ember 1.1)
added modal dialog to verify
catched nil-error on topic.rb
2013-10-02 19:16:43 +02:00
Sam 5caa7a0e4d improve performance of periodical update job, decrease frequency and shift it by a few minutes 2013-09-30 16:59:16 +10:00
Sam 32e3e3f382 update annotations 2013-09-06 17:38:50 +10:00
Einar Jonsson 23d8f5fec7 Replaced delegator methods with Forwardable def_delegator in Topic 2013-08-30 09:29:34 +00:00
Robin Ward bbd79aafd1 Revert "Replaced delegator methods with Forwardable def_delegator in Topic"
This reverts commit 3ed037940f.
2013-08-29 11:45:27 -04:00
Einar Jonsson 3ed037940f Replaced delegator methods with Forwardable def_delegator in Topic 2013-08-28 11:25:57 +00:00
Einar Jonsson b385cdcc34 Extracted featured_users functionality out of Topic.
* Created a TopicFeatureUsers model
* Topic#featured_user_ids and Topic#feature_topic_users now delegate to
* a TopicFeatureUsers instance to keep demeter happy.
2013-08-27 09:10:50 +00:00
Ben Hicks b13796c35e Refactoring the feature_topic_users method to improve
the code climate score.
2013-08-14 20:42:16 -05:00
Robin Ward 652169daf6 Include a list of more new topics in the digest emails at the bottom 2013-08-09 14:43:02 -04:00
Stephan Kaag f99acebdaa Rails 4 updates 2013-07-24 21:09:18 +02:00
Sam ea7684fb32 Merge pull request #1226 from stephankaag/rails4_updates
Some Rails4 updates
2013-07-22 15:03:37 -07:00
Stephan Kaag 0e3b8fbb24 Remove some calls to `all`. They are not required, and Rails4 raises warnings about them. 2013-07-22 20:44:11 +02:00
Stephan Kaag b19f631b3a Some Rails4 updates 2013-07-22 19:01:22 +02:00
Sam 31bb08bcdd added an option to bypass auto tracking of topics on post creation 2013-07-22 15:07:20 +10:00
Sam 9e4b0df7ff 69 specs fail in rails 4 now ...not too bad 2013-07-22 15:07:20 +10:00
Sam ecf17cfebb work in progress, add fidelity to category group permissions (full, create posts, readonly) 2013-07-16 15:46:11 +10:00
Robin Ward b7327942af Add `deleted_by` to `Trashable` tables 2013-07-09 15:46:36 -04:00
Robin Ward f9d1fcb169 Merge pull request #1140 from stephankaag/code_refactoring
Refactor code that raises deprecating warnings in Rails 4
2013-07-09 06:48:48 -07:00
Neil Lalonde 806bd98f99 Update category's topic_count immediately when trashing or recovering a topic; this ensures that a category can be deleted without waiting for the category_stats job to run. 2013-07-08 15:23:20 -04:00
Stephan Kaag 2abfd38aee Refactor code that raises deprecating warnings in Rails 4 2013-07-08 18:35:11 +02:00
Sam ca7c10df9a Merge pull request #1139 from stephankaag/correct_image_url_rails4
No need to include all ActionView::Helpers in Topic
2013-07-03 23:29:43 -07:00
Neil Lalonde 2c8ed8414c If an auto-closing topic is manually closed, remove the auto-close countdown 2013-07-03 16:54:41 -04:00
Stephan Kaag 7cc7116680 No need to include all ActionView::Helpers in Topic, we only need the sanitize helper.
This also fixes a bug in Rails 4 where image_url gets accidentally overridden.
2013-07-03 21:43:29 +02:00
Stephan Kaag 89b621d31a Refactor update_all statements in order to prevent deprecation warnings in Rails 4 2013-07-02 18:36:47 +02:00
Sam f6b850e7a4 allow skipping the validations on creation if its an api call AND skip_validations is specified
this allows wordpress plugin to post very very short titles or titles that would otherwise be disallowed
2013-07-02 12:23:19 +10:00
Sam 7681ba0c32 don't fail this query cause avg_time is 0 2013-06-30 01:30:47 +10:00
Sam 799b402778 fix horribly broken invite code, could lead to inviting the wrong person to a conversation 2013-06-19 10:31:19 +10:00
Sam 80c42753e1 fix up find as you type for the invite into PM function
allow mods to remove users from a PM
2013-06-18 17:17:01 +10:00
Robin Ward 3c7eb3a4e8 FIX: null dates crashed the client app. `last_posted_at` was not updating properly on split topic. 2013-06-17 13:02:50 -04:00
Sam e6e81efe85 correct information leak in page not found 2013-06-13 10:27:17 +10:00
Robin Ward 77b218a142 FIX: Do not suggest similar topics from secure categories you can't see. 2013-06-12 13:45:11 -04:00
Sam 1756f713d6 SECURITY HOLE, upgrade right away if you are using Secure Groups. 2013-06-08 23:52:06 +10:00
Neil Lalonde 169125e96d Fix a case where a random topic with null slug will be rendered instead of 404 2013-06-07 14:30:26 -04:00
Neil Lalonde a151bfc7ec Store when a topic was first set to auto-close and report that amount of time when it closes. And do some refactoring. 2013-06-06 17:04:21 -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
Sam 870e59883b secure the links on the topic pages, eliminated deleted topics as well. 2013-06-05 16:10:26 +10: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
Robin Ward d23ef1d090 FIX: You could update a topic to have a title that's too short if the TextCleaner
removed extra characters. Additionally, updating the title will not return an error
message to the client app if the operation fails (rather than failing silently.)
2013-05-31 15:24:13 -04:00
DI2uNk 24e32092e7 Refactored two class methods into scopes (to achieve a better 'rails way')
Also added some tests to the methods
2013-05-30 21:21:31 +02:00
Chris Hunt 21a54567ff Extract TopicStatusUpdate from Topic 2013-05-28 09:01:04 -07:00
Chris Hunt 54a798eb12 Add Topic#age_in_days for determining age of topic 2013-05-27 18:02:15 -07: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
Robin Ward a15910ad1e Merge pull request #899 from chrishunt/chrishunt/extract-topic-posters-summary
Extract topic posters summary
2013-05-27 06:30:58 -07:00
Chris Hunt 6024529f81 Extract PostMover from Topic into its own class 2013-05-26 18:42:04 -07:00
Chris Hunt b8fbac582e Add Topic#url for determining url for a Topic 2013-05-25 17:44:32 -07:00
Chris Hunt f2b5e20840 Add Topic#max_post_number to find max post number 2013-05-25 17:44:32 -07:00
Chris Hunt c1841a6c89 Extract Topic#posters_summary 2013-05-24 15:33:45 -07:00
Matt Van Horn e5e904aa4e minor refactorings 2013-05-24 13:36:33 -07:00
Matt Van Horn d7817cf314 extract TopicNotifier class from topic 2013-05-24 13:36:33 -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
Matt Van Horn c4b5821ef8 Revert annotation and non-English I18n changes 2013-05-23 06:44:47 -07:00
Matt Van Horn 7271b90655 annotate topic model 2013-05-22 22:36:01 -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
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
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
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
Robin Ward cf01c98d81 Experimental: Interface to Move Posts to an Existing Topic 2013-05-10 14:55:51 -04: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 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 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
Neil Lalonde dc07563c0d Add unstarred_at column to topic_users so we can permanently track when topics are starred 2013-04-29 11:39:05 -04:00
Sam 5cfcdc7ef0 backend for secure categories mostly done (todo pm groups) 2013-04-29 16:33:43 +10:00
Régis Hanol dca2fbcefc add meaningful error message on upload [fixes #773] 2013-04-27 20:26:17 +02:00
Sam 81673dcde8 slug memoization in the table 2013-04-24 12:46:43 +10:00
Sam 8827dd3e42 speed up tests 2013-04-22 13:48:41 +10:00
Neil Lalonde 5cd6c85e8b Add bookmarks and favorites to dashboard stats 2013-04-18 14:27:22 -04:00
Régis Hanol b24c1a1ad9 better consistency around email case sensitivity 2013-04-15 02:20:33 +02:00
Neil Lalonde 651cfba93f Add ability to destroy a user with 0 posts 2013-04-12 16:53:00 -04:00
Sam 5f30ea7463 Merge pull request #684 from ZogStriP/auto-replace-rules-in-titles
auto replace rules in titles
2013-04-10 21:12:20 -07:00
Régis Hanol d120a5d139 FIX: setting min_topic_title_length is ignored 2013-04-10 14:54:10 +02:00
Régis Hanol c5cf8be864 auto replace rules in titles 2013-04-10 11:00:50 +02:00
Neil Lalonde bb18b6cb9b Dashboard: split out private messages from topic and post counts; re-enable report_spec because I think I fixed it... 2013-04-03 13:26:09 -04:00
Robin Ward ac0bc1bb30 Including your avatar if you've posted is confusing. Let's remove it for now. 2013-04-03 11:29:50 -04:00
Robin Ward ee76f1926d Debugging Tool for Hot Topics 2013-04-02 18:00:53 -04:00
Robin Ward a819a26f34 BUGFIX: New status posts weren't using PostCreator 2013-03-28 16:40:54 -04:00