208 Commits

Author SHA1 Message Date
xray7224
d461fbe5cb Use the the slug as the UUID instead of a newly generated UUID 2014-07-22 23:13:14 +01:00
Jessica Tallon
5b014a0866 Add image URL's (thumb & full) 2014-07-22 23:13:14 +01:00
Jessica Tallon
c8bd2542d7 Fixes where User id in API would return url rather than host 2014-07-22 23:13:14 +01:00
Jessica Tallon
a840d2a848 Adds comments for the MediaEntry api 2014-07-22 23:13:14 +01:00
Jessica Tallon
bdde87a4b3 Changes serialization to .serialize method on object - MediaEntry 2014-07-22 23:13:14 +01:00
Jessica Tallon
2b7b9de32e Make sure new media has a new uuid added on 2014-07-22 23:13:14 +01:00
Jessica Tallon
e590179ab6 Adds migration on MediaEntry to add uuid 2014-07-22 23:13:13 +01:00
Jessica Tallon
d7b3805f2d Starts the user (profile) endpoint and lays groundwork for inbox and feed endpoint 2014-07-22 23:13:13 +01:00
Jessica Tallon
637b966ac2 Adds seralize on user 2014-07-22 23:13:13 +01:00
Tryggvi Bjorgvinsson
09bed9a732 Use unicode for logging comments
The comment problems detailed in issue 791 are related to logging
of comments creation. The log tries to format unicode comments into
an ascii string (that is the unicode comment content).

This also creates problems with mark seen functionality since that
also logs the comments which breaks and you end up with a lot of
international comments in your message queue.

