Commit Graph

82 Commits

Author SHA1 Message Date
Sam Saffron
045a2abcec FEATURE: remove the timecop gem
We should only have one way of mocking time, misuse of timecop
was causing build stability issues
2017-07-24 12:11:10 -04:00
Guo Xiang Tan
13f3de4bf6 Nuke all SiteSetting.stubs from our codebase. 2017-07-07 15:09:14 +09:00
Neil Lalonde
55b61e9bea rename topic_status_update to topic_timer 2017-05-11 18:27:53 -04:00
Robin Ward
96c59c5b82 FIX: Don't notify or return flags on system users 2017-05-08 13:13:35 -04:00
Sam
aec73d4003 correct the spec again 2017-04-20 17:41:35 -04:00
Sam
47b99e0922 group is now default watched 2017-04-20 17:38:46 -04:00
Guo Xiang Tan
ed577fbff8 FEATURE: Pause a topic instead of permanently closing when flag threshold is reached. 2017-03-31 14:35:05 +08:00
Sam
c531f4ded5 remove rails-observers
Rails yanked out observers many many years ago, instead the functionality
was yanked out to a gem that is very lightly maintained.

For example: if we want to upgrade to rails 5 there is no published gem

Internally the usage of observers had quite a few problem.

The series of refactors renamed a bunch of classes to give us more clarity
and removed some magic.
2016-12-22 16:46:53 +11:00
Sam
c04d4171ff FIX: whisper no longer experimental
- Regular users are not notified of whispers
- Regular users no longer have "stuck" topics in unread
- Additional tracking for staff highest post number
- Remove a bunch of unused columns in topics table
2016-12-02 17:03:31 +11:00
Guo Xiang Tan
cb5be1fe8f
Upgrade rspec to 3.4.0. 2016-05-30 11:38:38 +08:00
Robin Ward
5d4ee2ca1d FEATURE: Warn a user when they have few likes remaining 2016-03-18 11:30:29 -04:00
Robin Ward
1fba835d4f FIX: Use a logging table for daily likes given. Use it for badges. 2016-03-18 11:18:54 -04:00
Sam
3e018c2588 FIX: rate limit do/undo on post actions 2016-03-06 09:51:30 +11:00
Sam Saffron
a764cc3a42 FEATURE: by default users track a group (as opposed to watch)
FEATURE: a rollup counting number of messages in the group inbox to tracking users
2016-01-27 21:38:33 +11:00
Neil Lalonde
007326d3bd FIX: hidden posts that are edited by the author and unhidden could not be flagged by the same users again 2015-12-29 16:59:36 -05:00
Andy Waite
3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Guo Xiang Tan
600e42c2ba FIX: Race condition when wrapping PostCreator#create in a transaction. 2015-10-15 14:42:40 +08:00
Sam
51d82fc25d PERF: Active Record #pluck is twice faster
PERF: SqlBuilder bypasses AR converters and uses PG directly
2015-05-13 16:46:17 +10:00
Arthur Neves
b8cbe51026
Convert specs to RSpec 2.99.2 syntax with Transpec
This conversion is done by Transpec 3.1.0 with the following command:
    transpec

* 424 conversions
    from: obj.should
      to: expect(obj).to

* 325 conversions
    from: == expected
      to: eq(expected)

* 38 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 15 conversions
    from: =~ /pattern/
      to: match(/pattern/)

* 9 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 5 conversions
    from: lambda { }.should_not
      to: expect { }.not_to

* 4 conversions
    from: lambda { }.should
      to: expect { }.to

* 2 conversions
    from: -> { }.should
      to: expect { }.to

* 2 conversions
    from: -> { }.should_not
      to: expect { }.not_to

* 1 conversion
    from: === expected
      to: be === expected

* 1 conversion
    from: =~ [1, 2]
      to: match_array([1, 2])

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2015-04-25 11:18:35 -04:00
Sam
4387e05162 PERF: speed up query 2015-04-16 17:29:37 +10:00
Sam
a5b25ad2af FEATURE: scale up likes per day as users increase trust level
tl2 = 1.5 times the likes
tl3 = 2 times the likes
tl4 = 3 times the likes

