-
-
Notifications
You must be signed in to change notification settings - Fork 886
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update api tests for new moderator view * chage moderator view to be a listing type in get posts Note: Internally, the listing type is called ListingType.ModeratorView, but it's called "Moderator View" in the api endpoint * fix formatting * add support for moderator view to list comments * add api test for moderator view when listing comments * fix api test formatting * retry tests * don't filter out blocked users and communities when using moderator view * fix cargo tests failing * fix formatting * fix previous merge * Adding ModeratorView to listing_type_enums * Fixing fmt. * Adding a default to ListingType. * Upgrading to use new lemmy-js-client. --------- Co-authored-by: Nutomic <me@nutomic.com> Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: Dessalines <tyhou13@gmx.com>
- Loading branch information
1 parent
c93bde9
commit 384e55f
Showing
12 changed files
with
140 additions
and
30 deletions.
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
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
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
49 changes: 49 additions & 0 deletions
49
migrations/2023-08-29-183053_add_listing_type_moderator_view/down.sql
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
ALTER TABLE local_user | ||
ALTER default_listing_type DROP DEFAULT; | ||
|
||
ALTER TABLE local_site | ||
ALTER default_post_listing_type DROP DEFAULT; | ||
|
||
UPDATE | ||
local_user | ||
SET | ||
default_listing_type = 'Local' | ||
WHERE | ||
default_listing_type = 'ModeratorView'; | ||
|
||
UPDATE | ||
local_site | ||
SET | ||
default_post_listing_type = 'Local' | ||
WHERE | ||
default_post_listing_type = 'ModeratorView'; | ||
|
||
-- rename the old enum | ||
ALTER TYPE listing_type_enum RENAME TO listing_type_enum__; | ||
|
||
-- create the new enum | ||
CREATE TYPE listing_type_enum AS ENUM ( | ||
'All', | ||
'Local', | ||
'Subscribed' | ||
); | ||
|
||
-- alter all your enum columns | ||
ALTER TABLE local_user | ||
ALTER COLUMN default_listing_type TYPE listing_type_enum | ||
USING default_listing_type::text::listing_type_enum; | ||
|
||
ALTER TABLE local_site | ||
ALTER COLUMN default_post_listing_type TYPE listing_type_enum | ||
USING default_post_listing_type::text::listing_type_enum; | ||
|
||
-- Add back in the default | ||
ALTER TABLE local_user | ||
ALTER default_listing_type SET DEFAULT 'Local'; | ||
|
||
ALTER TABLE local_site | ||
ALTER default_post_listing_type SET DEFAULT 'Local'; | ||
|
||
-- drop the old enum | ||
DROP TYPE listing_type_enum__; | ||
|
4 changes: 4 additions & 0 deletions
4
migrations/2023-08-29-183053_add_listing_type_moderator_view/up.sql
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Update the listing_type_enum | ||
ALTER TYPE listing_type_enum | ||
ADD VALUE 'ModeratorView'; | ||
|