This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Postmovement #80
Open
LucasSloan
wants to merge
20
commits into
bellroy:master
Choose a base branch
from
LucasSloan:postmovement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Postmovement #80
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
03bae0d
Moderators can now move comment threads between posts.
LucasSloan a95fa1a
Children of original movers now hidden for non-admins.
LucasSloan c7fc246
Made it impossible to vote on moved items.
LucasSloan 2739bef
Status message removed in the event of failed call.
LucasSloan eefd50e
Entering an properly formatted URL that doesn't lead to a post sends …
LucasSloan f3721e5
Changed movebox doc string, renamed Link._byURL to Link._move_url.
LucasSloan afe23b1
Added a lock to movement.
LucasSloan 582d9fd
Changed move proceedure to no longer create new comments. All calls …
LucasSloan ac9ed72
Removed debugging statements, moved boolean.
LucasSloan fa13a33
Safed movement against editor trying to move children of already move…
LucasSloan b7e7355
Merge branch 'interesting_comments' of https://github.com/PotatoDumpl…
LucasSloan 91d0c4e
Descendant karma attribute no longer disappears off python objects.
LucasSloan bedd944
Merge branch 'interesting_comments' of https://github.com/PotatoDumpl…
LucasSloan cf10a31
Thread movement now properly increments descendant karma.
LucasSloan 2edef55
Descendant karma attribute no longer disappears off python objects.
LucasSloan 33a3850
Merge branch 'interesting_comments' of https://github.com/PotatoDumpl…
LucasSloan 2124bd7
Changed testing syntax.
LucasSloan 9bdf974
Merge branch 'postmovement' of https://github.com/PotatoDumplings/les…
LucasSloan ce3d6ff
Merge branch 'master' of https://github.com/tricycle/lesswrong into p…
LucasSloan 5e5f092
Variety of small changes for readability.
LucasSloan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,30 +130,50 @@ def get_rel_type_table(metadata): | |
|
||
|
||
def get_thing_table(metadata, name): | ||
table = sa.Table(settings.DB_APP_NAME + '_thing_' + name, metadata, | ||
sa.Column('thing_id', BigInteger, primary_key = True), | ||
sa.Column('ups', sa.Integer, default = 0, nullable = False), | ||
sa.Column('downs', | ||
sa.Integer, | ||
default = 0, | ||
nullable = False), | ||
sa.Column('deleted', | ||
sa.Boolean, | ||
default = False, | ||
nullable = False), | ||
sa.Column('spam', | ||
sa.Boolean, | ||
default = False, | ||
nullable = False), | ||
sa.Column('date', | ||
sa.DateTime(timezone = True), | ||
default = sa.func.now(), | ||
nullable = False)) | ||
if name in ('comment', 'link'): | ||
table.append_column(sa.Column('descendant_karma', | ||
sa.Integer, | ||
default = 0, | ||
nullable = False)) | ||
if name not in ('comment', 'link'): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you've caused a fair bit of duplication here. Why is this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just adding the column doesn't work. |
||
table = sa.Table(settings.DB_APP_NAME + '_thing_' + name, metadata, | ||
sa.Column('thing_id', BigInteger, primary_key = True), | ||
sa.Column('ups', sa.Integer, default = 0, nullable = False), | ||
sa.Column('downs', | ||
sa.Integer, | ||
default = 0, | ||
nullable = False), | ||
sa.Column('deleted', | ||
sa.Boolean, | ||
default = False, | ||
nullable = False), | ||
sa.Column('spam', | ||
sa.Boolean, | ||
default = False, | ||
nullable = False), | ||
sa.Column('date', | ||
sa.DateTime(timezone = True), | ||
default = sa.func.now(), | ||
nullable = False)) | ||
else: | ||
table = sa.Table(settings.DB_APP_NAME + '_thing_' + name, metadata, | ||
sa.Column('thing_id', BigInteger, primary_key = True), | ||
sa.Column('ups', sa.Integer, default = 0, nullable = False), | ||
sa.Column('downs', | ||
sa.Integer, | ||
default = 0, | ||
nullable = False), | ||
sa.Column('deleted', | ||
sa.Boolean, | ||
default = False, | ||
nullable = False), | ||
sa.Column('spam', | ||
sa.Boolean, | ||
default = False, | ||
nullable = False), | ||
sa.Column('date', | ||
sa.DateTime(timezone = True), | ||
default = sa.func.now(), | ||
nullable = False), | ||
sa.Column('descendant_karma', | ||
sa.Integer, | ||
default = 0, | ||
nullable = False)) | ||
|
||
return table | ||
|
||
|
@@ -543,11 +563,19 @@ def get_thing(type_id, thing_id): | |
#if single, only return one storage, otherwise make a dict | ||
res = {} if not single else None | ||
for row in r: | ||
stor = storage(ups = row.ups, | ||
downs = row.downs, | ||
date = row.date, | ||
deleted = row.deleted, | ||
spam = row.spam) | ||
if type_id in (types_name["link"].type_id, types_name["comment"].type_id): | ||
stor = storage(ups = row.ups, | ||
downs = row.downs, | ||
date = row.date, | ||
deleted = row.deleted, | ||
spam = row.spam, | ||
descendant_karma = row.descendant_karma) | ||
else: | ||
stor = storage(ups = row.ups, | ||
downs = row.downs, | ||
date = row.date, | ||
deleted = row.deleted, | ||
spam = row.spam) | ||
if single: | ||
res = stor | ||
else: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pylons gives me an error here when I try to move a comment thread to a different article:
I had created a couple of articles while on the master branch, then switched to the postmovement branch and tried to move some comments around and got this error. Perhaps it is relying on something that is not being set by current (in production) code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to run a script in the sql folder to add descendant karma to the SQL database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, you need #94.