configurable via tl[234]_additional_likes_per_day_multiplier site setting
2015-04-16 09:44:30 +10:00
Régis Hanol
eec1921ba9 FIX: notifications inconsistencies + never notify system user 2015-04-01 11:55:59 +02:00
Sam
cfa511e35d FIX: correctly mute likers
FEATURE: disallow all muting of staff
2015-03-26 12:08:04 +11:00
Régis Hanol
df7c38dd51 FIX: don't add an automated message when *a* moderator already replied (as opposed to *the* moderator) 2015-03-16 12:02:34 +01:00
Régis Hanol
afd2417945 FEATURE: new 'auto_respond_to_flag_actions' site setting 2015-03-11 19:29:09 +01:00
Régis Hanol
c8631a7a8b FIX: auto-message shouldn't generate notifications 2015-03-11 19:07:17 +01:00
Régis Hanol
2fcd199f48 FIX: send a PM to moderators when a post has been flagged as sockpuppet 2015-02-05 19:58:49 +01:00
Sam
03388e11ab oops, migration was flipping 2015-01-08 15:26:15 +11:00
Sam
3347a48275 FEATURE: add liked and bookmarked classes to topic list item rows 2015-01-08 14:35:56 +11:00
Luciano Sousa
b3d769ff4f Update rspec syntax to v3
update rspec syntax to v3

change syntax to rspec v3

oops. fix typo

mailers classes with rspec3 syntax

helpers with rspec3 syntax

jobs with rspec3 syntax

serializers with rspec3 syntax

views with rspec3 syntax

support to rspec3 syntax

category spec with rspec3 syntax
2015-01-05 11:59:30 -03:00
Régis Hanol
1353557575 FIX: custom flags not possible on very long topic titles 2014-12-11 19:34:52 +01:00
Régis Hanol
86c4c947a3 FIX: drastically simplify auto-close topic logic
Get rid of this nonsensical maximum-flow algorithm :fired:
2014-12-06 16:29:54 +01:00
Régis Hanol
cd170ca548 FEATURE: auto-close topics based on community flags 2014-12-05 19:37:43 +01:00
Régis Hanol
e7f251c105 LOTS of changes to properly handle post/topic revisions
FIX: history revision can now properly be hidden
FIX: PostRevision serializer is now entirely dynamic to properly handle
hidden revisions
FIX: default history modal to "side by side" view on mobile
FIX: properly hiden which revision has been hidden
UX: inline category/user/wiki/post_type changes with the revision
details
FEATURE: new '/posts/:post_id/revisions/latest' endpoint to retrieve
latest revision
UX: do not show the hide/show revision button on mobile (no room for
them)
UX: remove CSS transitions on the buttons in the history modal
FIX: PostRevisor now handles all the changes that might create new
revisions
FIX: PostRevision.ensure_consistency! was wrong due to off by 1
mistake...
refactored topic's callbacks for better readability
extracted 'PostRevisionGuardian'
2014-10-27 22:06:43 +01:00
Régis Hanol
70884d2436 FEATURE: automatically hide posts made by TL0 users when flagged by a TL3 user 2014-10-01 18:53:17 +02:00
Régis Hanol
de76b512c1 fix most deprecations in the specs (still some left) 2014-09-25 17:44:48 +02:00
Régis Hanol
f2b0228164 FIX: unhide post when a moderator undos the flag on which s/he took action 2014-08-19 16:14:17 +02:00
Régis Hanol
d7b1313d5e FEATURE: acting on a flag should not post an automated status message if you already replied to it 2014-08-18 17:00:14 +02:00
Régis Hanol
17debbdcda FIX: make sure no more than one 'status' reply is put in a PM (for multiple flags on the same post) 2014-08-04 19:39:36 +02:00
Régis Hanol
220f9e21e3 FIX: 'undo flag' marks the flag as disagreed 2014-07-30 23:35:42 +02:00
Régis Hanol
57fef6864d FIX: update_counters wasn't properly updating topic counters 2014-07-28 22:08:31 +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
3aa8d8efa1 FIX: Acting and undoing repeatedly was broken 2014-07-18 16:17:11 -04:00
Neil Lalonde
8e382fa5ea FIX: flag as notify_moderators pm's used 'Regular' notification level for members of the moderators group, which isn't valid for pm's 2014-06-24 12:31:46 -04:00
Robin Ward
3811efa5e2 Record when a post was hidden 2014-06-20 15:03:23 -04:00
Régis Hanol
08dde3d881 BUGFIX: moderators can notify moderators 2014-05-13 17:47:00 +02:00
Neil Lalonde
e68e97d986 FIX: moderators can't see private topics that they aren't invited to see. 2014-05-12 15:26:46 -04:00
Régis Hanol
11af466737 FEATURE: add a specific flag reason when a post has been hidden 2014-04-30 16:58:01 +02:00
Neil Lalonde
997a7c676e If flagging a topic with only one post, flag the post instead 2014-02-18 15:18:31 -05:00
Sam
641c51367a fix broken build
hack to allow for PMs with no users for flagging needs
2013-09-06 18:03:30 +10:00