Refactor on File::processNew
The code was so involved there was even a comment asking for a refactor.
Now, File_redirection::where always returns a nice File_redirection
object instead of an array or string or nothing. The object is
either one which already existed or else a new, unsaved object.
Instead of duplicating "does it exist" checks everywhere, do it in
File_redirection::where. You either get what exists or something to save.
An unsaved File_redirection may be paired with an unsaved File.
You will want to save the File first (using ->saveFile()) and put the
id in File_redirection#file_id before saving.
See merge request !57
The code was so involved there was even a comment asking for a refactor.
Now, File_redirection::where always returns a nice File_redirection
object instead of an array or string or nothing. The object is
either one which already existed or else a new, unsaved object.
Instead of duplicating "does it exist" checks everywhere, do it in
File_redirection::where. You either get what exists or something to save.
An unsaved File_redirection may be paired with an unsaved File.
You will want to save the File first (using ->saveFile()) and put the
id in File_redirection#file_id before saving.
Add default icon to OAuth apps
When MySQL runs in strict mode, it doesn't seem possible to add a new OAuth app.
This is because:
* The 'icon' field has no defaults and also has NOT NULL constraint.
* GS uploads/sets the icon[1] (if provided) after the SQL insert[2]
The easiest fix seemed to be to provide a default icon value.
This change sets the default to the "blue peg" default avatar from the base theme.
[1]
7f30e61402/actions/newapplication.php (L176)
[2]
7f30e61402/actions/newapplication.php (L186)
See merge request !29
Let's now create an event called DeleteNotice and also make sure we
handle the onNoticeDeleteRelated properly in ActivityModeration to
avoid possible endless loops etc.
When MySQL runs in strict mode, it doesn't seem possible to add a new OAuth app.
This is because:
* The 'icon' field has no defaults and also has NOT NULL constraint.
* GS uploads/sets the icon[1] (if provided) after the SQL insert[2]
The easiest fix seemed to be to provide a default icon value.
This change sets the default to the "blue peg" default avatar from the base theme.
[1]
7f30e61402/actions/newapplication.php (L176)
[2]
7f30e61402/actions/newapplication.php (L186)