Commit graph

65 commits

Author SHA1 Message Date
joshua stein 00d347c4f4 consolidate sql fragment to cast story/comment score 2015-01-28 15:02:40 -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 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 31d4e97858 implement hats
https://lobste.rs/s/bkeYe9/about_lobsters/comments/ZD2tL3#c_ZD2tL3
2014-11-14 14:12:29 -06:00
joshua stein 5b94406640 Comment: include page anchor in urls 2014-11-14 12:46:09 -06: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 99c551cbfe move initial upvote of submitted story to Story model 2014-03-03 17:13:00 -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 9918660ab4 Comment: alpha sort methods, no functional changes 2014-02-17 10:01:44 -06:00
Serge Paquet 519427586a use Rails4-style strong parameters mass assignment protection 2014-02-02 15:41:38 -05:00
joshua stein 71eeb6c7d2 be a good pushover user and let the user specify a sound
- move pushover particulars into User model
- Pushover class rescues errors, don't need to do it from User
2014-01-21 01:21:02 -06:00
Serge Paquet 79b64c3883 use standard create/update comment routes 2014-01-20 16:52:19 -05:00
Serge Paquet 41c9dfad5d fix DOM structure when replying to or updating comments 2014-01-20 16:52:19 -05:00
Serge Paquet e2c266af4b simplify Comment#arrange_for_user method 2014-01-08 23:48:24 -05: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 40e4c10e26 fix busted PM e-mail notifications
do e-mail and pushover deliveries separately, catch and log errors
from each

closes #90
2014-01-08 20:42:24 -06:00
joshua stein 345388079e Merge pull request #83 from srgpqt/sphinx
upgrade thinking-sphinx gem; requires sphinx >= 2.0.6
2014-01-07 10:17:31 -08:00
joshua stein ce495470c6 double max comment edit time to 90 minutes 2014-01-07 11:42:20 -06:00
Serge Paquet 709b0bff98 upgrade thinking-sphinx gem 2014-01-07 05:52:29 -05: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 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 7e0fc989d1 move countinual comment logging to model
comments can come in from other places than the controller now
2013-06-30 00:54:02 -05:00
joshua stein fd41bfa566 start on mailing list interface 2013-06-30 00:54:02 -05:00
joshua stein ed512cc065 move comment thread_id generation to Comment 2013-06-30 00:54:02 -05:00
joshua stein c9571dabaf back out 9ece666 removing utf8mb4 hacks, no longer needed 2013-05-26 12:32:54 -05:00
Jon Evans 0a48959cda Pull short id generation into separate class 2013-01-22 23:15:05 -07:00
joshua stein 10abf0bd7b don't deliver mention or reply notifications to posting user 2013-01-07 16:29:00 -06:00
joshua stein 11385d6b65 add json view of story, including comments
for issue #42
2012-12-30 12:17:59 -06:00
joshua stein 19ba94fd31 don't collapse moderated threads, remove them entirely 2012-12-30 12:11:47 -06:00
joshua stein f7cac129b4 when comments are moderated, collapse their replies
also try to show which moderator deleted the comment and the reason
2012-12-18 21:36:32 -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 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 24ed0e1f6f only count downvotes in downvote summary 2012-10-09 11:04:53 -05:00
joshua stein c4f1a5e756 we're not doing comment flagging, remove 2012-10-09 11:04:43 -05:00
joshua stein cb5e05c461 minor cleanups after last merge 2012-09-16 15:51:25 -05:00
joshua stein 17d8213bc7 merge @username mentions and notifications from @rjsamson 2012-09-16 15:41:21 -05:00
joshua stein 45a498ea51 comments have an initial upvote of 1, which has a non-zero confidence 2012-09-14 15:54:45 -05:00
Robert J Samson ec1bcb9704 Added mentions in comments using @username convention. @username is linked to user profile in comment text, and notifications are available via email and pushover (with notification preferences) when a user is mention. 2012-09-10 13:40:33 -04:00
joshua stein 5a72a9d6a7 if a comment is downvoted, show the comment's user a summary of its downvote reasons 2012-09-03 12:42:32 -05:00
joshua stein e6c74e8251 add moderation logging
- add users.is_moderator and look at that for most things, not
is_admin

- make default user in readme be a moderator

- log moderator actions in story edits, comment
  deletions/undeletions (and later, user disabling).

- remove ability for moderators to edit comments, there's really no
  reason to.
2012-09-02 12:18:52 -05:00
joshua stein 776bf89dea implement /comments.rss 2012-08-24 11:41:37 -05:00
joshua stein 70db7a5879 short ids in urls should be case insensitive, so make them that way anyway 2012-08-24 11:41:37 -05:00
joshua stein 33e6eee4e0 don't count deleted comments for stories, update comment counts after comment del/undel 2012-08-24 11:41:37 -05:00
joshua stein 3640e1e7a3 comment deleting and undeleting 2012-08-24 11:41:37 -05:00
joshua stein abb8392c16 search engine! 2012-08-24 11:41:36 -05:00
joshua stein b9c8f1d371 oops, confidence desc 2012-08-24 11:41:36 -05:00