Commit graph

112 commits

Author SHA1 Message Date
joshua stein a16150d8a5 allow searching stories by domain, link domain in story list to such a query 2015-01-29 10:16:46 -06:00
joshua stein 00d347c4f4 consolidate sql fragment to cast story/comment score 2015-01-28 15:02:40 -06:00
joshua stein bf928cf62b Story: take hotness window back down to 36, 48 is a bit stale 2015-01-27 12:14:26 -06:00
joshua stein f1cfe29b1f fix initial story hotness
Initial story hotness was zero, which excluded stories with no other
upvotes from the homepage.  Before creating, define initial hotness
to something.

Since this now makes very new stories show up on the homepage right
away, expand the window back to 48 hours.

This requires a Story.recalculate_all_hotnesses! to properly sort
things.
2015-01-13 13:00:55 -06:00
joshua stein 88709b5d04 move story tagging sorting into a function 2015-01-06 17:31:44 -06:00
joshua stein 9c73c87d28 add story cache showing for manually-specified unavailable stories 2015-01-06 17:31:09 -06:00
joshua stein 9f5e04bbba use _path for most things instead of _url
Instead of hard-coding the scheme and host everywhere, use _path
methods to show relative URLs.

Except that our previous setting of
Rails.application.routes.default_url_options in
config.after_initialize made this moot because Rails inserts that
host into all _path helpers for some reason.  So revert that
setting.

But then anything that wants an absolute URL doesn't know the
hostname and the root_url helper throws an exception.  So make a
Rails.application.root_url shortcut to pass the per-app settings in
Rails.application to root_url.

Now we can just use _path helpers most places but still use _url
ones where we need them, such as in RSS views and e-mail templates.
2015-01-02 17:02:55 -06:00
joshua stein c151fbeeb8 better tag hotness mod calculation 2015-01-01 10:25:14 -06:00
joshua stein 1cc16ecfbf tweak code formatting 2014-12-15 15:06:53 -06:00
joshua stein 606f5c9849 experiment with factoring comment scores into story hotness
might keep an active story alive on the front page and bury a story
with a "comment graveyard"
2014-12-15 15:06:53 -06:00
joshua stein 9e8b89be1c cast story.{upvotes,downvotes} to signed on mysql, integer on postgres
old mysql doesn't support 'cast(1 as integer)', but new/mariadb does

postgres doesn't support 'cast(1 as signed)'

should fix #145
2014-10-06 14:07:53 -05:00
joshua stein 09bd0026d3 ignore a story's submitter's comments when calculating hotness 2014-09-16 10:53:25 -05:00
joshua stein 962b7e8d59 add per-tag story hotness modifiers 2014-08-31 20:27:54 -05:00
Fredrik Wallgren ab8f8f3a72 Add upvoted route.
Upvoted route shows all stories a logged in user have upvoted
in reverse chronological order, latest upvote first.
It is not shown in the gui, but reachable at /upvoted.
2014-08-16 00:27:18 +02:00
joshua stein 270939b5a4 Story: return true from recalculate_all_hotnesses!
this is usually called from the console, and true is better than a
giant array of every Story object
2014-07-02 10:09:03 -05:00
joshua stein 023f8282ea as noted earlier, URI.parse is not very lenient
trying to use it in Story#domain but not in validate can ruin things
2014-06-05 07:54:48 -05:00
joshua stein 56774913c0 Story: experiment with making comment counts affect hotness 2014-05-06 21:32:17 -05:00
joshua stein 73b8df5eb7 implement story merging
closes #137
2014-04-08 17:51:12 -05:00
joshua stein 9848cf5e47 Story: export tags in json view
closes #143
2014-04-03 10:23:37 -05:00
joshua stein eec85db1f8 bump up max edit times for stories and comments
not really any harm in letting people correct mistakes
2014-04-02 13:14:08 -05:00
joshua stein 7fb75af7fe simplify Story.find_similar_by_url arel, only pull undeleted stories 2014-03-28 10:45:01 -05:00
joshua stein bb9c9c5353 don't include hiders in story vote summary 2014-03-24 10:26:07 -05:00
joshua stein 6f30d99581 shrink story hotness window to 24 hours 2014-03-24 10:26:07 -05:00
joshua stein 7f9c227ed0 bring back story downvoting, remove low quality option
story hiding is still here, so hopefully this will result in less
bogus story downvotes
2014-03-24 10:26:06 -05:00
joshua stein 8b60e5fd63 show story hider count on story detail page 2014-03-13 10:51:12 -05:00
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