Commit Graph

107 Commits

Author SHA1 Message Date
dgt 52f64b10af Update Rails to 5.2
also update db/schema.rb
2019-08-23 11:42:15 +02:00
Azul 16ec2efba5 update: schema.rb 2019-08-23 11:42:15 +02:00
dgt 03a80251b5 Upgrade to Rails 5.1
and fixed wiki versioning test

Rails 5.1 last steps

crabgrass_media from rubygems
remove controller test for task sorting - not possible to test xhr request without route in new parameter syntax
remove new framework defaults initializer file

Final step of upgrade to rails 5.1

we only test on stretch, because we need ruby >= 2.2.2
update dependencies by running bundle update
and fix gallery_image_controller_test

Also write db/schema.rb with rails 5
2019-08-23 11:42:12 +02:00
dgt 2cddb2f6fa Update ActsAsTaggableOn
results in failing versions_controller_test.rb
seems to be related to schema update
2019-08-23 10:43:01 +02:00
dgt 8a9217efea Models inherit from ApplicationRecord 2019-08-23 10:43:01 +02:00
dgt bea4f0c846 Add index to page_histories to speed up digests 2019-05-09 13:17:23 +02:00
dgt 1c6c17a789 Fix: reduce field size for page.owner_name
depending on the DB the size restriction of the index on owner_name to 4 characters does not work.
so we just reduce the size of the field
2018-11-21 15:51:50 +01:00
dgt 16d32f0cfb Fix: make sure that tags use a binary collation 2018-11-21 11:06:17 +01:00
dgt 4e3e8bb1a5 Prepare for utf8mb4: shrink size of indexed fields
to make database indexes fit after conversion to full utf8, the db forces
us to shrink the size of the varchar fields which are part of those indexes.
before doing so, we had to make sure that the content in this fields does not
exceed 191 characters. we used a rake task to shrink long legacy tags.
2018-11-16 12:37:12 +01:00
dgt e507f63f14 Increase size of tags field in page_terms
the maximum size of a single tag was varchar(255).
now it is set to text (65535 characters)
2018-11-13 18:42:44 +01:00
Azul cc7b575776 db: speed up destroying pages with indices
See #226 for benchmarks.

This was not an issue so far as we did not try to destroy many pages in one go.
2018-11-10 11:57:09 +01:00
dgt 9d0288ce59 Remove event pages code
events have not been used for a long time.
this commit removes everything besides the icons
2018-10-11 11:18:27 +02:00
dgt 10a6879646 Remove table and translations for unused activities 2018-05-15 18:58:09 +02:00
dgt 18a0dfed43 Merge branch 'master' into '155-remove-statistics-for-pages-and-user-visits'
# Conflicts:
#   db/schema.rb
2018-05-08 01:43:34 -07:00
dgt 6c88dfbc21 Remove database tables and colums for tracking
remove tables hourlies, dalies, trackings
remove column views_count from pages and page_terms
remove views_count from fixtures and a test
remove views_count from sphinx index
2018-04-26 23:02:49 +02:00
dgt e5ab743773 refactor: Remove unused fields from profile
- remove unused name fields and birthday
- remove legacy permissions which have been replaced
by castle_gates_keys long ago
- remove migration test for users and groups
2018-03-18 23:00:37 +01:00
Azul db108f9eda
track csp reports in database 2018-02-13 09:46:51 +01:00
Azul f1defaf7ed
update db/schema.rb 2018-01-04 15:12:06 +01:00
Cognata f513d7e6f1 Update available languages;
* Deletes Danish (only 3% coverage)
* Deletes Chinese (no translation available)
* Adds Czech
2018-01-02 13:12:14 +01:00
Azul 7fef96f8a3
cleanup: remove User::Setting and group_settings db
We were rewriting the alias_method_chain for setting in user...
but we are not using settings at all.

Inspecting them in production showed that the only fields that
differ from defaults are not used anymore:
```
User::Setting.last.attributes.keys.select do |key|
  User::Setting.group(key).count.size > 1
end
["id", "user_id", "show_welcome", "created_at", "updated_at", "preferred_editor"]
```
(this finds all attributes that differ accross instances.)

Neither show_welcome nor preferred_editor are used anymore.
2017-12-15 21:18:58 +01:00
dgt 38c7ba2c6b
Updating to rails 4.10 and acts-as-taggable-on 4.0.0 2017-12-15 17:52:00 +01:00
dgt ac93ed7b27 move crypt key from profiles to user
- now we have only one pgp_key belonging to the user - in the past it was a collection belonging to a profile
- store expiration date (if key has one)
2017-12-07 23:05:36 +01:00
dgt 9de72c16b9 signing notification emails 2017-12-07 23:05:36 +01:00
dgt 866c7d9d18 tests for encrypted notifications 2017-12-07 23:05:36 +01:00
dgt 99ee84c12c Encrypted notifications (WIP) 2017-12-07 23:05:36 +01:00
Azul 4aaa788350
cleanup: remove chat leftovers 2017-11-12 18:07:53 +01:00
dgt 520ce439d9 refactor: remove unused geo_* models 2017-11-10 12:43:19 +01:00
dgt a67f60a2bf dropping tables of unused associations 2017-11-08 12:49:02 +01:00
dgt 7758ff88b6 removed unused attributes from profile 2017-11-08 12:39:17 +01:00
Azul cf21b9311b
style: rubocop autocorrect 2017-09-12 10:00:46 +02:00
Azul 20d2ea6afd
bugfix: use "Asset" for polymorphic parent_type 2017-02-04 22:04:53 +01:00
Azul 4ba6cd46ef
migrate: make thumbnail parent_types match asset types
We changed the asset naming scheme. The polymorphic association has to be
updated.
2017-02-04 20:53:21 +01:00
Azul b71f3d4ca3
cleanup: turn Site into plain ruby class and simplify
We used to allow a LOT of configuration via sites and Conf.
This developed out of the need to create working instances for
different interests. Now this is no more the case and we can
finally drop the associated complexity.

