Commit graph

87 commits

Author SHA1 Message Date
joshua stein 285fd82c16 check story tag permissions on editor, not creator 2014-03-06 13:54:30 -06:00
joshua stein 9535b05490 remove story downvoting, add story hiding
stories should either be reported for spam (coming later), upvoted,
or left alone rather than being downvoted for being uninteresting.
since users don't like leaving uninteresting things alone, they can
now hide stories from their view without affecting the story's
score.

hiding is implemented as a Vote with its vote set to 0 and the
reason set to "H"

add a /hidden url which shows all of a user's hidden stories

while i'm here, simplify Vote guts and add some tests to make sure
all the flip-flopping stuff works right
2014-03-03 17:20:21 -06:00
joshua stein 99c551cbfe move initial upvote of submitted story to Story model 2014-03-03 17:13:00 -06:00
joshua stein 3a60d3abba show story downvoting usernames to moderators to detect problems
such as voting rings or users downvoting things instead of filtering
tags
2014-02-21 11:29:19 -06:00
joshua stein 95202f21b2 add Tag.active scope to deprecate tags without removing them 2014-02-21 10:57:30 -06:00
joshua stein 67fc2cc75c set maximum time during which comments and stories can be downvoted
always allow a user to "unvote" if they're previously downvoted, but
after a certain number of days, don't accept new downvotes

there isn't really any benefit in downvoting old stuff that is
already off the front pages or on a dead comment thread, other than
to maliciously strip karma for particular users
2014-02-17 12:08:01 -06:00
joshua stein 1d5b004a36 Story: alpha sort methods, no functional changes 2014-02-17 10:07:36 -06:00
Serge Paquet 519427586a use Rails4-style strong parameters mass assignment protection 2014-02-02 15:41:38 -05:00
Serge Paquet aabe4ceed7 remove redundant "story" variable in comment templates 2014-01-13 02:11:34 -05:00
joshua stein 4cfa2dae27 Merge pull request #86 from srgpqt/master
refactor Comment#ordered_for_story_or_thread_for_user method
2014-01-12 22:30:27 -08:00
joshua stein f1f6b3c7e0 alert the user when submitting a long-ago-submitted story
show the user a link to the previous story and let them know they
can submit it again if they want to (just by submitting the form
again)
2014-01-13 00:10:31 -06:00
Serge Paquet 5988038071 make Comment#ordered_for_story_or_thread_for_user work on query scope 2014-01-08 23:48:24 -05:00
joshua stein d578482e3b move story comment counts out of keystore
it would be nice to use AR's built-in counter cache, but the
comments count has to reflect something custom so stick with what
was there
2014-01-08 22:20:56 -06:00
joshua stein 2f824a73a3 shrink story hotness window, things are moving faster now 2014-01-08 20:42:25 -06:00
Serge Paquet 709b0bff98 upgrade thinking-sphinx gem 2014-01-07 05:52:29 -05:00
Serge Paquet 9b0294c471 upgrade to rails v4.0.2 2013-12-30 17:40:52 -05:00
Serge Paquet b42189f45b replace some raw sql with database-agnostic activerecord queries 2013-12-30 16:23:59 -05:00
joshua stein 1e7dc17b56 set hotness with score+1 so a single downvote doesn't kill it 2013-12-28 11:52:52 -06:00
Serge Paquet 8fbf76b484 use activerecord query interface instead of deprecated finder methods 2013-12-25 16:43:50 -05:00
joshua stein c8e5aa3cac sphinx casts integers to unsigned, screwing up score attributes
cast them as bigints