This commit makes both log messages unicode as well as the
representation of the comment.
2014-07-18 15:27:35 +01:00
Jessica Tallon
892eed590f Fix #894 - index User.username field
This commit sponsored by Emily O'Leary.  Thank you!
2014-07-17 10:21:29 -05:00
Berker Peksag
e2cb0f86fe Remove sqlalchemy-migrate imports from the codebase. Do not touch tests yet. 2014-06-27 03:17:12 +03:00
Christopher Allan Webber
987a63514f Explicitly set the column names to "user" and "privilege" 2014-06-11 11:01:17 -05:00
Christopher Allan Webber
c56a88b43e Switch "user_id" to "privilege" and "privilege_id" to "user".
This builds on the previous code Natalie wrote, but makes some changes:
 - More direct alterations for non-sqlite code
 - In both cases, I've made it so that we switched the field names from
   privilege_id and user_id to user and privilege respectively.  This
   way we can do the name swap, but in one case it's "easy": just
   changing the name.  (In the sqlite case it's still tricky though.)
2014-06-10 18:02:34 -05:00
Christopher Allan Webber
70bceff85f Merge remote-tracking branch 'refs/remotes/tilly-q/ticket-874' into mergetest
Conflicts:
	mediagoblin/db/migrations.py
2014-06-10 16:48:45 -05:00
Berker Peksag
e49b7e02b2 Use six.text_type instead of unicode().
I will be switch to use ``from __future__ import unicode_literals`` later.
2014-06-02 20:59:28 +03:00
Berker Peksag
386c9c7c55 Use six.iteritems() instead of dict.iteritems(). 2014-05-26 19:50:38 +03:00
tilly-Q
c8abeb58af Set a default value to MediaEntry.media_metadata 2014-05-14 11:56:59 -04:00
Berker Peksag
f6a700e8ae Fix some compat issues in mediagoblin/db/models.py. 2014-05-08 20:32:02 +03:00
tilly-Q
9adef07e8f Made the columns properly referenced in models and migrations. 2014-04-23 14:59:53 -04:00
tilly-Q
7918f86ac0 Renamed the columns on core__privileges_users table so that they are unique and
will not cause any more problems.
2014-04-22 14:36:23 -04:00
tilly-Q
0bfb4089cc Changed the name of the metadata column 2014-04-21 12:11:11 -04:00
tilly-Q
9f3dc83a6c Moved the metadata column to MediaEntry rather than MediaFile 2014-04-21 12:11:11 -04:00
tilly-Q
2dd966b5e2 In this commit, I added a new column which will be used for RDFa metadata of
media.
2014-04-21 12:07:59 -04:00
tilly-Q
9412fffef1 I went through the code and just removed some blank spaces. I also looked it
thru and it looked great.
2013-11-19 15:14:14 -05:00
Josie
7dfcc538d3 Addressed ticket number 630 by removing MediaEntry.collected 2013-11-18 20:05:15 -05:00
Christopher Allan Webber
56c4ad89eb Merge remote-tracking branch 'refs/remotes/tilly-q/OPW-Moderation-Update'
Conflicts:
	mediagoblin/templates/mediagoblin/user_pages/user.html
	mediagoblin/tests/test_auth.py
	mediagoblin/tests/test_submission.py
2013-10-07 15:48:33 -05:00
tilly-Q
9519c0a91f In this commit, I mostly did work on the migrations. Firstly, I droppped the
vestigial columns from the User table (ie. status, email_verified, is_admin).
Otherwise, I did a lot of work converting my existing migrations from high-
level ORM commands to low-level SQL commands to ensure that the migrating will
work regardless of what stage their instance is working in. I also re-integrated
my two registered migrations into one. Because the migration became very long, I
also added a lot of clarifying documentation.
2013-10-03 16:13:12 -04:00
tilly-Q
6483b37060 At this point, I am very close to done with this code! I made one big change at
paroneayea's request, which was to make to possible to turn off user's ability
to file reports through a mediagoblin.ini setting. Aside from this, I had to
make it possible for the Moderation User Panel to display more than 10 users.
And aside from that, I just had to fix some errors which cropped up with my
most recent additions. I also fixed some tests that were broken because I had
changed the checks for whether or not a user is active. Nearing the end!

===============================================================================
    Made it possible to turn off reports through a mediagoblin.ini setting
===============================================================================
--\ mediagoblin.ini
--\ mediagoblin/config_spec.ini
--\ mediagoblin/decorators.py
--\ mediagoblin/moderation/views.py
--\ mediagoblin/templates/mediagoblin/user_pages/media.html
--\ mediagoblin/user_pages/views.py

===============================================================================
    Made User Panel capable of showing more than 1 page of users
===============================================================================
--\ mediagoblin/moderation/forms.py
--\ mediagoblin/moderation/views.py
--\ mediagoblin/templates/mediagoblin/moderation/user_panel.html

===============================================================================
        Fixed Broken Tests
===============================================================================
--\ mediagoblin/tests/test_notifications.py
--\ mediagoblin/tests/test_openid.py
--\ mediagoblin/tests/test_persona.py
--\ mediagoblin/tests/test_reporting.py

===============================================================================
        Fixed errors in code
===============================================================================
--\ mediagoblin/db/migrations.py
--| Set nullable to True for MediaReports' and CommentReports' content foreign
  |keys

--\ mediagoblin/db/models.py
--| Got rid of cascading rules for MediaReports' and CommentReports' content
  |foreign keys. This makes it possible for the Reports to continue to exist
  |after the content is deleted.

--\ mediagoblin/moderation/tools.py
--| Fixed formatting of Report Resolution Methods
--| Took out pieces of code used in debugging

--\ mediagoblin/templates/mediagoblin/base.html
--\ mediagoblin/templates/mediagoblin/moderation/report.html
--| Made reports details page able to tell what is a deleted archived report.

--\ mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\ mediagoblin/templates/mediagoblin/utils/report.html
2013-09-23 13:20:18 -04:00
Rodney Ewing
3dc6184167 remove a blank line 2013-09-19 08:18:02 -07:00
Rodney Ewing
42dbb26a13 not all JSONEncoded fields should be mutable dicts 2013-09-19 08:12:11 -07:00
Rodney Ewing
f4f84297ef make all JSONEncoded columns mutable 2013-09-19 08:12:10 -07:00
Rodney Ewing
7f9d3ca7c9 need to use mutation tracking to detect changes in JSONEncoded types 2013-09-19 08:12:09 -07:00
Rodney Ewing
b643a9cd80 skip image resizing if possible 2013-09-19 08:11:39 -07:00
Rodney Ewing
4502dfca89 get and set metadata for a MediaFile 2013-09-19 08:11:06 -07:00
Christopher Allan Webber
529eb17b38 Merge remote-tracking branch 'refs/remotes/rodney757/reprocessing'
Conflicts:
	mediagoblin/db/migrations.py
2013-09-18 14:45:23 -05:00
Christopher Allan Webber
28eab59ace Merge remote-tracking branch 'refs/remotes/rodney757/file_limits'
Conflicts:
	mediagoblin/db/migrations.py
2013-09-18 11:21:57 -05:00
tilly-Q
045fe0ee9d Merge branch 'master' into OPW-Moderation-Update
Conflicts:
	mediagoblin/db/migrations.py
2013-09-12 18:58:04 -04:00
tilly-Q
c906887025 In this commit, I'm deleting the ArchivedReports object, at paroneyea's recom-
-mendation. Instead, all of its functionality will be in the ReportBase object.
2013-09-11 17:09:21 -04:00
tilly-Q
6acf4ee60e This should be my final code update before I am ready for review! Basically, in
this update I finished the search/sort function on the Reports Panel. I also
finished the Terms of Service and made the decision to remove the meta portion
of the site I had planned to create. I decided that the features involved were
just unnecessary at this point. I also dropped the User status column and added
a migration to establish default privileges (and create the privilege foundat-
-ions. I fixed a few small errors that were left over as well, in the implemen-
tation and in the tests. Next, I just need to await code review and work on the
documentation for these new features. I also need to supervise a new merge to
master.

===============================================================================
    Dropped the vestigial 'status' column
===============================================================================
--\ mediagoblin/db/migrations.py
--\ mediagoblin/db/models.py
--| Also added in comments describing the current situation with the `is_admin`
  | and `email_verified` columns, where they are 100% vestigial but cannot be
  | dropped.

===============================================================================
            Wrote necessary migrations to set up Privilege
    foundations and give users the necessary privileges on an older
     implementation of mediagoblin that is migrating into this update
===============================================================================
--\ mediagoblin/db/migrations.py

===============================================================================
    Deleted the meta pages
===============================================================================
--\ Deleted mediagoblin/meta/__init__.py
--\ Deleted mediagoblin/meta/routing.py
--\ Deleted mediagoblin/meta/views.py
--\ Deleted mediagoblin/templates/mediagoblin/meta/code_of_conduct.html
--\ Deleted mediagoblin/templates/mediagoblin/meta/reports_details.html
--\ Deleted mediagoblin/templates/mediagoblin/meta/reports_panel.html
    ----------------------------------------------------------------
        Moved the terms of service to /terms_of_service
    ----------------------------------------------------------------
    --\ Moved mediagoblin/templates/mediagoblin/meta/terms_of_service.html
        -> mediagoblin/templates/mediagoblin/terms_of_service.html
    --| I decided that terms of service were really the only necessary part of my
      | planned "meta" pages, so I moved it instead to its own singular page
    --\ mediagoblin/routing.py
    --\ mediagoblin/static/css/base.css
    --\ mediagoblin/templates/mediagoblin/base.html
    --\ mediagoblin/views.py

===============================================================================
          Simplified & Finished the Reports Panel Searching
===============================================================================
--\ mediagoblin/moderation/forms.py
--\ mediagoblin/moderation/tools.py
--\ mediagoblin/moderation/views.py
--\ mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\ mediagoblin/templates/mediagoblin/moderation/user.html

===============================================================================
                  Fixed Small Errors
===============================================================================
--\ mediagoblin/templates/mediagoblin/user_pages/user.html
--\ mediagoblin/tests/test_moderation.py
--\ mediagoblin/tests/tools.py

===============================================================================
2013-09-10 13:17:07 -04:00
tilly-Q
25625107b6 This was a quick update, I mostly worked on the transition from using the old
User table columns (is_admin, status, email_verified) and making sure that
their functionality is instead completely handled by privileges. I also worked
on the meta pages which I hope to finish soon. I set up migrations to ensure
the default privileges are given to users that should have them. Lastly, I made
it so that banned users can log out.

===============================================================================
    Made Sure the Vestigial Columns of the User Table were not being Used
===============================================================================
--\ mediagoblin/auth/views.py
--\ mediagoblin/db/models.py
--\ mediagoblin/templates/mediagoblin/base.html
--\ mediagoblin/templates/mediagoblin/moderation/user.html
--\ mediagoblin/templates/mediagoblin/user_pages/collection_lis$
--\ mediagoblin/templates/mediagoblin/user_pages/user.html
--\ mediagoblin/tests/test_auth.py
--\ mediagoblin/tests/test_persona.py
--\ mediagoblin/user_pages/views.py

===============================================================================
    Wrote the Migrations to Set up the Default Privileges
===============================================================================
--\ mediagoblin/db/migrations.py
--\ mediagoblin/gmg_commands/users.py

===============================================================================
    Work on the Meta Pages
===============================================================================
--\ mediagoblin/meta/routing.py
--\ mediagoblin/meta/views.py
--\ mediagoblin/static/css/base.css
--\ mediagoblin/templates/mediagoblin/meta/terms_of_service.html

===============================================================================
    Small Changes
===============================================================================
--\ mediagoblin/templates/mediagoblin/base.html
--| Benevolently made it so that banned users can log out

===============================================================================
X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
===============================================================================
2013-09-08 18:26:37 -04:00
tilly-Q
8e91df8734 I did some more code-keeping in this commit. I added a lot of documentation, so
that most of my functions do indeed have effective docstrings. I also changed
the decorators so that they imply eachother in a logical way. I also modified
the one decorator get_media_comment_by_id to be more usable with the variable
urls of mediagoblin.user_pages.views:file_a_report. I also noticed a few tests
had broken, so I went through them and fixed them up, finding that mostly there
were problems in my actual writing of the tests. I also did a few other small
tasks such as creating a new User method to check whether or not a User is ban-
-ned.

===============================================================================
    Added in documentation
===============================================================================
--\  mediagoblin/db/models.py
--\  mediagoblin/decorators.py
--\  mediagoblin/moderation/forms.py
--\  mediagoblin/moderation/tools.py
--\  mediagoblin/moderation/views.py
--\  mediagoblin/user_pages/lib.py

===============================================================================
    Rearranged decorators to be more efficient
===============================================================================
--\  mediagoblin/decorators.py
--| Made it so that user_not_banned is encapsulated in require_active_login
--| Made it so that require_active_login is encapsulated in user_has_privilege
--| Changed get_media_comment_by_id into get_optional_media_comment_by_id. It
  | now returns valid code if the MediaComment id is absent. This makes it pos-
  | -sible to use this decorator for the function:
  |         mediagoblin.user_pages.views:file_a_report

--\  mediagoblin/user_pages/views.py
--| Replaced the mediagoblin.user_pages.views:file_a_comment_report with the
  | decorator mentioned above

--\  mediagoblin/user_pages/routing.py

        -----------------------------------------------------------
        |     took out unnecessary @user_not_banned decorators    |
        -----------------------------------------------------------
--\  mediagoblin/submit/views.py
--\  mediagoblin/user_pages/views.py

===============================================================================
    Fixed broken tests
===============================================================================
--\  mediagoblin/tests/test_auth.py
--\  mediagoblin/tests/test_privileges.py
--\  mediagoblin/tests/test_submission.py

===============================================================================
    Fixed broken code
===============================================================================
--\  mediagoblin/tools/response.py

===============================================================================
    Other Tasks
===============================================================================
--\  mediagoblin/db/models.py
--| Added in User.is_banned() method
--\  mediagoblin/decorators.py
--| Utitilized User.is_banned() method in the user_not_banned decorator

--\  mediagoblin/moderation/views.py
--| Made it impossible for an admin to ban themself.
--| Got rid of a vestigial print statement

--\  mediagoblin/templates/mediagoblin/base.html
--| Made it so the top panel does not show up for users that are banned.

--\  mediagoblin/templates/mediagoblin/moderation/user.html
--| Rearranged the javascript slightly

===============================================================================
2013-09-03 16:19:07 -04:00
tilly-Q
1bb367f613 This is a quick commit. I gave admins the ability to ban or unban users
straight from the moderation.users_detail page. I also changed the
UserBan.expiration_date type from DateTime into Date. I also began work on the
Terms of Service, pulled from another website (which will be cited clearly
before I'm done). I added new tests as well for the ban/unbanning. Lastly,
I added a few `user_not_banned` decorators to relevant views, so banned users
cannot access any pages.
2013-08-29 17:31:19 -04:00
tilly-Q
dfd66b789c This was a big commit! I included lots of documentation below, but generally I
did a few things. I wrote many many many new tests, either in old test files or
in the three new test files I made. I also did some code-keeping work, deleting
trailing whitespace and deleting vestigial code. Lastly, I fixed the parts of
the code which I realized were broken thru the process of running tests.

===============================================================================
 Deleted trailing whitespace:
===============================================================================
--\  mediagoblin/decorators.py
--\  mediagoblin/auth/tools.py
--\  mediagoblin/db/migrations.py
--\  mediagoblin/db/models.py
--\  mediagoblin/gmg_commands/users.py
--\  mediagoblin/moderation/forms.py
--\  mediagoblin/moderation/tools.py
--\  mediagoblin/moderation/views.py
--\  mediagoblin/templates/mediagoblin/moderation/media_panel.html
--\  mediagoblin/templates/mediagoblin/moderation/report.html
--\  mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\  mediagoblin/templates/mediagoblin/moderation/user.html
--\  mediagoblin/templates/mediagoblin/moderation/user_panel.html
--\  mediagoblin/templates/mediagoblin/user_pages/report.html
--\  mediagoblin/templates/mediagoblin/utils/report.html
--\  mediagoblin/user_pages/lib.py
--\  mediagoblin/user_pages/views.py
===============================================================================
 Deleted Vestigial Code
===============================================================================
--\  mediagoblin/db/util.py
--\  mediagoblin/tests/test_notifications.py
===============================================================================
 Modified the Code:
===============================================================================
--\  mediagoblin/moderation/tools.py
--| Encapsulated the code around giving/taking away privileges into two
  | funtions.

--\  mediagoblin/moderation/views.py
--| Imported and used the give/take away privilege functions
--| Replaced 'require_admin_or_moderator_login' with
  |'user_has_privilege(u"admin")' for adding/taking away privileges, only
  | admins are allowed to do this.

--\  mediagoblin/templates/mediagoblin/banned.html
--| Added relevant translation tags
--| Added ability to display indefinite banning

--\  mediagoblin/templates/mediagoblin/user_pages/media.html
--| Made sure the add comments button was only visible for users with the
  | `commenter` privilege

--\  mediagoblin/tests/test_submission.py
--| Paroneayea fixed a DetachedInstanceError I was having with the our_user
  | function

--\  mediagoblin/tests/tools.py
--| Added a fixture_add_comment_report function for testing.

--\  mediagoblin/tools/response.py
--| Fixed a minor error where a necessary return statement was missing
--| Fit the code within 80 columns

--\  mediagoblin/user_pages/views.py
--| Added a necessary decorator to ensure that only users with the 'commenter'
  | privilege can post comments
===============================================================================
 Wrote new tests for an old test file:
===============================================================================
--\  mediagoblin/tests/test_auth.py
--| Added a new test to make sure privilege granting on registration happens
  | correctly

--\  mediagoblin/tests/test_modelmethods.py*
--| Added a test to ensure the User method has_privilege works properly
===============================================================================
 Wrote entirely new files full of tests:
===============================================================================
--\  mediagoblin/tests/test_moderation.py
--\  mediagoblin/tests/test_privileges.py
--\  mediagoblin/tests/test_reporting.py
===============================================================================
===============================================================================
NOTE: Any files I've marked with a * in this commit report, were actually subm-
itted in my last commit. I made that committ to fix an error I was having, so
they weren't properly documented in that report.
===============================================================================
===============================================================================
2013-08-29 13:47:50 -04:00
Rodney Ewing
bdd2242155 added user upload limits 2013-08-26 06:33:28 -07:00
Rodney Ewing
e2b5634549 skip image resizing if possible 2013-08-21 14:44:18 -07:00
Rodney Ewing
e002452f91 get and set metadata for a MediaFile 2013-08-21 14:44:13 -07:00
tilly-Q
2c901db023 This commit was just to fix a few of the errors with the merging and to
make sure that all of the previous tests work fine.
2013-08-20 15:24:29 -04:00
tilly-Q
9e204e49c9 Merge branch 'master' into OPW-Moderation-Update
Conflicts:
	mediagoblin/db/models.py
	mediagoblin/decorators.py
	mediagoblin/routing.py
	mediagoblin/user_pages/views.py
2013-08-20 12:21:13 -04:00
tilly-Q
e1561d0488 This was a very small update, I'm hoping to rebase after this to solve some
other problems. I started looking at the tests in this update. This update I
spent fixing the tests to work with my new code.

--\ mediagoblin/db/migration_tools.py
--| Merging from ticket 679

--\ mediagoblin/db/migrations.py
--| Added unique constraint to Privilege.privilege_name

--\ mediagoblin/db/models.py
--| Deleted vestigial Privilege.is_admin_or_moderator method

--\ mediagoblin/templates/mediagoblin/moderation/user.html
--| Add a `Ban User` / `UnBan User` for admin

--\ mediagoblin/test/test_api.py
--| Fixed test with my new changes

--\ mediagoblin/test/test_auth.py
--| Try to fix test, still having problems

--\ mediagoblin/test/test_modelmethods.py
--| Wrote my first test for the User.has_privilege method

--\ mediagoblin/test/test_modelmethods.py
--| Fixed test with my new changes

--\ mediagoblin/test/test_sqlmigrations.py
--| Merging from ticket 679

--\ mediagoblin/test/tools.py
--| Editted add_fixture_user to allow for privileges rather than active column
2013-08-20 12:02:20 -04:00