I've moved on to one of the last phases of my work! Now I'm just checking off

items from my last to-do list. The biggest change in this commit is that I made
the moderation reports panel sortable via get request. I also added in page nu-
mbers so that more than 10 reports can be viewed. I'm hoping to go from here to
make a search page. Aside from that, there were only a few other changes I made
this time. I fixed two bugs in my code. I copy-ed and pasted function
mediagoblin.user_pages.views:media_preview_comment which I must've deleted ear-
-lier in a merge. And I moved some of the javascript I was using in the modera-
-tion templates into it's own seperate .js file.

===============================================================================
    Made the moderation reports panel view sortable
===============================================================================
--\ mediagoblin/moderation/forms.py
--\ mediagoblin/moderation/views.py
--\ mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\ mediagoblin/templates/mediagoblin/moderation/user.html
--|  Made `<user> report history` into a link that automatically shows all open
  | and closed reports on <user>.

===============================================================================
    Grabbed some code from master that I accidentally deleted in a merge
===============================================================================
--\ mediagoblin/user_pages/views.py

===============================================================================
    Moved javascript away from templates into its own file
===============================================================================
--\ mediagoblin/static/js/setup_report_forms.js
--\ mediagoblin/templates/mediagoblin/moderation/report.html
--\ mediagoblin/templates/mediagoblin/moderation/user.html

===============================================================================
    Cleared trailing white space
===============================================================================
--\ mediagoblin/templates/mediagoblin/moderation/media_panel.html
--\ mediagoblin/moderation/tools.py
--\ mediagoblin/templates/mediagoblin/meta/terms_of_service.html
--\ mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\ mediagoblin/templates/mediagoblin/user_pages/media.html
--\ mediagoblin/tests/test_modelmethods.py

===============================================================================
    Small fixes
===============================================================================
--\ mediagoblin/templates/mediagoblin/moderation/report.html
--|  Fixed a link so that it points to the correct user page

--\ mediagoblin/templates/mediagoblin/user_pages/media.html
--|  Fixed a bug that crashed this page when a guest visitted it (because
  | request.user is None)
This commit is contained in:
tilly-Q 2013-09-03 11:57:10 -04:00
parent 1bb367f613
commit dc31cd1b65
12 changed files with 351 additions and 204 deletions

View File

@ -67,3 +67,23 @@ class ReportResolutionForm(wtforms.Form):
validators=[wtforms.validators.optional()])
resolution_content = wtforms.TextAreaField()
class ReportPanelSortingForm(wtforms.Form):
active_p = wtforms.IntegerField(
_(u'Page'),
validators=[wtforms.validators.optional()])
active_reported_user = wtforms.IntegerField(
_(u'Reported User'),
validators=[wtforms.validators.optional()])
active_reporter = wtforms.IntegerField(
_(u'Reporter'),
validators=[wtforms.validators.optional()])
closed_p = wtforms.IntegerField(
_(u'Page'),
validators=[wtforms.validators.optional()])
closed_reported_user = wtforms.IntegerField(
_(u'Reported User'),
validators=[wtforms.validators.optional()])
closed_reporter = wtforms.IntegerField(
_(u'Reporter'),
validators=[wtforms.validators.optional()])

View File

@ -163,7 +163,7 @@ def give_privileges(user,*privileges):
def ban_user(user_id, expiration_date=None, reason=None):
"""
This function is used to ban a user. If the user is already banned, the
function returns False. If the user is not already banned, this function
function returns False. If the user is not already banned, this function
bans the user using the arguments to build a new UserBan object.
:returns False if the user is already banned and the ban is not updated
@ -177,7 +177,7 @@ def ban_user(user_id, expiration_date=None, reason=None):
user_id=user_id,
expiration_date=expiration_date,
reason=reason)
return new_user_ban
return new_user_ban
def unban_user(user_id):
"""

View File

