evazion
a5ecda2f0e
post_test.rb: fix voting tests.
2017-03-24 15:43:55 -05:00
evazion
3dc854c0c8
post_vote.rb: determine vote magnitude from voter, not CurrentUser.
...
Bug: when moving favorites, the parent is given an upvote for each gold+
favoriter, but the magnitude of these upvotes was based on the
CurrentUser, rather than the upvoter. This meant that upvotes for
supervoter favorites weren't given correctly.
To fix this, `magnitude` is changed to use the voting `user` instead of
CurrentUser.
New problem: when setting the score, `score=` calls `magnitude`, but
`user` isn't initialized yet. So we also refactor so that
1. `initialize_attributes` initializes `user` before setting `score`
2. the vote direction is given by `vote`, so it's separate from `score`
3. updating the score on the post happens in a callback instead of
directly in `score=`.
2017-03-24 15:43:55 -05:00
evazion
07707b257a
post.rb: make non-gold supervoters upvote when fav'ing a post.
2017-03-24 15:43:55 -05:00
evazion
fd24ea5876
posts.rb: vote on behalf of correct user when moving favorites.
...
Bug: when an approver moves the favorites of a post, each favorite is
removed from the child post and added to the parent post. For gold+
users, this triggers an upvote, but these upvotes were performed by the
approver rather than the favoriter.
2017-03-24 15:43:28 -05:00
evazion
73b19bee05
Fix exception in h(post.source) when source is nil.
...
Fixes this exception:
TypeError exception raised
no implicit conversion of nil into String
app/presenters/presenter.rb:3:in `escapeHTML'
app/presenters/presenter.rb:3:in `h'
app/presenters/post_presenter.rb:91:in `data_attributes'
app/presenters/post_presenter.rb:24:in `preview'
app/presenters/post_set_presenters/base.rb:15:in `block in post_previews_html'
app/presenters/post_set_presenters/base.rb:14:in `post_previews_html'
app/views/posts/partials/index/_posts.html.erb:3:in `_app_views_posts_partials_index__posts_html_erb___2716396856929289512_70158315986180'
app/views/posts/index.html.erb:39:in `_app_views_posts_index_html_erb__1345252938355811220_70158296799280'
app/controllers/posts_controller.rb:16:in `index'
2017-03-24 00:26:54 -05:00
Albert Yi
db09acf8a4
Merge pull request #2932 from evazion/fix-reltags-sqs
...
sqs_service.rb: fix exception when related tags sqs not configured.
2017-03-23 10:46:45 -07:00
Albert Yi
7f7f843763
Merge pull request #2933 from evazion/feat-doc-cosplay-autotags
...
Fix #2931 : mention automated implications on *_(cosplay) wikis.
2017-03-23 10:46:20 -07:00
Albert Yi
f30f21f891
Merge pull request #2934 from evazion/opt-mod-dashboard
...
/moderator/dashboard: optimize sql queries
2017-03-23 10:45:37 -07:00
evazion
66b5dc641c
/moderator/dashboard: use PostPresenter.preview for appeal thumbnails.
2017-03-23 04:05:06 -05:00
evazion
246eb1e8ab
db: add created_at indexes on post_appeals, artist/note/wiki_page versions,
...
This optimizes queries on /moderator/dashboard that filter by creation date.
2017-03-23 04:05:06 -05:00
evazion
d1d0fe9bc5
/moderator/dashboard: optimize sql queries
...
* Converts queries to use active record instead of raw sql. This ensures
that user objects are loaded by rails in the join, so that we
don't have to issue `User.find` calls to load users one-by-one.
* Use `.includes` to preload associations used in the view, to avoid
additional N+1 query problems (primarily, calls to link_to_user
also causing users to be loaded one-by-one).
2017-03-23 04:05:05 -05:00
evazion
90cd029f6f
wiki excerpts: show alias/implication lists even for tags without a wiki.
2017-03-23 03:54:42 -05:00
evazion
8918e301b4
alias_and_implication_list: add help links for aliases/implications.
2017-03-23 03:36:16 -05:00
evazion
267d70bd52
Fix #2931 : mention automated implications on *_(cosplay) wikis.
2017-03-23 03:35:27 -05:00
evazion
f40e50d915
sqs_service.rb: fix exception when related tags sqs not configured.
...
Fixes this exception when Danbooru.config.aws_sqs_enabled? is true but
Danborou.config.aws_sqs_reltagcalc_url is not configured:
ArgumentError exception raised
missing required parameter params[:queue_url]
app/logical/sqs_service.rb:11:in `send_message'
app/models/tag.rb:674:in `update_related_if_outdated'
app/models/tag.rb:698:in `related_tag_array'
app/presenters/post_set_presenters/post.rb:49:in `related_tags_for_single'
app/presenters/post_set_presenters/post.rb:19:in `related_tags'
app/presenters/post_set_presenters/post.rb:8:in `initialize'
app/logical/post_sets/post.rb:181:in `new'
app/logical/post_sets/post.rb:181:in `presenter'
app/views/posts/index.html.erb:14:in `_app_views_posts_index_html_erb___3235672853362939702_47243208308540'
app/controllers/posts_controller.rb:16:in `index'
2017-03-23 03:20:33 -05:00
evazion
4fde2a26fb
post.rb: handle automatic *_(cosplay) tags in TagImplication.
2017-03-23 02:48:03 -05:00
evazion
0793beded9
alias_and_implication_list: refactor alias/implication lookup.
...
Add alias and implications associations to Tag. Use them in
alias_and_implication list instead of duplicating the alias/implication
lookup code.
2017-03-23 02:47:21 -05:00
r888888888
b3e3012a9c
link to upload advice thread for deleted posts
2017-03-22 16:33:14 -07:00
r888888888
19a82bde30
fix syntax error
2017-03-22 14:24:06 -07:00
r888888888
bd3dfc73c0
fix queue for bulk reverts
2017-03-21 17:13:51 -07:00
Albert Yi
30cef2e5e5
Merge pull request #2929 from evazion/fix-post-events-mods
...
Fix exceptions on /posts/:id/events, /moderator/dashboard; fix XSS in data-source.
2017-03-21 16:19:06 -07:00
r888888888
c4b5998e64
fixes #2692 : Rework bookmarklet preview
2017-03-21 15:41:20 -07:00
evazion
d1debecd0b
Fix XSS in post thumbnail data attributes.
2017-03-21 17:17:19 -05:00
evazion
2aa3f9ceba
/moderator/dashboard: fix exception when PostArchive isn't enabled.
...
NoMethodError exception raised
undefined method `each' for nil:NilClass
app/views/moderator/dashboards/_activity_tag.html.erb:10:in `_app_views_moderator_dashboards__activity_tag_html_erb__4366063041301266690_47304449138520'
app/views/moderator/dashboards/show.html.erb:10:in `_app_views_moderator_dashboards_show_html_erb___734721021521262965_47304462731220'
2017-03-21 17:17:19 -05:00
evazion
47ecf034a7
/posts/:id/events - fix exception when viewed by mod.
...
NoMethodError exception raised
undefined method `creator' for #<PostEvent:0x007f9a298e64d8> Did you mean? creator_id
app/views/post_events/index.html.erb:23:in `block in _app_views_post_events_index_html_erb__2088986421112502721_70150054247640'
app/views/post_events/index.html.erb:18:in `each'
app/views/post_events/index.html.erb:18:in `_app_views_post_events_index_html_erb__2088986421112502721_70150054247640'
app/controllers/post_events_controller.rb:6:in `index'
2017-03-21 17:17:18 -05:00
r888888888
022d9ede7f
expose bulk revert interface
2017-03-21 14:40:46 -07:00
r888888888
91c21b1bac
fixes #2880 : Change link from User page "Comments in xxxx posts" to comment_bumped
2017-03-21 14:05:32 -07:00
r888888888
23da9c6f89
fixes #2911
2017-03-21 13:56:48 -07:00
r888888888
c6fe1f7f54
remove tag check
2017-03-20 16:24:31 -07:00
r888888888
70d057f8f3
move saved search option to sidebar
2017-03-20 16:19:15 -07:00
r888888888
73895a1a27
make saved searches table sortable
2017-03-20 15:44:33 -07:00
r888888888
c90de90291
increase range of s3 proxy
2017-03-20 14:01:19 -07:00
r888888888
7c6243bca0
remove unused listbooru check in session loader
2017-03-20 13:52:54 -07:00
Albert Yi
baa1760b3d
Merge pull request #2928 from evazion/feat-flagger-commenter-ips
...
Make commenter/flagger/appealer IPs visible to mods
2017-03-20 13:46:08 -07:00
Albert Yi
cae86d8290
add role check for displaying ip address
2017-03-20 13:45:56 -07:00
Albert Yi
fece0e3c82
Merge pull request #2927 from evazion/fix-post-events-resolved
...
/posts/:id/events: list is_resolved correctly for appeals.
2017-03-20 13:33:36 -07:00
Albert Yi
9389d1a3a0
Merge pull request #2926 from evazion/fix-mod-dashboard
...
Fix post version reference on /moderator/dashboard
2017-03-20 12:31:30 -07:00
Albert Yi
fe9f31d871
remove timeout block
...
PostArchive isn't subject to statement timeouts so it isn't needed
2017-03-20 12:31:08 -07:00
Albert Yi
3cfacec4bf
Merge pull request #2924 from evazion/feat-hidden-notice
...
/posts: add notice when posts are hidden.
2017-03-20 12:30:15 -07:00
Albert Yi
56bb1d7ba9
Merge pull request #2923 from evazion/feat-source-xml
...
Add /sources.xml endpoint; include backtraces in json
2017-03-20 12:27:07 -07:00
Albert Yi
92fe0c7b7c
Merge pull request #2922 from evazion/fix-artcomm-fetch-source
...
When merging artcomms, list source as html page url, not image url.
2017-03-20 12:22:18 -07:00
evazion
85d1f18ba5
comments: make commenter ip addresses visible to mods.
2017-03-19 23:41:25 -05:00
evazion
396d466a9b
/posts/:id - make flagger/appealer ip addresses visible to mods.
2017-03-19 23:41:09 -05:00
evazion
5ba1df5502
/posts/:id/events: list is_resolved correctly for appeals.
...
/posts/:id/events incorrectly lists appeals as always being resolved.
This is because events UNION together appeals and flags, which doesn't
quite work because for appeals is_resolved is a method, not an
attribute. is_resolved was hardcoded to true so it'd work in the UNION.
This changes PostEvent to be a wrapper object around PostFlag /
PostAppeal, instead of a UNION. PostEvent delegates everything to the
inner flag/appeals object, so that is_resolved works correctly.
Also, this incidentally fixes a problem with /posts/:id/event.xml not
serializing correctly.
2017-03-19 22:47:10 -05:00
evazion
8341752931
fixup! /moderator/dashboard: fix post version reference.
2017-03-19 17:02:39 -05:00
evazion
cebf592e20
/moderator/dashboard: fix post version reference.
2017-03-18 05:18:01 -05:00
r888888888
d22d655d43
fix Post#set_tag_counts
2017-03-17 19:10:55 -07:00
r888888888
f1ba075bea
support disable_cache for Tag.categories_for
2017-03-17 18:41:33 -07:00
r888888888
5cef0321f2
switch to use Cache.get_multi for tag types
2017-03-17 18:36:53 -07:00
r888888888
c5cfca3a3c
fix bug with mobile styles
2017-03-17 16:59:58 -07:00