Commit Graph

21 Commits

Author SHA1 Message Date
Nick Thomas 013f7cd24c
Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
Alexandru Croitor 77985826d9 Show header and footer system messages in email
* Add email_header_and_footer_enabled flag to appearances table
* Set email_header_and_footer_enabled default value to false
* Add checkbox to appearance to toggle show header and footer in emails
* Add email_header_and_footer_enabled to allowed params in controller
* Add header and footer messages to the html and text email layouts
* Remove the color styling for emails header and footer
* Add empty_mailer layout for emails without layout,
to have the header and footer applied
2019-02-27 22:07:50 +02:00
Douwe Maan 28e1739a3f Port EE System Header And Footer feature to CE
remove EE specific code
remove EE licence checks
move migration from EE to CE folder structure
move specs from EE to CE folder structure
remove EE specific flag specs
2019-02-21 17:55:51 +02:00
Stan Hu 19f9d99870 Fix 500 errors with legacy appearance logos
Prior to GitLab 9.0, attachments were not tracked the `uploads` table,
so it was possible that the appearance logos were just stored in the
database as a string and mounted via CarrierWave.

https://gitlab.com/gitlab-org/gitlab-ce/issues/29240 implemented in
GitLab 10.3 was supposed to cover populating the `uploads` table for all
attachments, including all the logos from appearances. However, it's
possible that didn't work for logos or the `uploads` entry was orphaned.

GitLab instances that had a customized logo with no associated `uploads`
entry would see Error 500s. The only way to fix this is to delete the
`logo` column from the `appearances` table and re-upload the attachment.

This change makes things more robust by falling back to the original
behavior if the upload is not available.

This is a CE backport of
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9277.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/9357
2019-01-23 11:18:00 -08:00
Stan Hu 7036f75f67 Use system paths for appearance logos
When object storage is enabled, the logos used to customize a GitLab
appearance causes the time-limited URLs to be used. We fix this
by forcing all of these URLs to use the /uploads/-/system prefix
so that they will always be proxied through GitLab.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/6778
2018-12-25 08:22:34 -08:00
gfyoung 50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Alexis Reigel ce6172e863
allow uploading favicon in appearance settings 2018-06-05 16:20:18 +02:00
Rémy Coutable e531a0c11c
Use the new CacheableAttributes concern in the ApplicationSetting and Appearance models
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-05-23 16:14:43 +02:00
Jan Provaznik 32e2246830 Changed order of include 2018-05-16 08:58:07 +02:00
Jan Provaznik 7da3b2cdd0 Delete remote uploads
ObjectStore uploader requires presence of associated `uploads` record
when deleting the upload file (through the carrierwave's after_commit
hook) because we keep info whether file is LOCAL or REMOTE in `upload`
object.

For this reason we can not destroy uploads as "dependent: :destroy" hook
because these would be deleted too soon. Instead we rely on
carrierwave's hook to destroy `uploads` in after_commit hook.

But in before_destroy hook we still have to delete not-mounted uploads
(which don't use carrierwave's destroy hook). This has to be done in
before_Destroy instead of after_commit because `FileUpload` requires
existence of model's object on destroy action.

This is not ideal state of things, in a next step we should investigate
how to unify model dependencies so we can use same workflow for all
uploads.

Related to #45425
2018-05-16 08:58:07 +02:00
Stan Hu d209a05486 Use the GitLab version as part of the appearances cache key
This prevents us from having to manually flush the cache key
in migrations every time a new column is added.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/5571
2018-04-05 12:55:12 -07:00
Micaël Bergeron 0f1d348d68 port the object storage to CE 2018-03-01 10:34:30 -05:00
Sean McGivern a7dae52e9d Merge branch '4163-move-uploads-to-object-storage' into 'master'
Move uploads to object storage

Closes #4163

See merge request gitlab-org/gitlab-ee!3867
2018-02-28 20:58:15 +01:00
Markus Koller b8a3931925
Add custom brand text on new project pages 2017-12-04 17:22:59 +01:00
Yorick Peterse 26bb50412c
Cache Appearance instances in Redis
This caches the result of Appearance.first in a similar fashion to how
ApplicationSetting instances are cached. We also add some NOT NULL
constraints to the table and correct the timestamp types.

Fixes gitlab-org/gitlab-ce#36066, fixes gitlab-org/gitlab-ce#31698
2017-08-10 12:45:49 +02:00
Yorick Peterse 8fbbf41e29
Added Cop to blacklist the use of `dependent:`
This is allowed for existing instances so we don't end up 76 offenses
right away, but for new code one should _only_ use this if they _have_
to remove non database data. Even then it's usually better to do this in
a service class as this gives you more control over how to remove the
data (e.g. in bulk).
2017-07-06 12:01:36 +02:00
Robert Speicher 23c2b8f6bb Add `has_many` associations for models that can have Upload records 2017-03-06 14:41:10 -05:00
Nick Thomas e94cd6fdfe Add markdown cache columns to the database, but don't use them yet
This commit adds a number of _html columns and, with the exception of Note,
starts updating them whenever the content of their partner fields changes.

Note has a collision with the note_html attr_accessor; that will be fixed later

A background worker for clearing these cache columns is also introduced - use
`rake cache:clear` to set it off. You can clear the database or Redis caches
separately by running `rake cache:clear:db` or `rake cache:clear:redis`,
respectively.
2016-10-07 02:54:25 +01:00
Jeroen van Baarsen f1479b56b7
Remove the annotate gem and delete old annotations
In 8278b763d9 the default behaviour of annotation
has changes, which was causing a lot of noise in diffs. We decided in #17382
that it is better to get rid of the whole annotate gem, and instead let people
look at schema.rb for the columns in a table.

Fixes: #17382
2016-05-09 18:00:28 +02:00
Zeger-Jan van de Weg 47da013cf8 Annotate the models 2016-05-06 08:27:46 +02:00
Zeger-Jan van de Weg 9a2869ab46 Branded login page also in CE
The only major difference with the EE version is the change from a light and dark logo to only a header logo
The dark logo wasn't used anyway, so it seemed to make sense to me to rename the field to the actual function of it
2016-02-26 15:50:51 +01:00