Commit Graph

37 Commits

Author SHA1 Message Date
Matt Baer 5fe1dd1731 Add SQLite query for v9 migration 2020-05-06 14:08:48 -04:00
Matt Baer b9c467558c Return transaction Begin error in v9 migration 2020-05-06 14:08:25 -04:00
Matt Baer a0e517c224 Merge branch 'develop' into optimize-drafts-fetch 2020-05-01 15:00:51 -04:00
Matt Baer ca4a576c31 Support OAuth registration with invite code
This adds any OAuth login buttons to the invite signup page, stores the invite code for the flow duration, and associates the new user with it once successfully registered.

It enables invite-only instances with OAuth-based registration.
2020-04-20 18:18:23 -04:00
Matt Baer 5de4d2086b Optimize Drafts retrieval
This adds a database index to speed up retrieval of Drafts.

It is untested with SQLite.
2020-04-09 13:54:26 -04:00
Matt Baer e51e58386e Update versions in migrations.go 2020-04-09 13:49:44 -04:00
Matt Baer 1d25b38eb7
Merge pull request #282 from writeas/patch-ap-mentions
Clean up ActivityPub mentions
2020-03-27 09:07:57 -04:00
Matt Baer 9dbba9d8c7 Make `handle` column in remoteusers NULL
This alters the V6 migration to make the column NULLable. Anyone who has already run this migration will need to manually update their database.
2020-03-24 07:59:00 -04:00
Matt Baer cf4f08b264 Merge branch 'develop' into T713-oauth-account-management 2020-03-19 12:02:33 -04:00
Matt Baer 32f3fcb859 Skip IF [TABLE] NOT EXISTS on v4 migrations
We'd like these queries to fail correctly if the tables exist.
2020-03-03 11:48:04 -06:00
Matt Baer 61ddcff2c0 Add copyright notices to fixed files 2020-03-03 11:47:38 -06:00
Matt Baer 83b2c5a21b Fix unique index on v5 SQLite migration
This index needed a unique name in order for this query to succeed.
2020-03-03 11:46:51 -06:00
Matt Baer 471ef4d403 Fix "NOT NULL column with NULL" error in v5 SQLite migration
Previously, this migration would cause the error: "Cannot add a NOT NULL
column with default value NULL". This fixes that by setting the default
value for new columns to '' (empty string). It updates the query builder
to support this, too.
2020-03-03 11:43:46 -06:00
Matt Baer bb5da1d3f5 Break up v5 table ALTERs for SQLite
Combining all operations into a single query was causing problems in
SQLite. This fixes that by breaking them up into separate queries. It
also moves one column length change to only run on MySQL, since SQLite
doesn't need it.
2020-03-03 11:40:56 -06:00
Matt Baer f1ffcf96ec Remove user_id and remote_user_id constraints in v4&v5 migrations
It's not straightforward to remove these constraints in SQLite, so this
just skips it entirely. Since both of these migrations are part of the
same WF release, this should have minimal impact on admins.
2020-03-03 11:36:30 -06:00
Matt Baer 5b2612af54 Fix `created_at` default val in v4 migration for SQLite
This previously used a default timestamp value which caused the
migration to fail for SQLite databases.
2020-03-03 11:26:23 -06:00
Matt Baer 7fe281df69 Use NULL for new attach_user_id column
Ref T713
2020-02-10 15:24:39 -05:00
Matt Baer f846cada4b Merge branch 'develop' into T713-oauth-account-management 2020-02-09 14:05:12 -05:00
Matt Baer 68d63d3fef Merge branch 'develop' into activitypub-mentions 2020-02-08 11:51:18 -05:00
Nick Gerakines c0317b4e93 Implemented oauth attach functionality, oauth detach functionality, and required data migration. T713 2020-01-15 13:16:59 -05:00
Nick Gerakines ee1473aa56 Rolling back v1 migration change as per PR feedback. T710 2020-01-02 15:36:21 -05:00
Nick Gerakines 9170c84617 Merged in final changes from PR 225 into T705-oauth-slack. T710 2019-12-31 11:48:08 -05:00
Nick Gerakines b5f716135b Changed oauth table names per PR feedback. T705 2019-12-31 11:28:05 -05:00
Nick Gerakines cf87ae9096 Code cleanup in prep for PR. T710 2019-12-30 13:32:06 -05:00
Nick Gerakines 462f87919a Feature complete on MVP slack auth integration. T710 2019-12-28 15:15:47 -05:00
Nick Gerakines bf3b6a5ba0 Unit tests, integration testing, and code cleanup for oauth support. Part of T705. 2019-12-23 14:30:32 -05:00
Matt Baer d8df15855c Merge branch 'develop' into activitypub-mentions 2019-11-26 13:19:20 -05:00
Rob Loranger f85f0751a3
address PR comments
- update error messages to be correct
- move suspended message into template and include for other pages
- check suspended status on all relevant pages and show message if
logged in user is suspended.
- fix possible nil pointer error
- remove changes to db schema files
- add version comment to migration
- add UserStatus type with UserActive and UserSuspended
- change database table to use status column instead of suspended
- update toggle suspended handler to be toggle status in prep for
possible future inclusion of further user statuses
2019-10-25 12:04:24 -07:00
Michael Demetriou bc2016f00f Fix missing commit statement in migrations/v3.go 2019-10-10 16:49:44 +03:00
Michael Demetriou db14f04b59 Redirects from the intermediate page work and if there's an old mention
there it updates the table to include the handle.

migrations WIP
2019-10-10 16:04:43 +03:00
Rob Loranger 77f7b4a522
Add account suspension features
This renders all requests for that user's posts, collections and related
ActivityPub endpoints with 404 responses.

While suspended, users may not create or edit posts or collections.

User status is listed in the admin user page

Admin view of user details shows status and now has a button to activate
or suspend a user.
2019-08-29 09:09:11 -07:00
Matt Baer 771c7acf5f Run migrations on db initialization
This makes it so we can keep all schema changes in the `migrations`
module, instead of adding them there *and* in the schema files. It
fixes #92 and should prevent these kinds of issues in the future.
2019-04-15 13:48:19 -04:00
Matt Baer 9cb0f80921 Support changing instance page titles
Now admins can choose a title for their About and Privacy pages; now
editable through the instance page editor.

This adds `title` and `content_type` fields to the `appcontent` table,
requiring a migration by running `writefreely --migrate`

The content_type field specifies that items we're currently storing in
this table are all "page"s; queries for fetching these have been updated
to filter for this type. In the future, this field will be used to
indicate when an item is a stylesheet (ref T563) or other supported
type.

Ref T566
2019-04-11 13:56:07 -04:00
Matt Baer 3a6118c207 Set up migrations table on initial setup
This includes the appmigrations table in the schema files, and inserts
the current database version when running writefreely --init-db
2019-01-24 17:08:08 -05:00
Matt Baer 01f9dc86dc Fix migrations MySQL table check 2019-01-18 11:26:55 -05:00
Matt Baer 70e823d6ab Support user invites
This includes:

- A new `user_invites` config value that determines who can generate
  invite links
- A new page for generating invite links, with new user navigation link
- A new /invite/ path that allows anyone to sign up via unique invite
  link, even if registrations are closed
- Tracking who (of registered users) has been invited by whom

It requires an updated database with `writefreely --migrate` in order to
work.

This closes T556
2019-01-18 00:05:50 -05:00
Matt Baer 47b2155f92 Add --migrate command
This runs database migrations and obviates the need for manually running
changes.

Ref T509
2019-01-17 13:53:03 -05:00