Commit Graph

208 Commits (main)

Author SHA1 Message Date
Dessalines 235cc8b228
Moving settings to Database. (#2492)
* Moving settings to Database.

- Moves many settings into the database. Fixes #2285
- Adds a local_site and instance table. Fixes #2365 . Fixes #2368
- Separates SQL update an insert forms, to avoid runtime errors.
- Adds TypedBuilder to all the SQL forms, instead of default.

* Fix weird clippy issue.

* Removing extra lines.

* Some fixes from suggestions.

* Fixing apub tests.

* Using instance creation helper function.

* Move forms to their own line.

* Trying to fix local_site_data, still broken.

* Fixing federation tests.

* Trying to fix check features 1.

* Addressing PR comments.

* Adding check_apub to all verify functions.
2 years ago
Nutomic 2ef0f8f5f8
implement language tags for site/community in db and api (#2434)
* implement language tags for site/community in db and api

* add api checks for valid languages

* during db migration, update existing users, sites, communities to have all languages enabled

* init new users/communities with site languages (not all languages)

* federate site/community languages

* fix tests

* when updating site languages, limit community languages to this subset

also, when making a new post and subset of user lang, community lang
contains only one item, use that as post lang

* add tests for actor_language db functions

* include language list in siteview/communityview

* Fix some of the review comments

* Some more review changes

* Add todo about boxed query

* Add default_post_language to GetCommunityResponse
2 years ago
Dessalines ae95f5928e
Adding email admins for new applications. Fixes #2271 (#2390)
* Adding email admins for new applications. Fixes #2271

* Fix error.

Co-authored-by: Nutomic <me@nutomic.com>
2 years ago
Dessalines 0aeb78b8f3
Showing # of unread comments for posts. Fixes #2134 (#2393)
* Showing # of unread comments for posts. Fixes #2134

* Fix lint.

* Forgot to remove comment list update.

* Fix clippy
2 years ago
Dessalines c9f1407429
Diesel 2.0.0 upgrade (#2452)
* Initial commit to bump diesel to 2.0.0-rc.0 and see what happens

* Add chrono feature from diesel

* db_schema crate is close to building?

* Upgrade diesel-derive-newtype

* Mostly modifying references to connections to be mutable ones; also used
new way to do migrations as suggested by the migration guide; a lot more
compiles now, though I can't figure out this tricky ToSql issue at the
moment

* Running clippy --fix

* Trying to fix drone clippy 1

* Fix clippy

* Upgrade clux-musl

* Trying to fix drone clippy 2

* Trying to fix drone clippy 3

* Trying to fix drone clippy 5

* Adding diesel table aliases, removing sql view hack. Fixes #2101

Co-authored-by: Steven Chu <stevenc1@gmail.com>
Co-authored-by: Nutomic <me@nutomic.com>
2 years ago
Nutomic 004efd5d94
Implement reports for private messages (#2433)
* Implement reports for private messages

* finish private message report view + test

* implement api for pm reports

* merge list report api calls into one, move report count to site

* fix compile error

* Revert "merge list report api calls into one, move report count to site"

This reverts commit 3bf3b06a705c6bcf2bf20d07e2819b81298790f3.

* add websocket messages for pm report created/resolved

* remove private_message_report_view

* add joinable private_message_report -> person_alias_1

* Address review comments
2 years ago
Dessalines eacd4e44cd
Adding job to drop phantom ccnew indexes. Fixes #2431 (#2432) 2 years ago
Felix Ableitner 3d0d8796ad Add language tags for comments 2 years ago
Nutomic e4a49b6eab
Tag posts and comments with language (fixes #440) (#2269)
* Tag posts and comments with language (fixes #440)

* Untangle PostView tests

* Implement test for PostView language query

* Store languages directly in database

* finish moving languages into db, it compiles

* update post_view

* serde skip Language.id field

* add local_user_language table, other changes suggested in review

* add code for local_user_discussion_language_view

* Remove unnecessary clones in db view converteres

* Fixing up some table and join issues.

* Clearing the current languages.

* Fix formatting.

* update user languages in single transaction

* proper test for user language queries

* Some fixes for all / missing user languages. (#2404)

* Some fixes for all / missing user languages.

* Adding back in transaction.

* fix test

Co-authored-by: Dessalines <tyhou13@gmx.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2 years ago
Dessalines 870abf8442
Adding distinguish comment. Fixes #2002 (#2391)
* Adding distinguish comment. Fixes #2002

* Adding lemmy:distinguished
2 years ago
Anon 21455d6b73
Add Modlog Filters (#2313)
* Fix crash running locally on windows.

* Add support for filtering mod logs

* Refactor cleanup

* Clippy fix

* Condense match statements

* Clippy fix 2
2 years ago
Dessalines 9c3efe32e7
First pass at adding comment trees. (#2362)
* First pass at adding comment trees.

- Extracted comment replies into its own table.
- Added ltree column to comment
- Added parent_id param to GetComments to fetch a tree branch
- No paging / limiting yet

* Adding child_count to comment_aggregates.

* Adding parent comment update counts

* Fix unit tests.

* Comment tree paging mostly done.

* Fix clippy

* Fix drone tests wrong postgres version.

* Fix unit tests.

* Add back in delete in unit test.

* Add postgres upgrade script.

* Fixing some PR comments.

* Move update ltree into Comment::create

* Updating based on comments.

* Fix send soft fail.
2 years ago
Nutomic c78de25652
Fix length of post_report.original_post_name db field (fixes #2311) (#2315) 2 years ago
Dessalines 4e12e25c59
Adding admin purging of DB items and pictures. #904 #1331 (#1809)
* First pass at adding admin purge. #904 #1331

* Breaking out purge into 4 tables for the 4 purgeable types.

* Using CommunitySafe instead in view

* Fix db_schema features flags.

* Attempting to pass API key.

* Adding pictrs image purging

- Added pictrs_config block, for API_KEY
- Clear out image columns after purging

* Remove the remove_images field from a few of the purge API calls.

* Fix some suggestions by @nutomic.

* Add separate pictrs reqwest client.

* Update defaults.hjson

Co-authored-by: Nutomic <me@nutomic.com>
2 years ago
Nutomic 339eab01fd
Embed Peertube videos (#2261)
* Use og:video attribute for embeds, change Post.embed_html to embed_url

* fix clippy
2 years ago
Dessalines eafb3869f2
Revert "Add pending, and change use specific API response for FollowCommunity…" (#2283) 2 years ago
Dessalines 3c111b3062 Dropping default on pending column. 2 years ago
Dessalines d4ee171b08 Making community_follower.pending column not null. 2 years ago
Nutomic 9ef0efa420
Add legal information (fixes #721) (#2273) 2 years ago
Nutomic 7058cfa1cf
Implement restricted community (only mods can post) (fixes #187) (#2235)
* Implement restricted community (only mods can post) (fixes #187)

* review fixes

* fix tests
2 years ago
Rens Groothuijsen 9c1b9ff3cf
Update community statistics after post or comment is deleted by user (#2193)
* Update community statistics after post or comment is deleted by user

* Update triggers for site and person aggregates

* Restore comment counts when post is restored

* Simplify insertion/deletion trigger checks before updating statistics
2 years ago
Nutomic 7e13406979
Require registration application by default (#2229) 2 years ago
Nutomic 00b0b26dfa
Add default post listing type (fixes #2195) (#2209)
* Add default post listing type (fixes #2195)

* review fixes

* change column type
2 years ago
Dessalines 0372029e8d Changing default listing type to Local from Subscribed. 2 years ago
Dessalines 2985e88a49
Fixing generate unique changeme (#2205)
* Fixing generate unique changeme

* Fixing generate unique changeme 2

* Changing link to .invalid domain.

Co-authored-by: Nutomic <me@nutomic.com>
2 years ago
Nutomic 9f5183fe98
Add site option for default theme (#2104) 2 years ago
dayinjing 7f9b55e793
Hide community v2 (#2055)
* Initial working of hiding communities and adding a db entry for mod log

* Return mod log for hidden communities

* Clean up hidding communities PR

* use lower case like other migration files

* Formatting fix

* pass in admin id to list, make match logic the same in post_view as community_view. Dont force non null for reason

* Clean PR review stuff

* Change person_id to mod_person_id on hide community table

* Make bools optional, add a space for formating

Co-authored-by: Thor Odinson <odinson@asgard.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2 years ago
Nutomic dd865c5af5
Implement instance actor (#1798)
* Implement instance actor

* wip: make site bans federate

* finish implementation and unit tests for federated bans

* start adding api tests

* fix api test

* remve site from GetCommunityResponse

* only federate site bans originating from user's home instance

* dont expose site.private_key in api
2 years ago
Dessalines 6b1894faf0
Alpha-ordering community follows. Fixes #2062 (#2079) 2 years ago
Dessalines e36ad9d984
Removing the site creator, adding leave_admin. Fixes #1808 (#2052)
* Removing the site creator, adding leave_admin. Fixes #1808

* Making sure there's at least one admin. Fixing unit tests
2 years ago
Dessalines e65c45f152
Adding temporary bans. Fixes #1423 (#1999)
* Adding temporary bans. Fixes #1423

* Adding ban_expires to person

* Fix clippy

* Removing ban_expires from federated fields.

* Trying to add expires to blockcommunity apub.
2 years ago
Dessalines c883a49a40
First pass at invite-only migration. (#1949)
* First pass at invite-only migration.

* Implement email verification (fixes #219)

* remove unwrap

* Adding views and functionality to registration application. #209

* Add private instance site column, and back end checks.

* Adding some message fields to LoginResponse

* Adding private instance to site setup.

* A few additions:

- Add a DeleteAccount response.
- RegistrationApplicationView now has the safe LocalUserSettings.
- Adding VerifyEmail to websocket API, added a proper response type.

* Adding and reorganizing some email helpers.

* A few fixes for private sites:

- Added a check_registration_application function.
- Only send a verification email if its been changed.
- VerifyEmail now returns LoginResponse.
- Deleting the old tokens after a successful email verify.
- If port is missing on email config, display a better error message.

* Version 0.15.0-rc.3

* Adding published to email_verification table.

* Adding fixes from comments.

* Version 0.15.0-rc.4

* Adding modlog private site check.

* Version 0.15.0-rc.6

Co-authored-by: Felix Ableitner <me@nutomic.com>
2 years ago
Dessalines f6b96370b8 Fix API dupes query. #1878 3 years ago
Dessalines 46c7429429
Fixing duped report view for admins. Fixes #1933 (#1945)
* Fixing duped report view for admins. Fixes #1933

* Fixing tests.
3 years ago
Dessalines 3d08e6c1fc
Adding unique constraint for activity ap_id. Fixes #1878 (#1935)
* Adding unique constraint for activity ap_id. Fixes #1878

* Removing is_activity_already_known
3 years ago
Dessalines 05d43150bc Making public key required. Fixes #1934 3 years ago
Felix Ableitner cf214ff583 Move jwt secret from config to database (fixes #1728) 3 years ago
Dessalines 2016afc9db
User / community blocking. Fixes #426 (#1604)
* A first pass at user / community blocking. #426

* Adding unit tests for person and community block.

* Moving migration

* Fixing creator_blocked for comment queries, added tests.

* Don't let a person block themselves

* Fix post creator_blocked

* Adding creator_blocked to PersonMentionView

* Moving blocked and follows to MyUserInfo

* Rename to local_user_view

* Add moderates to MyUserInfo

* Adding BlockCommunityResponse

* Fixing name, and check_person_block

* Fixing tests.

* Using type in Blockable trait.

* Changing recipient to target, adding unfollow to block action.
3 years ago
Dessalines 6910e18a83 Adding ModTransferCommunity to modlog in API. Fixes #1437 3 years ago
Dessalines 6fbf6a684c
Make sure bots aren't included in aggregate counts (#1705)
- Fixes #1648
3 years ago
Dessalines 896ba8451c Some comment count fixes.
- Make sure an update to deleted decreases the count. Fixes #1676
- Don't allow the post creator to comment necro-bump their own post.
  Fixes #1675
3 years ago
Dessalines 6ffa291ec9
Actor name length config dess (#1672)
* Make length of user/community name configurable (fixes #1306)

* use single config value, fix migrations, increase displayname length

* remove debug statements

* add helper method for setting actor_name_max_length

* move function

* Fixing some defaults

Co-authored-by: Felix Ableitner <me@nutomic.com>
3 years ago
Dessalines fcae2189eb
Add show_new_posts_notifs setting. Fixes #1664 (#1665) 3 years ago
Dessalines 5b2be6f9df Add show_read_posts filter. Fixes #1561 3 years ago
Nutomic db1abff857
Add option to limit community creation to admins only (fixes #1586) (#1587)
* Add option to limit community creation to admins only (fixes #1586)

* address review
3 years ago
Nutomic efee2062dd
Mark accounts as bot nutomic (#1565)
* Mark account as bot. Fixes #1357

* Fix clippy

* Federate bot status using actor `type` field

* fix clippy

Co-authored-by: Dessalines <tyhou13@gmx.com>
3 years ago
Dessalines c3d64f996e
Removing community.creator column. Fixes #1504 (#1541)
* Removing community.creator column. Fixes #1504

* Fixing unit tests.

* Fixing federation tests.
3 years ago
Dessalines 7bd474a843
Adding a short site description. Fixes #1496 (#1532)
* Adding a short site description. Fixes #1496

- Renaming old description to sidebar

* Adding a back end site desc length check.
3 years ago
Nutomic a4c2421e74
Merge pull request #1537 from LemmyNet/add_users_active_monthly_community_sort
Adding users active monthly for community sort. Fixes #1527
3 years ago
Nutomic bcdbced0dd
Merge pull request #1536 from LemmyNet/change_preferred_to_display_name
Changing preferred to display name. Fixes #1211
3 years ago
Dessalines b893085d1f Adding users active monthly for community sort. Fixes #1527 3 years ago
Dessalines bf7558830f Changing preferred to display name. Fixes #1211 3 years ago
Dessalines 2f63fdbde0 Adding a setting to show / hide scores. Fixes #1503 3 years ago
Dessalines eb45bf2d0a Moving admin to person table. Fixes #1515 3 years ago
Dessalines 53ea383b4e Forgot to regenerate person_alias views 3 years ago
Dessalines 1745b64ceb Moving matrix_user_id to person table. #1438 3 years ago
Dessalines 05b485b678 Merge branch 'Mart-Bogdan-1462-jwt-revocation-on-pwd-change' into jwt_revocation_dess 3 years ago
Bogdan Mart 7b0a09e84e Merge remote-tracking branch 'origin/main' into 1462-jwt-revocation-on-pwd-change
* origin/main:
  revert Compose file version from 3.3 to 2.2
  Adding more mem limits
  bump memory limit of iframely
  Remove extra category_id s . Fixes #1429
  Fixing wrong user_ and community icon and banner urls.
  Remove category from activitypub context
  Adding a password length check to other API actions. (#1474)
  Update test script
  Use URL type in most outstanding struct fields (#1468)
  Forbid usage of unwrap
  Upgrade Rust version
  Rewrite settings implementation. Fixes #1270 (#1433)
  Rename `lemmy_structs` to `lemmy_api_structs`

# Conflicts:
#	crates/db_schema/src/source/user.rs
3 years ago
Bogdan Mart ab947f1f08 User token revocation upon password change
Added DB column validator_time and chedking that is is less then token's "Issuead at time"
Wip on #1462
3 years ago
Dessalines ddf4a667b1 ~80% done 3 years ago
Dessalines 817b4ff08e Fixing wrong user_ and community icon and banner urls.
- Fixes #1477
3 years ago
Andrew Yoon e78ba38e94
Use URL type in most outstanding struct fields (#1468)
* Use URL type in most outstanding struct fields

This fixes all known remaining cases where url fields are stored as
plain strings, with the exception of form fields where empty strings
are used as sentinels (see `diesel_option_overwrite_to_url`).

Tested for regressions in the federated docker setup attempting to
exercise all changed fields, including through apub federation.

Fixes #1385

* Add migration to fix blank-string post.url values to be null

This also then fixes #602

* Address review feedback

- Fixed some unwraps and err message formatting
- Bumped the `url` library to 2.2.1 to fix a bug with serde error
  messages
- Add unit tests for the two diesel option override functions
- Fix migration teardown by adding a no-op

* Rename lemmy_db_queries::Url to lemmy_db_queries::DbUrl

* fix compile error

* box PostOrComment variants
3 years ago
Dessalines efc9047f87 Done with user->person migrations, now to code. 3 years ago
Dessalines aba32917bd Merge branch 'main' into split_user_table 3 years ago
Felix Ableitner 72783edb17 In remove categories down migration, add default for category 3 years ago
Felix Ableitner 3141ad31de Remove categories (fixes #1429) 3 years ago
Dessalines 8088055d38
Fix aggregates time columns 2 (#1427)
* Adding a new comment sort. Fixes #1294

* Fixing a migration comment.

* Adding a comment for newest_comment_time_necro

* Make sure federated items set correct aggregates fields in trigger.

- Fixes #1402
3 years ago
Dessalines 0c4b57a6d0
Adding a new comment sort for posts. Fixes #1294 (#1425)
* Adding a new comment sort. Fixes #1294

* Fixing a migration comment.

* Adding a comment for newest_comment_time_necro
3 years ago
Dessalines a183815870 Adding a few more tables. 3 years ago
Dessalines d0bd02eea0 Starting on user_ to person migration. 3 years ago
nutomic 1a4e35eb50 Store activitypub endpoints in database (#162)
Address review comments

Store Activitypub urls in database (fixes #808)

Co-authored-by: Felix Ableitner <me@nutomic.com>
Reviewed-on: https://yerbamate.ml/LemmyNet/lemmy/pulls/162
Co-Authored-By: nutomic <nutomic@noreply.yerbamate.ml>
Co-Committed-By: nutomic <nutomic@noreply.yerbamate.ml>
3 years ago
Dessalines 6bb4f0b41f
Adding forum sort for post_aggregates. Fixes #1312 (#1400)
* Adding forum sort for post_aggregates. Fixes #1312

* Changing sort name from forum to MostComments.
3 years ago
Dessalines 0fd0279543
Adding some recurring lemmy tasks. (#1386)
* Adding some recurring lemmy tasks.

- Add active users by day, week, month, and half year to site and
  community. Fixes #1195
- Periodically re-index the aggregates tables that use hot_rank.
  Fixes #1384
- Clear out old activities (> 6 months). Fixes #1133

* Some cleanup, recalculating actives every hour.
3 years ago
Nutomic 3d578f9df2
Use Url type for ap_id fields in database (fixes #1364) (#1371) 3 years ago
Dessalines 8f61a148f6 Fixing comment count necro-bump issue. 3 years ago
Dessalines 4fdcb57753 Report only local counts in site_view.
- Move open_registrations under top level.
- Fixes #1340
3 years ago
Dessalines 7a97fc370b Adding stickied to post_aggregates.
- Added more indexes to account for sorting by stickied first.
- Changed all order bys in the diesel views to use post_aggregates.
3 years ago
Dessalines d227000de3 Halfway done with hot rank indexes. 3 years ago
Dessalines a27b7f8d1f Fix site aggs. 3 years ago
Dessalines 2d7d9cf7d8 Some API cleanup, adding site_id to site aggregates. 3 years ago
Dessalines 6d96f105c6 Dropping the unecessary views and table triggers. 3 years ago
Dessalines 4f5e51beb5 Removing fast tables and old views. 3 years ago
Dessalines e4714627a4 Beginning to add new comment_view. 3 years ago
Dessalines bdd264cd5e Adding tests for post aggregates. 3 years ago
Dessalines eef93440d0 Starting to add post_view. 3 years ago
Dessalines dabcfca67b Adding tests for current aggregates. 3 years ago
Dessalines e371ec1dc4 Adding user aggregates tests. 3 years ago
Dessalines 9884927b8a Adding site aggregates unit test. 3 years ago
Dessalines f5bef3980a Adding hot rank function, possibly fixing views. 3 years ago
Dessalines efdcbc44c4 Starting to work on community view, 2 4 years ago
Dessalines 6d8f93d8a1 More user aggregates. 4 years ago
Dessalines d66f4e8ac0 Finishing up user aggregates. 4 years ago
Dessalines 37e7f1a9a8 Starting to work on user aggs. 4 years ago
Dessalines 7731479607 Adding SiteAggregates. 4 years ago
Dessalines ca7224c086 Starting on siteview. 4 years ago
nutomic 3ceeecc63e Better account deletion (fixes #730) (#143)
Also clear bio

Better account deletion (fixes #730)

Co-authored-by: Felix Ableitner <me@nutomic.com>
Reviewed-on: https://yerbamate.ml/LemmyNet/lemmy/pulls/143
4 years ago
eiknat 9e604b4038 update/fix migration, add some doc
also run cargo fmt/clippy
4 years ago
eiknat 438414a64b add more details to the report views 4 years ago
eiknat 070efe72af add current context for reports 4 years ago
eiknat d6b1c8df2f reports: update db tables, combine api impl 4 years ago
eiknat 6d43202efb reports: initial reports api commit 4 years ago
Felix Ableitner 06e82fe761 Add pending status for federated follows 4 years ago
nutomic 7c51a36012 In activity table, remove `user_id` and add `sensitive` (#127)
Forgot to add migrations

Add `sensitive` column to activities table, so PMs arent served over HTTP

Remove user_id column from actvity table

Co-authored-by: Felix Ableitner <me@nutomic.com>
Reviewed-on: https://yerbamate.ml/LemmyNet/lemmy/pulls/127
4 years ago
Felix Ableitner 99abc49040 Add /activities endpoint (ref #1220) 4 years ago
Dessalines a903cae00b Fixing hot_rank_active fast triggers. Fixes #1190 4 years ago
Dessalines fd257a6d39 Adding no conflict triggers. Fixes #1179 4 years ago
Dessalines ab17e0a9f3 Merge branch 'add-view-helper-functions' of https://github.com/eiknat/lemmy into eiknat-add-view-helper-functions 4 years ago
Dessalines 5c6258390c
Isomorphic docker (#1124)
* Adding a way to GetComments for a community given its name only.

* Adding getcomments to api docs.

* A first pass at locally working isomorphic integration.

* Testing out cargo-husky.

* Testing a fail hook.

* Revert "Testing a fail hook."

This reverts commit 0941cf1736.

* Moving server to top level, now that UI is gone.

* Running cargo fmt using old way.

* Adding nginx, fixing up docker-compose files, fixing docs.

* Trying to re-add API tests.

* Fixing prod dockerfile.

* Redoing nightly fmt

* Trying to fix private message api test.

* Adding CommunityJoin, PostJoin instead of joins from GetComments, etc.

- Fixes #1122

* Fixing fmt.

* Fixing up docs.

* Removing translations.

* Adding apps / clients to readme.

* Fixing main image.

* Using new lemmy-isomorphic-ui with better javascript disabled.

* Try to fix image uploads in federation test

* Revert "Try to fix image uploads in federation test"

This reverts commit a2ddf2a90b.

* Fix post url federation

* Adding some more tests, some still broken.

* Don't need gitattributes anymore.

* Update local federation test setup

* Fixing tests.

* Fixing travis build.

* Fixing travis build, again.

* Changing lemmy-isomorphic-ui to lemmy-ui

* Error in travis build again.

Co-authored-by: Felix Ableitner <me@nutomic.com>
4 years ago