closes #67
2013-12-19 16:04:51 -06:00
joshua stein 5c0dad2c4a strip spaces from urls as they are assigned 2013-07-19 22:07:03 -05:00
joshua stein ccb8094da1 change some before_create's to before_validation, :on => :create
random tokens need to be filled in before validation, otherwise the
validation is just checking a blank value
2013-07-19 22:05:00 -05:00
joshua stein a471eb180a don't hardcode "Lobsters" and "lobste.rs" everywhere, use Rails.application.{name,domain} 2013-06-30 01:50:23 -05:00
joshua stein fd41bfa566 start on mailing list interface 2013-06-30 00:54:02 -05:00
joshua stein 7ff7b676e5 use cast() magic when passing score to sphinx
fixes problem with mysql/mariadb 5.5
2013-06-30 00:54:02 -05:00
joshua stein b641d0232d sort of merge cache branch but don't do anything automatically
allow manual caching of story text using diffbot, if an api key is
configured and Story#fetch_story_cache! is called
2013-06-30 00:54:01 -05:00
joshua stein c9571dabaf back out 9ece666 removing utf8mb4 hacks, no longer needed 2013-05-26 12:32:54 -05:00
joshua stein 5e357f5684 allow moderators to edit story urls if they ever had one 2013-03-26 12:23:47 -05:00
joshua stein f585d07aa8 don't do @username expansion in user profile about section
most users are probably putting @username to mean a twitter profile,
not a link to a lobste.rs profile
2013-03-23 21:05:13 -05:00
joshua stein d0459974cd so long whitespace 2013-02-13 18:50:51 -06:00
Jon Evans 0a48959cda Pull short id generation into separate class 2013-01-22 23:15:05 -07:00
joshua stein 11385d6b65 add json view of story, including comments
for issue #42
2012-12-30 12:17:59 -06:00
joshua stein 048c614590 Story: make update_comment_count factor in deleted comments/threads 2012-12-30 12:12:24 -06:00
joshua stein 109718ba90 expose User and Story created_at to json 2012-12-18 17:16:02 -06:00
joshua stein cb5e1592b0 Story: export comment_count and score to json 2012-12-17 18:19:19 -06:00
joshua stein a4e5684994 moderation log: fix tag change summary; fixes issue #43 2012-12-16 20:27:54 -06:00
joshua stein 175ff9d2b1 add some custom as_json output to Story and User 2012-12-16 20:00:41 -06:00
joshua stein a9e169175b show story vote summaries to submitters and mods if it has any downvotes 2012-12-08 22:39:06 -06:00
joshua stein e5a0b671b8 story: simplify tags malarky and just use mark_for_destruction on associated objects 2012-11-26 13:39:16 -06:00
joshua stein fd4a278d3b fix duplicate description= definition 2012-11-13 11:39:50 -06:00
joshua stein 6deadc731a designate certain tags as media types, require a tag other than those
just tagging something "video" doesn't make it appropriate for
submission, it still requires a categorization tag
2012-11-12 11:02:18 -06:00
joshua stein 9ece6666bf add stupid temporary hack to strip out utf8mb4 chars that are screwing up mysql
4-byte utf8 chars like emoji are passed around in ruby fine, but
when they are put into mysql queries, strings get truncated at the
first mb4 character.  to prevent truncation, strip out mb4
characters in most user-controlled fields like comments, story
descriptions and titles, and messages.

to properly support utf8mb4, mysql server 5.5 is needed, the table
encodings need to be changed to utf8mb4, and the mysql2 gem needs to
be upgraded once it supports utf8mb4:

https://github.com/brianmario/mysql2/issues/249
2012-11-07 21:58:10 -06:00
joshua stein d07c555595 comments can be deleted or moderated to be considered gone 2012-10-24 11:53:43 -05:00
joshua stein d495e9472a move hotness window back to 48 hours 2012-10-09 11:06:43 -05:00
joshua stein 468a0cbe60 no need to make a delta for seconds, just use created_at 2012-10-09 11:04:53 -05:00
joshua stein c0ba39834b only do new tag check for new stories 2012-10-07 01:44:33 -05:00
joshua stein 6cb466bc83 shrink story hotness window down to 24 hours as we are growing 2012-09-20 11:00:11 -05:00
joshua stein 39bb9b77de minor cleanup 2012-09-20 10:53:11 -05:00
Robert J Samson 45d87069dd Check that user has appropriate permissions on tags before_save 2012-09-19 22:13:20 -04:00
Robert J Samson f3eb44972b Check to make sure a user isn't improperly using a privileged tag when saving a Story. 2012-09-19 20:57:45 -04:00