diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/bangtags.rb | 4 | ||||
-rw-r--r-- | app/models/account.rb | 5 | ||||
-rw-r--r-- | app/models/user.rb | 5 | ||||
-rw-r--r-- | app/services/import_service.rb | 8 |
4 files changed, 16 insertions, 6 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index e106dc582..8ed8a0612 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -28,7 +28,7 @@ class Bangtags # list of post-processing commands @post_cmds = [] # hash of bangtag variables - @vars = account.vars + @vars = account.user.vars # keep track of what variables we're appending the value of between chunks @vore_stack = [] # keep track of what type of nested components are active so we can !end them in order @@ -516,7 +516,7 @@ class Bangtags postprocess_before_save - account.save + account.user.save status.text = @chunks.join status.save diff --git a/app/models/account.rb b/app/models/account.rb index 8187bc7d9..d30c2a9ec 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -313,6 +313,10 @@ class Account < ApplicationRecord self[:also_known_as] || [] end + def field + @field ||= fields.map { |f| [f.name, f.value] }.to_h + end + def fields (self[:fields] || []).map { |f| Field.new(self, f) } end @@ -352,6 +356,7 @@ class Account < ApplicationRecord self.fields = tmp end + # needs to be removed after migration def vars self[:vars] end diff --git a/app/models/user.rb b/app/models/user.rb index 5f1ffb595..6aafa124a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -38,6 +38,7 @@ # chosen_languages :string is an Array # created_by_application_id :bigint(8) # approved :boolean default(TRUE), not null +# vars :jsonb not null # class User < ApplicationRecord @@ -151,6 +152,10 @@ class User < ApplicationRecord attr_reader :invite_code attr_writer :external + def vars + self[:vars] + end + def confirmed? confirmed_at.present? end diff --git a/app/services/import_service.rb b/app/services/import_service.rb index 9b0a03081..248178e8c 100644 --- a/app/services/import_service.rb +++ b/app/services/import_service.rb @@ -100,8 +100,8 @@ class ImportService < BaseService end def import_json_statuses - @account.vars['_bangtags:disable'] = true - @account.save + @account.user.vars['_bangtags:disable'] = true + @account.user.save @data.each do |json| # skip if invalid status object @@ -172,8 +172,8 @@ class ImportService < BaseService nil end - @account.vars.delete('_bangtags:disable') - @account.save + @account.user.vars.delete('_bangtags:disable') + @account.user.save end def import_activitypub |