@ -26,6 +26,7 @@ from mediagoblin.moderation import forms as moderation_forms
from mediagoblin.moderation.tools import (take_punitive_actions, \
take_away_privileges, give_privileges, ban_user, unban_user)
from datetime import datetime
from math import ceil
@require_admin_or_moderator_login
def moderation_media_processing_panel(request):
@ -91,19 +92,47 @@ def moderation_reports_panel(request):
Show the global panel for monitoring reports filed against comments or
media entries for this instance.
'''
report_list = ReportBase.query.filter(
ReportBase.discriminator!="archived_report").order_by(
ReportBase.created.desc()).limit(10)
closed_report_list = ReportBase.query.filter(
ReportBase.discriminator=="archived_report").order_by(
ReportBase.created.desc()).limit(10)
form = moderation_forms.ReportPanelSortingForm(request.args)
active_settings = {'start_page':1, 'filters':{}}
closed_settings = {'start_page':1, 'filters':{}}
if form.validate():
active_settings['start_page'] = form.active_p.data or 1
active_settings['filters']['reported_user_id'] = form.active_reported_user.data
active_settings['filters']['reporter_id'] = form.active_reporter.data
closed_settings['start_page'] = form.closed_p.data or 1
closed_settings['filters']['reported_user_id'] = form.closed_reported_user.data
closed_settings['filters']['reporter_id'] = form.closed_reporter.data
active_settings['filters']=dict((k, v) for k, v in active_settings['filters'].iteritems() if v)
closed_settings['filters']=dict((k, v) for k, v in closed_settings['filters'].iteritems() if v)
active_filter = [
getattr(ReportBase,key)==val \
for key,val in active_settings['filters'].viewitems()]
closed_filter = [
getattr(ReportBase,key)==val \
for key,val in active_settings['filters'].viewitems()]
all_active = ReportBase.query.filter(
ReportBase.discriminator!="archived_report").filter(
*active_filter)
all_closed = ReportBase.query.filter(
ReportBase.discriminator=="archived_report").filter(
*closed_filter)
report_list = all_active.order_by(
ReportBase.created.desc()).offset((active_settings['start_page']-1)*10).limit(10)
closed_report_list = all_closed.order_by(
ReportBase.created.desc()).offset((closed_settings['start_page']-1)*10).limit(10)
active_settings['last_page'] = int(ceil(all_active.count()/10.))
closed_settings['last_page'] = int(ceil(all_closed.count()/10.))
# Render to response
return render_to_response(
request,
'mediagoblin/moderation/report_panel.html',
{'report_list':report_list,
'closed_report_list':closed_report_list})
'closed_report_list':closed_report_list,
'active_settings':active_settings,
'closed_settings':closed_settings})
@require_admin_or_moderator_login
def moderation_reports_detail(request):

View File

@ -0,0 +1,67 @@
/**
* GNU MediaGoblin -- federated, autonomous media hosting
* Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init_report_resolution_form() {
hidden_input_names = {
'takeaway':['take_away_privileges'],
'userban':['user_banned_until','why_user_was_banned'],
'sendmessage':['message_to_user']
}
init_user_banned_form();
$('form#resolution_form').hide()
$('#open_resolution_form').click(function() {
$('form#resolution_form').toggle();
$.each(hidden_input_names, function(key, list){
$.each(list, function(index, name){
$('label[for='+name+']').hide();
$('#'+name).hide();
});
});
});
$('#action_to_resolve').change(function() {
$('ul#action_to_resolve li input:checked').each(function() {
$.each(hidden_input_names[$(this).val()], function(index, name){
$('label[for='+name+']').show();
$('#'+name).show();
});
});
$('ul#action_to_resolve li input:not(:checked)').each(function() {
$.each(hidden_input_names[$(this).val()], function(index, name){
$('label[for='+name+']').hide();
$('#'+name).hide();
});
});
});
$("#submit_this_report").click(function(){
submit_user_banned_form()
});
}
function submit_user_banned_form() {
if ($("#user_banned_until").val() == 'YYYY-MM-DD'){
$("#user_banned_until").val("");
}
}
function init_user_banned_form() {
$('#user_banned_until').val("YYYY-MM-DD")
$("#user_banned_until").focus(function() {
$(this).val("");
$(this).unbind('focus');
});
}

View File

@ -2,242 +2,242 @@
<h2>Terms of Service</h2>
The following terms and conditions govern all use of the
{{ app_config['html_title'] }} website and all content, services and products
The following terms and conditions govern all use of the
{{ app_config['html_title'] }} website and all content, services and products
available at or through the website (taken together, the Website). The Website
is owned and operated by Status.net (“Operator”). The Website is offered
subject to your acceptance without modification of all of the terms and
conditions contained herein and all other operating rules, policies
(including, without limitation, Operators Privacy Policy) and procedures
is owned and operated by Status.net (“Operator”). The Website is offered
subject to your acceptance without modification of all of the terms and
conditions contained herein and all other operating rules, policies
(including, without limitation, Operators Privacy Policy) and procedures
that may be published from time to time on this Site by Operator (collectively,
the “Agreement”).
Please read this Agreement carefully before accessing or using the Website. By accessing or using any part of the web site, you agree to become bound by the terms and conditions of this agreement. If you do not agree to all the terms and conditions of this agreement, then you may not access the Website or use any services. If these terms and conditions are considered an offer by Operator, acceptance is expressly limited to these terms. The Website is available only to individuals who are at least 13 years old.
<ol>
<li>Your {{ app_config['html_title'] }} Account and Site. If you create a
notice stream on the Website, you are responsible for maintaining the
security of your account and notice stream, and you are fully responsible
<li>Your {{ app_config['html_title'] }} Account and Site. If you create a
notice stream on the Website, you are responsible for maintaining the
security of your account and notice stream, and you are fully responsible
for all activities that occur under the account and any other actions taken
in connection with the notice stream. You must not describe or assign
keywords to your notice stream in a misleading or unlawful manner,
including in a manner intended to trade on the name or reputation of
others, and Operator may change or remove any description or keyword that
it considers inappropriate or unlawful, or otherwise likely to cause
Operator liability. You must immediately notify Operator of any
in connection with the notice stream. You must not describe or assign
keywords to your notice stream in a misleading or unlawful manner,
including in a manner intended to trade on the name or reputation of
others, and Operator may change or remove any description or keyword that
it considers inappropriate or unlawful, or otherwise likely to cause
Operator liability. You must immediately notify Operator of any
unauthorized uses of your notice stream, your account or any other breaches
of security. Operator will not be liable for any acts or omissions by You,
including any damages of any kind incurred as a result of such acts or
of security. Operator will not be liable for any acts or omissions by You,
including any damages of any kind incurred as a result of such acts or
omissions.
</li>
<li>Responsibility of Contributors. If you operate a notice stream, comment
on a notice stream, post material to the Website, post links on the
Website, or otherwise make (or allow any third party to make) material
available by means of the Website (any such material, “Content”), You are
<li>Responsibility of Contributors. If you operate a notice stream, comment
on a notice stream, post material to the Website, post links on the
Website, or otherwise make (or allow any third party to make) material
available by means of the Website (any such material, “Content”), You are
entirely responsible for the content of, and any harm resulting from, that
Content. That is the case regardless of whether the Content in question
Content. That is the case regardless of whether the Content in question
constitutes text, graphics, an audio file, or computer software. By making
Content available, you represent and warrant that:
<ul>
<li>the downloading, copying and use of the Content will not infringe
the proprietary rights, including but not limited to the copyright,
<li>the downloading, copying and use of the Content will not infringe
the proprietary rights, including but not limited to the copyright,
patent, trademark or trade secret rights, of any third party;
</li>
<li>if your employer has rights to intellectual property you create, you
have either (i) received permission from your employer to post or make
available the Content, including but not limited to any software, or
available the Content, including but not limited to any software, or
(ii) secured from your employer a waiver as to all rights in or to the
Content;
</li>
<li>you have fully complied with any third-party licenses relating to the
Content, and have done all things necessary to successfully pass
Content, and have done all things necessary to successfully pass
through to end users any required terms;
</li>
<li>the Content does not contain or install any viruses, worms, malware,
Trojan horses or other harmful or destructive content;
</li>
<li>the Content is not spam, and does not contain unethical or unwanted
commercial content designed to drive traffic to third party sites or
boost the search engine rankings of third party sites, or to further
unlawful acts (such as phishing) or mislead recipients as to the
<li>the Content is not spam, and does not contain unethical or unwanted
commercial content designed to drive traffic to third party sites or
boost the search engine rankings of third party sites, or to further
unlawful acts (such as phishing) or mislead recipients as to the
source of the material (such as spoofing);
</li>
<li>if the Content is machine- or randomly-generated, it is for purposes
of direct entertainment, information and/or utility for you or other
of direct entertainment, information and/or utility for you or other
users, and not for spam,
</li>
<li>the Content is not libelous or defamatory (more info on what that
<li>the Content is not libelous or defamatory (more info on what that
means), does not contain threats or incite violence towards individuals
or entities, and does not violate the privacy or publicity rights of
or entities, and does not violate the privacy or publicity rights of
any third party;
</li>
<li>your notice stream is not getting advertised via unwanted electronic
messages such as spam links on newsgroups, email lists, other notice
messages such as spam links on newsgroups, email lists, other notice
streams and web sites, and similar unsolicited promotional methods;
</li>
<li>your notice stream is not named in a manner that misleads your
readers into thinking that you are another person or company. For
example, your notice streams URL or name is not the name of a person
<li>your notice stream is not named in a manner that misleads your
readers into thinking that you are another person or company. For
example, your notice streams URL or name is not the name of a person
other than yourself or company other than your own; and
</li>
<li>you have, in the case of Content that includes computer code,
accurately categorized and/or described the type, nature, uses and
effects of the materials, whether requested to do so by Operator or
<li>you have, in the case of Content that includes computer code,
accurately categorized and/or described the type, nature, uses and
effects of the materials, whether requested to do so by Operator or
otherwise.</li>
</ul>
By submitting Content to Operator for inclusion on your Website, you grant
Operator a world-wide, royalty-free, and non-exclusive license to
Operator a world-wide, royalty-free, and non-exclusive license to
reproduce, modify, adapt and publish the Content solely for the purpose of
displaying, distributing and promoting your notice stream.
By submitting Content to Operator for inclusion on your Website, you grant
all readers the right to use, re-use, modify and/or re-distribute the
all readers the right to use, re-use, modify and/or re-distribute the
Content under the terms of the Creative Commons Attribution 3.0.
If you delete Content, Operator will use reasonable efforts to remove it
from the Website, but you acknowledge that caching or references to the
If you delete Content, Operator will use reasonable efforts to remove it
from the Website, but you acknowledge that caching or references to the
Content may not be made immediately unavailable.
Without limiting any of those representations or warranties, Operator has
the right (though not the obligation) to, in Operators sole discretion
(i) refuse or remove any content that, in Operators reasonable opinion,
Without limiting any of those representations or warranties, Operator has
the right (though not the obligation) to, in Operators sole discretion
(i) refuse or remove any content that, in Operators reasonable opinion,
violates any Operator policy or is in any way harmful or objectionable, or
(ii) terminate or deny access to and use of the Website to any individual
(ii) terminate or deny access to and use of the Website to any individual
or entity for any reason, in Operators sole discretion.
</li>
<li>Responsibility of Website Visitors. Operator has not reviewed, and cannot
review, all of the material, including computer software, posted to the
Website, and cannot therefore be responsible for that materials content,
use or effects. By operating the Website, Operator does not represent or
imply that it endorses the material there posted, or that it believes such
material to be accurate, useful or non-harmful. You are responsible for
taking precautions as necessary to protect yourself and your computer
systems from viruses, worms, Trojan horses, and other harmful or
destructive content. The Website may contain content that is offensive,
indecent, or otherwise objectionable, as well as content containing
technical inaccuracies, typographical mistakes, and other errors. The
Website may also contain material that violates the privacy or publicity
rights, or infringes the intellectual property and other proprietary
rights, of third parties, or the downloading, copying or use of which is
subject to additional terms and conditions, stated or unstated. Operator
review, all of the material, including computer software, posted to the
Website, and cannot therefore be responsible for that materials content,
use or effects. By operating the Website, Operator does not represent or
imply that it endorses the material there posted, or that it believes such
material to be accurate, useful or non-harmful. You are responsible for
taking precautions as necessary to protect yourself and your computer
systems from viruses, worms, Trojan horses, and other harmful or
destructive content. The Website may contain content that is offensive,
indecent, or otherwise objectionable, as well as content containing
technical inaccuracies, typographical mistakes, and other errors. The
Website may also contain material that violates the privacy or publicity
rights, or infringes the intellectual property and other proprietary
rights, of third parties, or the downloading, copying or use of which is
subject to additional terms and conditions, stated or unstated. Operator
disclaims any responsibility for any harm resulting from the use by
visitors of the Website, or from any downloading by those visitors of
visitors of the Website, or from any downloading by those visitors of
content there posted.
</li>
<li>Content Posted on Other Websites. We have not reviewed, and cannot
<li>Content Posted on Other Websites. We have not reviewed, and cannot
review, all of the material, including computer software, made available
through the websites and webpages to which {{ app_config['html_title'] }}
links, and that link to {{ app_config['html_title'] }}. Operator does not
have any control over those external websites and webpages, and is not
responsible for their contents or their use. By linking to a external
website or webpage, Operator does not represent or imply that it endorses
such website or webpage. You are responsible for taking precautions as
necessary to protect yourself and your computer systems from viruses,
worms, Trojan horses, and other harmful or destructive content. Operator
disclaims any responsibility for any harm resulting from your use of
through the websites and webpages to which {{ app_config['html_title'] }}
links, and that link to {{ app_config['html_title'] }}. Operator does not
have any control over those external websites and webpages, and is not
responsible for their contents or their use. By linking to a external
website or webpage, Operator does not represent or imply that it endorses
such website or webpage. You are responsible for taking precautions as
necessary to protect yourself and your computer systems from viruses,
worms, Trojan horses, and other harmful or destructive content. Operator
disclaims any responsibility for any harm resulting from your use of
external websites and webpages.
</li>
<li>Copyright Infringement and DMCA Policy. As Operator asks others to
respect its intellectual property rights, it respects the intellectual
property rights of others. If you believe that material located on or
linked to by {{ app_config['html_title'] }} violates your copyright, you
are encouraged to notify Operator in accordance with Operators Digital
Millennium Copyright Act (”DMCA”) Policy. Operator will respond to all
such notices, including as required or appropriate by removing the
infringing material or disabling all links to the infringing material. In
the case of a visitor who may infringe or repeatedly infringes the
<li>Copyright Infringement and DMCA Policy. As Operator asks others to
respect its intellectual property rights, it respects the intellectual
property rights of others. If you believe that material located on or
linked to by {{ app_config['html_title'] }} violates your copyright, you
are encouraged to notify Operator in accordance with Operators Digital
Millennium Copyright Act (”DMCA”) Policy. Operator will respond to all
such notices, including as required or appropriate by removing the
infringing material or disabling all links to the infringing material. In
the case of a visitor who may infringe or repeatedly infringes the
copyrights or other intellectual property rights of Operator or others,
Operator may, in its discretion, terminate or deny access to and use of
the Website. In the case of such termination, Operator will have no
Operator may, in its discretion, terminate or deny access to and use of
the Website. In the case of such termination, Operator will have no
obligation to provide a refund of any amounts previously paid to Operator.
</li>
<li>Intellectual Property. This Agreement does not transfer from Operator to
you any Operator or third party intellectual property, and all right,
you any Operator or third party intellectual property, and all right,
title and interest in and to such property will remain (as between the
parties) solely with Operator. {{ app_config['html_title'] }}, the
{{ app_config['html_title'] }} logo, and all other trademarks, service
marks, graphics and logos used in connection with
{{ app_config['html_title'] }}, or the Website are trademarks or
registered trademarks of Operator or Operators licensors. Other
trademarks, service marks, graphics and logos used in connection with the
Website may be the trademarks of other third parties. Your use of the
Website grants you no right or license to reproduce or otherwise use any
parties) solely with Operator. {{ app_config['html_title'] }}, the
{{ app_config['html_title'] }} logo, and all other trademarks, service
marks, graphics and logos used in connection with
{{ app_config['html_title'] }}, or the Website are trademarks or
registered trademarks of Operator or Operators licensors. Other
trademarks, service marks, graphics and logos used in connection with the
Website may be the trademarks of other third parties. Your use of the
Website grants you no right or license to reproduce or otherwise use any
Operator or third-party trademarks.
</li>
<li>Changes. Operator reserves the right, at its sole discretion, to modify
<li>Changes. Operator reserves the right, at its sole discretion, to modify
or replace any part of this Agreement. It is your responsibility to check
this Agreement periodically for changes. Your continued use of or access
to the Website following the posting of any changes to this Agreement
this Agreement periodically for changes. Your continued use of or access
to the Website following the posting of any changes to this Agreement
constitutes acceptance of those changes. Operator may also, in the future,
offer new services and/or features through the Website (including, the
release of new tools and resources). Such new features and/or services
offer new services and/or features through the Website (including, the
release of new tools and resources). Such new features and/or services
shall be subject to the terms and conditions of this Agreement.
</li>
<li>Termination. Operator may terminate your access to all or any part of
the Website at any time, with or without cause, with or without notice,
effective immediately. If you wish to terminate this Agreement or your
{{ app_config['html_title'] }} account (if you have one), you may simply
discontinue using the Website. All provisions of this Agreement which by
their nature should survive termination shall survive termination,
<li>Termination. Operator may terminate your access to all or any part of
the Website at any time, with or without cause, with or without notice,
effective immediately. If you wish to terminate this Agreement or your
{{ app_config['html_title'] }} account (if you have one), you may simply
discontinue using the Website. All provisions of this Agreement which by
their nature should survive termination shall survive termination,
including, without limitation, ownership provisions, warranty disclaimers,
indemnity and limitations of liability.
</li>
<li>Disclaimer of Warranties. The Website is provided “as is”. Operator and
its suppliers and licensors hereby disclaim all warranties of any kind,
express or implied, including, without limitation, the warranties of
merchantability, fitness for a particular purpose and non-infringement.
Neither Operator nor its suppliers and licensors, makes any warranty that
the Website will be error free or that access thereto will be continuous
or uninterrupted. If youre actually reading this, heres a treat. You
<li>Disclaimer of Warranties. The Website is provided “as is”. Operator and
its suppliers and licensors hereby disclaim all warranties of any kind,
express or implied, including, without limitation, the warranties of
merchantability, fitness for a particular purpose and non-infringement.
Neither Operator nor its suppliers and licensors, makes any warranty that
the Website will be error free or that access thereto will be continuous
or uninterrupted. If youre actually reading this, heres a treat. You
understand that you download from, or otherwise obtain content or services
through, the Website at your own discretion and risk.
</li>
<li>Limitation of Liability. In no event will Operator, or its suppliers or
licensors, be liable with respect to any subject matter of this agreement
under any contract, negligence, strict liability or other legal or
<li>Limitation of Liability. In no event will Operator, or its suppliers or
licensors, be liable with respect to any subject matter of this agreement
under any contract, negligence, strict liability or other legal or
equitable theory for: (i) any special, incidental or consequential damages;
(ii) the cost of procurement or substitute products or services; (iii) for
interruption of use or loss or corruption of data; or (iv) for any amounts
that exceed the fees paid by you to Operator under this agreement during
the twelve (12) month period prior to the cause of action. Operator shall
have no liability for any failure or delay due to matters beyond their
the twelve (12) month period prior to the cause of action. Operator shall
have no liability for any failure or delay due to matters beyond their
reasonable control. The foregoing shall not apply to the extent prohibited
by applicable law.
</li>
<li>General Representation and Warranty. You represent and warrant that (i)
your use of the Website will be in strict accordance with the Operator
Privacy Policy, with this Agreement and with all applicable laws and
regulations (including without limitation any local laws or regulations in
your country, state, city, or other governmental area, regarding online
<li>General Representation and Warranty. You represent and warrant that (i)
your use of the Website will be in strict accordance with the Operator
Privacy Policy, with this Agreement and with all applicable laws and
regulations (including without limitation any local laws or regulations in
your country, state, city, or other governmental area, regarding online
conduct and acceptable content, and including all applicable laws regarding
the transmission of technical data exported from the United States or the
country in which you reside) and (ii) your use of the Website will not
infringe or misappropriate the intellectual property rights of any third
the transmission of technical data exported from the United States or the
country in which you reside) and (ii) your use of the Website will not
infringe or misappropriate the intellectual property rights of any third
party.
</li>
<li>Indemnification. You agree to indemnify and hold harmless Operator, its
contractors, and its licensors, and their respective directors, officers,
employees and agents from and against any and all claims and expenses,
including attorneys fees, arising out of your use of the Website,
<li>Indemnification. You agree to indemnify and hold harmless Operator, its
contractors, and its licensors, and their respective directors, officers,
employees and agents from and against any and all claims and expenses,
including attorneys fees, arising out of your use of the Website,
including but not limited to out of your violation this Agreement.
</li>
<li>Miscellaneous. This Agreement constitutes the entire agreement between
Operator and you concerning the subject matter hereof, and they may only
be modified by a written amendment signed by an authorized executive of
Operator, or by the posting by Operator of a revised version. If any part
of this Agreement is held invalid or unenforceable, that part will be
construed to reflect the parties original intent, and the remaining
of this Agreement is held invalid or unenforceable, that part will be
construed to reflect the parties original intent, and the remaining
portions will remain in full force and effect. A waiver by either party of
any term or condition of this Agreement or any breach thereof, in any one
instance, will not waive such term or condition or any subsequent breach
instance, will not waive such term or condition or any subsequent breach
thereof. You may assign your rights under this Agreement to any party that
consents to, and agrees to be bound by, its terms and conditions; Operator
may assign its rights under this Agreement without condition. This
Agreement will be binding upon and will inure to the benefit of the
may assign its rights under this Agreement without condition. This
Agreement will be binding upon and will inure to the benefit of the
parties, their successors and permitted assigns.
</li>
</ol>
Originally published by Automattic, Inc. as the WordPress.com Terms of Service
and made available by them under the Creative Commons Attribution-
ShareAlike 3.0 License. Modifications to remove reference to "VIP services",
rename "blog" to "notice stream", remove the choice-of-venue clause, and add
ShareAlike 3.0 License. Modifications to remove reference to "VIP services",
rename "blog" to "notice stream", remove the choice-of-venue clause, and add
variables specific to instances of this software made by Control Yourself, Inc.
and made available under the terms of the same license.

View File

@ -21,6 +21,7 @@
{% trans %}Media processing panel{% endtrans %} &mdash; {{ super() }}
{%- endblock %}
{% block mediagoblin_content %}
<h1>{% trans %}Media processing panel{% endtrans %}</h1>

View File

@ -17,6 +17,9 @@
#}
{%- extends "mediagoblin/base.html" %}
{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
{%- block mediagoblin_head %}
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
{% endblock %}
{%- block mediagoblin_content %}
{% if not report %}
@ -79,7 +82,7 @@
{% trans user_name=report.reported_user.username,
user_url=request.urlgen(
'mediagoblin.moderation.users_detail',
user=report.reporter.username) %}
user=report.reported_user.username) %}
❖ Reported media by <a href="{{ user_url }}">{{ user_name }}</a>
{% endtrans %}
</p>
@ -129,50 +132,9 @@
{{ csrf_token }}
<input type=submit id="submit_this_report" value="Resolve This Report"/>
</form>
<script>
$(document).ready(function() {
hidden_input_names = {
'takeaway':['take_away_privileges'],
'userban':['user_banned_until','why_user_was_banned'],
'sendmessage':['message_to_user']
}
$('form#resolution_form').hide()
$('#user_banned_until').val("YYYY-MM-DD")
$('#open_resolution_form').click(function() {
$('form#resolution_form').toggle();
$.each(hidden_input_names, function(key, list){
$.each(list, function(index, name){
$('label[for='+name+']').hide();
$('#'+name).hide();
});
});
});
$('#action_to_resolve').change(function() {
$('ul#action_to_resolve li input:checked').each(function() {
$.each(hidden_input_names[$(this).val()], function(index, name){
$('label[for='+name+']').show();
$('#'+name).show();
});
});
$('ul#action_to_resolve li input:not(:checked)').each(function() {
$.each(hidden_input_names[$(this).val()], function(index, name){
$('label[for='+name+']').hide();
$('#'+name).hide();
});
});
});
$("#user_banned_until").focus(function() {
$(this).val("");
$(this).unbind('focus');
});
$("#submit_this_report").click(function(){
if ($("#user_banned_until").val() == 'YYYY-MM-DD'){
$("#user_banned_until").val("");
}
});
$(document).ready(function() {
init_report_resolution_form();
});
</script>
{% elif not (report.reported_user.has_privilege('admin')) %}

View File

@ -32,7 +32,37 @@
</p>
<h2>{% trans %}Active Reports Filed{% endtrans %}</h2>
{% if not active_settings.last_page == 1 %}
{% if 'active_p='~active_settings.start_page in request.query_string %}
{% set query_string = request.query_string %}{% else %}
{% set query_string =
'active_p='~active_settings.start_page~"&"+request.query_string %}
{% endif %}
<div class="right_align">
{% set first_vis = active_settings.start_page-3 %}
{% set last_vis = active_settings.start_page+3 %}
{% set curr_page = active_settings.start_page %}
{% if 1 == curr_page %}<b>1</b>{% else %}
<a href ="?{{ query_string.replace(
'active_p='~active_settings.start_page,
'active_p='~1) }}">
{{ 1 }}</a>{% endif %}
{% if first_vis > 1 %}...{% endif %}
{% for p in range(first_vis,last_vis+1) %}
{% if p > 1 and p < active_settings.last_page %}
<a href="?{{ query_string.replace(
'active_p='~active_settings.start_page,
'active_p='~p) }}">
{{ p }}</a>
{% endif %}
{% endfor %}
{% if last_vis < active_settings.last_page %}...{% endif %}
<a href ="?{{ query_string.replace(
'active_p='~active_settings.start_page,
'active_p='~active_settings.last_page) }}">
{{ active_settings.last_page }}</a>
</div>
{% endif %}
{% if report_list.count() %}
<table class="admin_panel processing">
<tr>
@ -84,6 +114,35 @@
<p><em>{% trans %}No open reports found.{% endtrans %}</em></p>
{% endif %}
<h2>{% trans %}Closed Reports{% endtrans %}</h2>
{% if not closed_settings.last_page == 1 %}
{% if 'closed_p='~closed_settings.start_page in request.query_string %}
{% set query_string = request.query_string %}{% else %}
{% set query_string =
'closed_p='~closed_settings.start_page~"&"+request.query_string %}
{% endif %}
<div class="right_align">
{% set first_vis = closed_settings.start_page-3 %}
{% set last_vis = closed_settings.start_page+3 %}
<a href ="?{{ query_string.replace(
'closed_p='~closed_settings.start_page,
'closed_p='~1) }}">
{{ 1 }}</a>
{% if first_vis > 1 %}...{% endif %}
{% for p in range(first_vis,last_vis+1) %}
{% if p > 1 and p < closed_settings.last_page %}
<a href="?{{ query_string.replace(
'closed_p='~closed_settings.start_page,
'closed_p='~p) }}">
{{ p }}</a>
{% endif %}
{% endfor %}
{% if last_vis < closed_settings.last_page %}...{% endif %}
<a href ="?{{ query_string.replace(
'closed_p='~closed_settings.start_page,
'closed_p='~closed_settings.last_page) }}">
{{ closed_settings.last_page }}</a>
</div>
{% endif %}
{% if closed_report_list.count() %}
<table class="media_panel processing">
<tr>

View File

@ -28,6 +28,9 @@
{%- endif -%}
{% endblock %}
{%- block mediagoblin_head %}
<script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
{% endblock %}
{% block mediagoblin_content -%}
{# If no user... #}
@ -127,7 +130,8 @@
{% else %}
{%- trans %}No active reports filed on {% endtrans -%} {{ user.username }}
{% endif %}
<a class="right_align">{{ user.username }}'s report history</a>
<a href="{{ request.urlgen('mediagoblin.moderation.reports') }}?active_reported_user={{user.id}}&closed_reported_user={{user.id}}"
class="right_align">{{ user.username }}'s report history</a>
<span class=clear></span>
<h2>{{ user.username }}'s Privileges</h2>
<form method=POST action="{{ request.urlgen(
@ -188,16 +192,8 @@ $(document).ready(function(){
$('.submit_button').click(function(){
$('#hidden_privilege_name').val($(this).attr('id'));
});
$('#user_banned_until').val("YYYY-MM-DD")
$("#user_banned_until").focus(function() {
$(this).val("");
$(this).unbind('focus');
});
$("#ban_user_submit").click(function(){
if ($("#user_banned_until").val() == 'YYYY-MM-DD'){
$("#user_banned_until").val("");
}
});
init_user_banned_form();
$('.ban_user_submit').click(function(){submit_user_banned_form()});
});
</script>
{% endblock %}

View File

@ -86,7 +86,7 @@
{% autoescape False %}
<p>{{ media.description_html }}</p>
{% endautoescape %}
{% if comments and request.user.has_privilege('commenter') %}
{% if comments and request.user and request.user.has_privilege('commenter') %}
{% if app_config['allow_comments'] %}
<a
{% if not request.user %}
@ -167,7 +167,7 @@
<div class="media_sidebar">
<h3>{% trans %}Added{% endtrans %}</h3>
<p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
{%- trans formatted_time=timesince(media.created) -%}
{%- trans formatted_time=timesince(media.created) -%}
{{ formatted_time }} ago
{%- endtrans -%}
</span></p>

View File

@ -47,7 +47,7 @@ class TestMediaEntrySlugs(object):
entry.id = this_id
entry.uploader = uploader or self.chris_user.id
entry.media_type = u'image'
if save:
entry.save()
@ -99,7 +99,7 @@ class TestMediaEntrySlugs(object):
u"Beware, I exist!!", this_id=9000, save=False)
entry.generate_slug()
assert entry.slug == u"beware-i-exist-test"
_real_test()
def test_existing_slug_cant_use_id_extra_junk(self, test_app):

View File

@ -199,6 +199,19 @@ def media_post_comment(request, media):
return redirect_obj(request, media)
def media_preview_comment(request):
"""Runs a comment through markdown so it can be previewed."""
# If this isn't an ajax request, render_404
if not request.is_xhr:
return render_404(request)
comment = unicode(request.form['comment_content'])
cleancomment = { "content":cleaned_markdown_conversion(comment)}
return Response(json.dumps(cleancomment))
@user_not_banned
@get_media_entry_by_id
@require_active_login