The need to persist site settings in the database is also gone
since the is no UI for changing them anymore. Instead they can
now be applied via configuration files only.

While i ripped out a lot of complexity and brittle code i kept
a basic destinction. Some config settings are accessed via
  Conf
others in the controllers and views via
  current_site

This will still allow us to customize ui and to some extend
behaviour based on the domain of a request. It will NOT serve
however to run two completely different sites on the same install
though.
2016-09-01 10:22:14 +02:00
Azul 4f703b2bbb
upgrade: acts-as-taggable-on 3.5
had to modify the migrations it ships by default. Looks like we altered some index names.
2016-09-01 10:22:09 +02:00
Azul 61cbf6b00a
update schema.rb 2016-09-01 10:22:01 +02:00
Azul 75a6cbca06
upgrade: make schema and fixtures work with newer mysql2 version 2016-09-01 10:21:59 +02:00
Azul 28136e17a0
UserGhost -> User::Ghost 2016-09-01 09:40:20 +02:00
Azul bd71a4d8cc
cleanup: remove unused MenuItem model 2016-09-01 09:40:20 +02:00
Azul 0f954fd5dd
Code -> Page::AccessCode, table codes -> page_access_codes 2016-09-01 09:40:19 +02:00
Azul 1990fd592a
cleanup: unused category model 2016-09-01 09:40:18 +02:00
Azul 3c9d9525a4
namespace: asset for all the asset things
Also separate Asset::Storage::Path from Asset::Storage
2016-09-01 09:40:15 +02:00
Azul 4955ee0a0f
namespace Activity and remove from autoload_path
We used to have app/models/activity in the autoload path and had classes
like FriendActivity < Activity

This conflicts with how rails4 handles class lookup. Plus it clutters the
autoload path and makes it harder to find classes.

Using proper namespaces instead now and I'm about to apply this to all the
different namespace avoiding things like ...Extension. We can use classes
as namespaces as long as we:
* make sure to define things inside the namespace in one line or in a
   class instead of a module block:
   ```ruby
     class Activity::Friend < Activity
     # or
     class Activity
       class Friend < ::Activity
   ```
 * have names inside the namespaces that do not conflict with global names

The second one is important because if PrivatePost is already loaded and
Activity::PrivatePost is referenced somewhere it will be found as an
constant inside the Object namespace of Activity (since Activity is a class).
So instead of loading Activity::PrivatePost we'll see a warning that global
constant PrivatePost was referenced by Activity::PrivatePost.

So how do we prevent this?
* do not clutter the global namespace
* use more specific names in other namespaces
  -> in this case i am renaming PrivatePostActivity to Activity::MessageSent
  and not Activity::PrivatePost
2016-09-01 09:38:02 +02:00
Azul 8c36d7f826 simplify task_list_page - no more task_lists
TaskLists used to be an empty table that linked pages and
their tasks together:
* page.data -> TaskList
* task.task_list -> TaskList

This commit removes the TaskLists entirely. Instead tasks
now belong to the page itself. TaskListPages have no more data
set.

This cleanup removes an intermediate class we never really used anyway.

In general i plan to move away from relying on the polymorphic page
belongs_to data. Instead data belongs_to page and only the page types
it's relevant to have the corresponding has_many associations defined.
This allows for much more flexibility in attaching data to the page.
2015-09-14 09:59:30 +02:00
Azul eda74cb296 Use InnoDB for all tables but page_terms
InnoDB allows us to perform non blocking backups with transactions.

So we convert all the tables that remained as MyISAM tables to
InnoDB except page_terms which need the full text search capacities
that InnoDB only gained with mysql 5.6. (we're still on 5.5).

trackings were actively using "INSERT DELAYED" which also is
MyISAM specific - but will be removed in this commit as well.
The mysql docs say:

> Note that INSERT DELAYED is slower than a normal INSERT if the table
> is not otherwise in use.

So it very much looks like premature optimization.

The other tables just happen to still be MyISAM in production
2015-09-08 17:13:30 +02:00
elijah 86167f75df minor: use Rails.root, not RAILS_ROOT. 2015-08-23 12:48:07 -07:00
Azul ccf5c36c98 upgrade: delayed job to latest and run migrate task 2015-08-10 14:22:18 +02:00
Azul f786730fd3 add index on delta column to page_terms
This will speed up fetching only the delta=true records for indexing
2015-08-10 11:12:01 +02:00
Azul d0208dcf4e First steps towards staring posts
migration, model and controller with tests, helpers and hooks into views

next: toggling the icon
2015-06-26 10:52:38 +02:00
Azul 27ccebcad5 use has_secure_password and wrap old sha1 hashes
has_secure_password uses bcrypt which is far better at hashing passwords
than sha1.

In order to profit from the security gains of bcrypt without waiting for
all users to login again so we can encrypt their plaintext password we use
bcrypt(sha1(password, salt)) as an intermediate step. This allows us to
simply bcrypt all existing hashes. We obviously need to keep the old salt.

When a user logs in we calculate the old hash like before and then use the
password comparison of has_secure_password.
If the password worked we also rehash it with plain bcrypt and remove the old
salt from the database. This way we can tell how a password was hashed by
looking at the salt of the record.

Once all users have logged in or their accounts have expired we can remove
these hacks.

ATTENTION:
 * migration required
 * rake task cg:upgrade:secure_password required
2015-04-24 14:56:11 +02:00
azul 95296bf55e index for relationships for the discussion in me/messages 2015-03-17 17:29:47 +01:00