-
Notifications
You must be signed in to change notification settings - Fork 24
Postmovement #80
base: master
Are you sure you want to change the base?
Postmovement #80
Changes from 7 commits
03bae0d
a95fa1a
c7fc246
2739bef
eefd50e
f3721e5
afe23b1
582d9fd
ac9ed72
fa13a33
b7e7355
91d0c4e
bedd944
cf10a31
2edef55
33a3850
2124bd7
9bdf974
ce3d6ff
5e5f092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,30 +129,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 | ||
|
|
||
|
|
@@ -542,11 +562,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 (1, 7): | ||
|
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. What are types 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. Comment and Link. Maybe... could ask the comment and link classes for their type ids. 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. As it turns out yes. Changed. |
||
| 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: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,6 +167,13 @@ | |
| %if thing.can_ban: | ||
|
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. Why is this shown if 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. can_ban already is that flag. I'm against renaming it, it seems pretty self explanatory. |
||
| <li class="move"> | ||
| ${parent.simple_button("move", fullname, _("Move"), "move", tool_tip=_("Move"))} | ||
| %endif | ||
| %if c.user_is_loggedin and not thing.author == c.user: | ||
| <li class='subscribe'> | ||
| ${parent.state_button("commentsubscribe", fullname, _("Subscribe"), \ | ||
| "return change_state_by_class(this, '%s', 'mod')"%("commentunsubscribe" if thing.comment_subscribed(c.user, thing) else "commentsubscribe"), \ | ||
| _("Subscribed"), a_class="subscription"+(" mod" if thing.comment_subscribed(c.user, thing) else ""), \ | ||
| tool_tip = "No longer receive notifications for this comment" if thing.comment_subscribed(c.user, thing) else "Get notifications of immediate replies on this comment")} | ||
| </li> | ||
| %endif | ||
| </ul> | ||
|
|
||
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.