Skip to content

Commit

Permalink
wait, actually we want it to just be a column on the account, because…
Browse files Browse the repository at this point in the history
… it's loaded on public, not when logged in. damn it. checkpointing so i can return here if needed
  • Loading branch information
sneakers-the-rat committed Aug 28, 2024
1 parent 85898a7 commit 24d2caf
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/initial_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @property {string} status_page_url
* @property {boolean} system_emoji_font
* @property {string} default_content_type
* @property {string} account_css
*/

/**
Expand Down Expand Up @@ -145,6 +146,9 @@ export const pollLimits = (initialState && initialState.poll_limits);
export const defaultContentType = getMeta('default_content_type');
export const useSystemEmojiFont = getMeta('system_emoji_font');

// Neuromatchstodon-specific settings
export const accountCSS = getMeta('account_css');

/**
* @returns {string | undefined}
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'latex';
@import 'bigger_collapsed_statuses';
@import 'better_code_blocks';
@import 'myspace';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#user_settings_attributes_neuromatchstodon\.account_css {
font-family: $font-monospace;
}
4 changes: 4 additions & 0 deletions app/models/concerns/user/has_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def setting_hide_followers_count
settings['hide_followers_count']
end

def setting_account_css
settings['neuromatchstodon.account_css']
end

def allows_report_emails?
settings['notification_emails.report']
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/user_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class KeyError < Error; end
setting :must_be_following_dm, default: false
end

namespace :neuromatchstodon do
setting :account_css, default: nil
end

def initialize(original_hash)
@original_hash = original_hash || {}
end
Expand Down
3 changes: 3 additions & 0 deletions app/views/accounts/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
- @account.fields.select(&:verifiable?).each do |field|
%link{ rel: 'me', type: 'text/html', href: field.value }/

-# - if @account.user_setting_account_css?
%meta{ name: 'account_css', content: @account.user_setting_account_css }

= opengraph 'og:type', 'profile'
= render 'og', account: @account, url: short_account_url(@account, only_path: false)

Expand Down
5 changes: 5 additions & 0 deletions app/views/settings/preferences/appearance/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,10 @@
.fields-group
= ff.input :'web.expand_content_warnings', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_expand_spoilers')

%h4= t 'appearance.myspace_mode'

.fields-group
= ff.input :'neuromatchstodon.account_css', as: :text, wrapper: :with_block_label, label: I18n.t('simple_form.labels.defaults.setting_myspace_account_css'), hint: I18n.t('simple_form.hints.defaults.setting_myspace_account_css'), neuromatchstodon_only: true

.actions
= f.button :button, t('generic.save_changes'), type: :submit
10 changes: 10 additions & 0 deletions config/initializers/simple_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,20 @@ def glitch_only(_wrapper_options = nil)
end
end

module NeuromatchstodonOnlyComponent
def neuromatchstodon_only(_wrapper_options = nil)
return unless options[:neuromatchstodon_only]

options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t('simple_form.neuromatchstodon_only'), class: 'glitch_only')]) }
nil
end
end

SimpleForm.include_component(AppendComponent)
SimpleForm.include_component(RecommendedComponent)
SimpleForm.include_component(WarningHintComponent)
SimpleForm.include_component(GlitchOnlyComponent)
SimpleForm.include_component(NeuromatchstodonOnlyComponent)

SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ en:
guide_link: https://crowdin.com/project/mastodon
guide_link_text: Everyone can contribute.
sensitive_content: Sensitive content
myspace_mode: "MySpace Mode"
application_mailer:
notification_preferences: Change email preferences
salutation: "%{name},"
Expand Down
3 changes: 3 additions & 0 deletions config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ en:
setting_use_pending_items: Hide timeline updates behind a click instead of automatically scrolling the feed
username: You can use letters, numbers, and underscores
whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word
setting_myspace_account_css: Custom CSS that is applied to your account page
domain_allow:
domain: This domain will be able to fetch data from this server and incoming data from it will be processed and stored
email_domain_block:
Expand Down Expand Up @@ -233,6 +234,7 @@ en:
username: Username
username_or_email: Username or Email
whole_word: Whole word
setting_myspace_account_css: Account CSS
email_domain_block:
with_dns_records: Include MX records and IPs of the domain
featured_tag:
Expand Down Expand Up @@ -339,3 +341,4 @@ en:
sessions:
webauthn: Use one of your security keys to sign in
'yes': 'Yes'
neuromatchstodon_only: "Neuromatchstodon Only"

0 comments on commit 24d2caf

Please sign in to comment.