Skip to content

Commit

Permalink
Merge pull request #36 from cuties-social/23.11
Browse files Browse the repository at this point in the history
update nixos to 23.11 and thus mastodon to 4.2.3
  • Loading branch information
e1mo committed Jan 9, 2024
2 parents 5df62cd + 7dc3a45 commit 0c5c040
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 89 deletions.
3 changes: 2 additions & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ in
users.mutableUsers = true;
users.users = {
root = {
passwordFile = config.sops.secrets."root_password".path;
hashedPasswordFile = config.sops.secrets."root_password".path;
};
isa = {
isNormalUser = true;
Expand Down Expand Up @@ -201,6 +201,7 @@ in
localDomain = "cuties.social";
configureNginx = true;
automaticMigrations = true;
streamingProcesses = 3;

secretKeyBaseFile = secrets."mastodon/secret_key".path;
vapidPrivateKeyFile = secrets."mastodon/vapid/private_key".path;
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down
15 changes: 2 additions & 13 deletions packages/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
final: prev:
rec {
patchedMastodonSource = final.applyPatches {
inherit (prev.mastodon.src) src;
/* src = prev.fetchFromGitHub {
owner = "mastodon";
repo = "mastodon";
rev = "v${prev.mastodon.version}";
sha256 = "sha256-/lyniar3TaQiDTaSKhfI6AF80sjo57VCjTydjv3T6kA=";
}; */
mastodon = prev.mastodon.override {
pname = "mastodon-cuties-socal";
patches = [
./mastodon/allpatches.patch
./mastodon/troet.patch
];
};

mastodon = prev.mastodon.override {
pname = "mastodon-cuties-socal";
srcOverride = patchedMastodonSource;
};

customEmojis = prev.stdenv.mkDerivation {
name = "custom-emojis-cuties-social";
src = prev.fetchFromGitHub {
Expand Down
106 changes: 46 additions & 60 deletions packages/mastodon/allpatches.patch
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
diff --git a/app/javascript/mastodon/components/animated_number.js b/app/javascript/mastodon/components/animated_number.js
index b1aebc73e..de5887e40 100644
--- a/app/javascript/mastodon/components/animated_number.js
+++ b/app/javascript/mastodon/components/animated_number.js
@@ -6,13 +6,7 @@ import spring from 'react-motion/lib/spring';
import { reduceMotion } from 'mastodon/initial_state';

const obfuscatedCount = count => {
- if (count < 0) {
- return 0;
- } else if (count <= 1) {
- return count;
- } else {
- return '1+';
- }
+ return Math.max(0, count);
};

export default class AnimatedNumber extends React.PureComponent {
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
index 6a65f44da..e07f19083 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -20,6 +20,8 @@ import { isMobile } from '../../../is_mobile';
import ImmutablePureComponent from 'react-immutable-pure-component';
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.jsx b/app/javascript/mastodon/features/compose/components/compose_form.jsx
index b15fe2909..73903464e 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.jsx
+++ b/app/javascript/mastodon/features/compose/components/compose_form.jsx
@@ -11,6 +11,9 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { ReactComponent as LockIcon } from '@material-symbols/svg-600/outlined/lock.svg';
import { length } from 'stringz';
import { countableText } from '../util/counter';

+import initialState from '../../../initial_state';
+const maxChars = initialState.max_toot_chars;
import Icon from 'mastodon/components/icon';

const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d';
+
import { Icon } from 'mastodon/components/icon';
import { WithOptionalRouterPropTypes, withOptionalRouter } from 'mastodon/utils/react_router';

@@ -90,7 +92,7 @@ class ComposeForm extends ImmutablePureComponent {
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
Expand All @@ -39,29 +21,30 @@ index 6a65f44da..e07f19083 100644
};

handleSubmit = (e) => {
@@ -277,7 +279,7 @@ class ComposeForm extends ImmutablePureComponent {
</div>

<div className='character-counter__wrapper'>
- <CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
+ <CharacterCounter max={maxChars} text={this.getFulltextForCharacterCounting()} />
@@ -297,7 +300,7 @@ class ComposeForm extends ImmutablePureComponent {
</div>

<div className='character-counter__wrapper'>
- <CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
+ <CharacterCounter max={maxChars} text={this.getFulltextForCharacterCounting()} />
</div>
</div>
</div>

diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js
diff --git a/app/javascript/mastodon/features/compose/components/poll_form.jsx b/app/javascript/mastodon/features/compose/components/poll_form.jsx
index ede29b8a0..e84a89c51 100644
--- a/app/javascript/mastodon/features/compose/components/poll_form.js
+++ b/app/javascript/mastodon/features/compose/components/poll_form.js
@@ -6,6 +6,9 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import IconButton from 'mastodon/components/icon_button';
import Icon from 'mastodon/components/icon';
import AutosuggestInput from 'mastodon/components/autosuggest_input';
--- a/app/javascript/mastodon/features/compose/components/poll_form.jsx
+++ b/app/javascript/mastodon/features/compose/components/poll_form.jsx
@@ -15,6 +15,10 @@ import AutosuggestInput from 'mastodon/components/autosuggest_input';
import { Icon } from 'mastodon/components/icon';
import { IconButton } from 'mastodon/components/icon_button';

+import initialState from '../../../initial_state';
+const maxOptions = initialState.max_poll_options;
+const minOptions = initialState.min_poll_options;
import classNames from 'classnames';

+
const messages = defineMessages({
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Choice {number}' },
add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add a choice' },
@@ -102,7 +105,7 @@ class Option extends React.PureComponent {
</label>

Expand Down Expand Up @@ -94,8 +77,8 @@ index fc7359cfc..ce65eab57 100644
+
validates :username, presence: true
validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? }
@@ -90,9 +94,9 @@ class Account < ApplicationRecord

@@ -100,9 +100,9 @@ class Account < ApplicationRecord
# Local user validations
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
Expand All @@ -105,9 +88,10 @@ index fc7359cfc..ce65eab57 100644
+ validates :display_name, length: { maximum: MAX_DISPLAY_NAME_LENGTH }, if: -> { local? && will_save_change_to_display_name? }
+ validates :note, note_length: { maximum: MAX_NOTE_LENGTH }, if: -> { local? && will_save_change_to_note? }
+ validates :fields, length: { maximum: MAX_FIELDS }, if: -> { local? && will_save_change_to_fields? }

scope :remote, -> { where.not(domain: nil) }
scope :local, -> { where(domain: nil) }
validates :uri, absence: true, if: :local?, on: :create
validates :inbox_url, absence: true, if: :local?, on: :create
validates :shared_inbox_url, absence: true, if: :local?, on: :create

@@ -324,7 +328,7 @@ class Account < ApplicationRecord
self[:fields] = fields
end
Expand Down Expand Up @@ -214,20 +198,22 @@ index e107912b7..12d1c0953 100644
URL_PLACEHOLDER = 'x' * 23

diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index 3067b3737..a6d698f54 100644
index 5f9613c93..fbd36b7f5 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -9,8 +9,8 @@

.fields-row
.fields-row__column.fields-group.fields-row__column-6
- = f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30, data: { default: @account.username } }, hint: false
- = f.input :note, wrapper: :with_label, input_html: { maxlength: 500 }, hint: false
+ = f.input :display_name, wrapper: :with_label, input_html: { maxlength: Account::MAX_DISPLAY_NAME_LENGTH, data: { default: @account.username } }, hint: false
+ = f.input :note, wrapper: :with_label, input_html: { maxlength: Account::MAX_NOTE_LENGTH }, hint: false

@@ -15,10 +15,10 @@
.fields-row
.fields-row__column.fields-row__column-6
.fields-group
- = f.input :display_name, wrapper: :with_block_label, input_html: { maxlength: 30, data: { default: @account.username } }
+ = f.input :display_name, wrapper: :with_block_label, input_html: { maxlength: Account::MAX_DISPLAY_NAME_LENGTH, data: { default: @account.username } }

.fields-group
- = f.input :note, wrapper: :with_block_label, input_html: { maxlength: 500 }
+ = f.input :note, wrapper: :with_block_label, input_html: { maxlength: Account::MAX_NOTE_LENGTH }

.fields-row__column.fields-group.fields-row__column-6
.input.with_block_label
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index edae05f9d..4d6357fe4 100644
--- a/spec/models/account_spec.rb
Expand Down
7 changes: 3 additions & 4 deletions packages/mastodon/troet.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
diff --git a/app/javascript/mastodon/locales/de.json b/app/javascript/mastodon/locales/de.json
index 223e68912..90dd1175c 100644
index cf545e48c..4953bdfba 100644
--- a/app/javascript/mastodon/locales/de.json
+++ b/app/javascript/mastodon/locales/de.json
@@ -137,7 +137,7 @@
@@ -151,7 +151,7 @@
"compose_form.poll.remove_option": "Auswahlfeld entfernen",
"compose_form.poll.switch_to_multiple": "Mehrfachauswahl erlauben",
"compose_form.poll.switch_to_single": "Nur Einzelauswahl erlauben",
- "compose_form.publish": "Veröffentlichen",
+ "compose_form.publish": "Tröt",
- "compose_form.publish_form": "Veröffentlichen",
+ "compose_form.publish_form": "Tröt",
"compose_form.publish_form": "Neuer Beitrag",
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "Änderungen speichern",

0 comments on commit 0c5c040

Please sign in to comment.