florence-social / mastodon-fork

Florence's fork of Mastodon
GNU Affero General Public License v3.0
138 stars 15 forks source link

Max toot and bio length settings are not saved in the admin UI #101

Closed agateblue closed 5 years ago

agateblue commented 5 years ago

I've done the switch to Florence from stock Mastodon this afternoon, under Docker. I was on Mastodon 2.9.0 and I switched to Florence v0.0.1.0, using the Docker image florencesoc/mastodon-fork:latest.

(The switch itself went well and my instance is now up and running under Florence, so congrats to everyone involved :heart:)

I have an issue when trying to update the max bio/toot length at /admin/settings/edit though. Basically, the options are displayed properly, but changing and saving the values doesn't work: the form is saved, but the value are resetted to their default, 500 characters.

Steps to reproduce

  1. Visit /admin/settings/edit
  2. Update the max character count for bio/toot
  3. Click save

A video reproducing the issue can be found here.

Expected result

The updated values are saved properly.

Actual result

The form saves without error, but the values arent't updated.

Additional context

agateblue commented 5 years ago

This is what I have in my SQL settings table:


SELECT var FROM settings ORDER BY var ASC;
                var                 
------------------------------------
 activity_api_enabled
 advanced_layout
 advanced_layout
 aggregate_reblogs
 auto_play_gif
 boost_modal
 bootstrap_timeline_accounts
 closed_registrations_message
 custom_css
 default_language
 default_privacy
 default_privacy
 default_sensitive
 delete_modal
 display_media
 expand_spoilers
 hero
 hide_network
 interactions
 interactions
 mascot
 min_invite_role
 noindex
 notification_emails
 notification_emails
 open_deletion
 open_registrations
 peers_api_enabled
 preview_sensitive_media
 profile_directory
 reduce_motion
 registrations_mode
 show_known_fediverse_at_about_page
 show_staff_badge
 site_contact_email
 site_contact_username
 site_description
 site_extended_description
 site_short_description
 site_terms
 site_title
 system_font_ui
 theme
 theme
 thumbnail
 timeline_preview
 unfollow_modal
(47 rows)

I see no track of max_toot_chars and max_bio_chars, which are apparently the names used for the corresponding options from #32 and #49.

agateblue commented 5 years ago

I didnt' find the root cause of the issue, but I have a workaround that involves settings the value directly in the database.

Open a database shell with docker-compose exec db psql -U postgres then execute the following queries:


INSERT INTO settings (var, value, created_at, updated_at) VALUES ('max_bio_chars', E'--- 66666\n...', NOW(), NOW());
INSERT INTO settings (var, value, created_at, updated_at) VALUES ('max_toot_chars', E'--- 66666\n...', NOW(), NOW());

(Replace 66666 with your desired maximum)

Then clear the cache with docker-compose run --rm web bin/tootctl cache clear :tada:

clarfonthey commented 5 years ago

We should probably add tests for both of these once we get a fix out.

clarfonthey commented 5 years ago

Oh, it seems that there isn't actually a test for any of the admin settings. I just failed to merge things correctly. Uploading a fix.