Commit Graph

79 Commits

Author SHA1 Message Date
Azareal 8cf9badd46 Remove inline CSS for log pages.
Darken links on hover in Nox.
Add another group.CanSee test.
2019-06-28 09:35:34 +10:00
Azareal 947306a0af Fix a potential data race when reloading the permissions for a forum.
Log more things during start-up.
Save a few bytes here and there.

Add a couple of initial forum perms store tests.
Add an additional group.CanSee test.
2019-06-19 13:16:03 +10:00
Azareal 54abbe980f Add some test cases to avoid breaking CanSee with GroupStore.Reload again.
Shorten some variable names.
2019-06-18 20:02:45 +10:00
Azareal a5441f18de More conversations progress, still not usable yet.
Flush the debug page incrementally.
Eliminate a tiny bit of code in PreparseMessage.
Shorten some of the pointer capture variables in the poll store.
Tweak the advanced installation instructions for EasyJSON to make it more repeatable.

Added the ConvoKey config setting.
Added /.git/ disk usage to the debug page, if it exists.
Added a UserStore.BulkGetMap multi-user test.
2019-06-16 16:30:58 +10:00
Azareal 05c2ac3ce4 Add the disk and database sections to the debug page.
Add the ActivityStream interface to abstract Get, Add and Count.
Rename the GlobalCount methods to Count for simplicity.
Simplify the variable names in the Count methods.
Rename the GlobalCount method to Count and rename the original Count method to CountUser in LoginLogStore.
Add a float64 case for bunit, sort of.
Theme.RunTmpl now returns ErrBadDefaultTemplate instead of panicking when an interpreted template doesn't exist.
Widget.Allowed now checks the zoneid.
Fire the alert off in the background in AddActivityAndNotifyTarget instead of blocking the request.
Use ErrBadDefaultTemplate instead of calling DefaultTemplates.Lookup directly for custom pages.
Split the page struct for the debug page into multiple structs to make things more organised.

Add the Count method to ProfileReplyStore.
Add the Count method to ReplyStore.
Add the DirSize utility function.

Add a few ActivityStream tests.

Secret gallery stuff.
2019-06-01 22:31:48 +10:00
Azareal 0d1e4e5993 Add super experimental support for per-forum templates.
Add the ExtraTmpls developer setting to config.json
Call ForumStore.BypassGet in ForumStore.Reload instead of duplicating it.
Fix a potential deadlock in ForumStore.Create.
Attempt to fix a weird installation bug.
Add a few more forum store test cases.

You will need to run the updater / patcher for this commit.
2019-05-27 19:00:40 +10:00
Azareal 8a719bd13d Added several more ForumStore tests.
Refactor ForumStore.Get to use ForumStore.Get as a fallback rather than implementing the fallback itself.
ForumStore.BypassGet now handles deleted forums correctly.
Added ErrNoDeleteReports to make it easier to check for that error.
2019-05-18 22:17:50 +10:00
Azareal 857d476ff0 ForumStore.Create now rejects blank names.
ForumStore.Get should now respond appropriately when a forum has been deleted.
Removed a bit of boilerplate in the ForumStore tests.

Added forumstore tests for forum deletion and trying to create a forum with a blank name.
2019-05-18 20:31:51 +10:00
Azareal b9973719a5 Added a small reply cache.
Preloaded a small number of users and topics.
Use cache.Set instead of cache.Add in a few spots for topics to avoid issues with the counter falling out of sync with the cache length.
Embed Reply in ReplyUser instead of duplicating the same fields.
Add the missing AttachCount and ActionType fields to Reply.
Add the missing Poll field to TopicsRow.
Added the TopicUser.Replies method to better abstract the reply list generation logic.
Shortened some common.s to c.s
Moved memStuff out of the analytics memory panes and into analytics.js
Removed the temporary preStats fix for label overflow now that we have a better solution.
Added the panel_analytics_script_memory template to help de-dupe logic in the analytics memory panes.
Added the Topic method to TopicsRow.
Added the GetRidsForTopic method to help cache replies in a small set of scenarios.

Added the ReplyCache config.json setting.
Added the ReplyCacheCapacity config.json setting.

Added a parser test case.
Added more Reply and ReplyStore related test cases.
2019-05-17 18:40:41 +10:00
Azareal c2f2dd7f10 Reduce the amount of data sent for alert resumes in preparation for moving resumes to the WebSockets endpoint.
Remove a bit of superfluous information from the avatar alt attributes.
Improved upon the meta store tests.
Move float: right; out of the footer and into the Tempra Simple and Shadow stylesheets.
Added a missing level label to Shadow.
2019-05-12 09:07:24 +10:00
Azareal afb94eb1d1 Added tests for meta store. 2019-05-10 13:52:37 +10:00
Azareal b487ad0e5a Last batch for now to be converted from common. to c. 2019-04-19 18:20:10 +10:00
Azareal d9acf27c5b The Search and Filter Widget is now partly implemented. Just Search to go in the basic implementation.
Added AJAX Pagination for the Topic List and Forum Page.
A new log file pair is now created every-time Gosora starts up.
Added proper per-theme template overrides.

Added EasyJSON to make JSON serialisation faster.
Moved a bit of boilerplate into paginator.html
Improved paginator.html with a richer template with first, last and symbols instead of text.
Phased out direct access to Templates.ExecuteTemplate across the software.
Fixed the Live Topic List so it should work again.
Added MicroAvatar to WsJSONUser for topic list JSON requests.
An instance of the plugin is now passed to plugin handlers rather than having the plugins manipulate the globals directly.
Added the pre_render_panel_forum_edit and pre_render_panel_forum_edit_perms hooks to replace pre_render_panel_edit_forum.
Renamed the pre_render_panel_edit_user hook to pre_render_panel_user_edit
Reduced the amount of noise from fsnotify.
Added RawPrepare() to qgen.Accumulator.
Added a temporary phrase whitelist to the phrase endpoint.
Moved the location of the zone data assignments in the topic list to reduce the chances of security issues in the future.
Changed the signature of routes/panel/renderTemplate() requiring some changes across the panel routes.
Removed bits of boilerplate in some of the panel routes with renderTemplate()
Added a BenchmarkTopicsGuestJSRouteParallelWithRouter benchmark.
Removed a fair bit of boilerplate for each page struct by generating a couple of interface casts for each template file instead.
Added the profile_comments_row_alt template.
Added the topics_quick_topic template to reuse part of the quick topic logic for both the topic list and forum page.
Tweaked the CSS for the Online Users Widget.
Tweaked the CSS for Widgets in every theme with a sidebar.
Refactored the template initialisers to hopefully reduce the amount of boilerplate and make things easier to maintain and follow.
Add genIntTmpl in the template initialiser file to reduce the amount of boilerplate needed for the fallback template bindings.

Removed the topics_head phrase.
Moved the paginator_ phrases into the paginator. namespace and renamed them accordingly.
Added the paginator.first_page phrase.
Added the paginator.first_page_aria phrase.
Added the paginator.last_page phrase.
Added the paginator.last_page_aria phrase.
Added the panel_forum_delete_are_you_sure phrase.

Fixed a data race in LogWarning()
2019-02-10 15:52:26 +10:00
Azareal dc8079f581 Tests should build now. 2019-01-21 22:37:05 +10:00
Azareal 8f2f47e8aa Added the In-Progress Widget Manager UI.
Added the IsoCode field to phrase files.
Rewrote a good portion of the widget system logic.
Added some tests for the widget system.
Added the Online Users widget.
Added a few sealed incomplete widgets like the Search & Filter Widget.
Added the AllUsers method to WsHubImpl for Online Users. Please don't abuse it.

Added the optional *DBTableKey field to AddColumn.
Added the panel_analytics_time_range template to reduce the amount of duplication.
Failed registrations now show up in red in the registration logs for Nox.
Failed logins now show up in red in the login logs for Nox.
Added basic h2 CSS to the other themes.
Added .show_on_block_edit and .hide_on_block_edit to the other themes.
Updated contributing.
Updated a bunch of dates to 2019.
Replaced tblKey{} with nil where possible.
Switched out some &s for &s to reduce the number of possible bugs.
Fixed a bug with selector messages where the inspector would get really jittery due to unnecessary DOM updates.
Moved header.Zone and associated fields to the bottom of ViewTopic to reduce the chances of problems arising.
Added the ZoneData field to *Header.
Added IDs to the items in the forum list template.
Split the fetchPhrases function into the initPhrases and fetchPhrases functions in init.js
Added .colstack_sub_head.
Fixed the CSS in the menu list.
Removed an inline style from the simple topic like and unlike buttons.
Removed an inline style from the simple topic IP button.
Simplified the LoginRequired error handler.
Fixed a typo in the comment prior to DatabaseError()
Reduce the number of false leaves for WebSocket page transitions.
Added the error zone.
De-duped the logic in WsHubImpl.getUsers.
Fixed a potential widget security issue.

Added twenty new phrases.
Added the wid column to the widgets table.

You will need to run the patcher / updater for this commit.
2019-01-21 22:27:59 +10:00
Azareal 5db5bc0c7e Reply attachments can be managed too now.
Added eight database indices.
Fixed a bug where the second tick wouldn't fire.
Tweaked the .topic_forum in Nox by a pixel.
Replaced some _installer strings with blank strings for consistency with the builders.
Greatly reduced the number of allocations in the user agent parser.
Added ampersand entities in more attachment URLs to avoid accidental mangling.
.edit_source is now hidden for guests.
Guest noavatars are now pre-calculated to reduce the number of allocations.
Lazily initialised a couple of maps in ViewTopic to reduce the number of unnecessary allocations slightly.

Added the unsafe BytesToString function. Please don't use this, if you don't have to.
Added the AddIndex method to the adapter and associated components.
Added the /reply/attach/add/submit/ route.
Added the /reply/attach/remove/submit/ route.
Added the topic_alt_userinfo template.
Replaced Attachments.MiniTopicGet with MiniGetList.
Added Attachments.BulkMiniGetList.

Added a quick test for ReplyStore.Create.
Added BenchmarkPopulateTopicWithRouter.
Added BenchmarkTopicAdminFullPageRouteParallelWithRouter.
Added BenchmarkTopicGuestFullPageRouteParallelWithRouter.

You will need to run the updater or patcher for this commit.
2018-12-31 19:03:49 +10:00
Azareal 3465e4c08f You can now manage the attachments for an opening post by hitting edit.
The update system now uses the database as the source of truth for the last version rather than lastSchema.json
Refactored several structs and bits of code, so we can avoid allocations for contexts where we never use a relative time.
Clicking on the relative times on the topic list and the forum page should now take you to the post on the last page rather than just the last page.
Added the reltime template function.
Fixed some obsolete bits of code.
Fixed some spelling mistakes.
Fixed a bug where MaxBytesReader was capped at the maxFileSize rather than r.ContentLength.
All of the client side templates should work again now.
Shortened some statement names to save some horizontal space.
accUpdateBuilder and SimpleUpdate now use updatePrebuilder behind the scenes to simplify things.
Renamed selectItem to builder in AccSelectBuilder.
Added a Total() method to accCountBuilder to reduce the amount of boilerplate used for row count queries.
The "_builder" strings have been replaced with empty strings to help save memory, to make things slightly faster and to open the door to removing the query name in many contexts down the line.
Added the open_edit and close_edit client hooks.
Removed many query name checks.
Split the attachment logic into separate functions and de-duplicated it between replies and topics.
Improved the UI for editing topics in Nox.
Used type aliases to reduce the amount of boilerplate in tables.go and patches.go
Reduced the amount of boilerplate in the action post logic.
Eliminated a map and a slice in the topic page for users who haven't given any likes. E.g. Guests.
Fixed some long out-dated parts of the update instructions.
Updated the update instructions to remove mention of the obsolete lastSchema.json
Fixed a bug in init.js where /api/me was being loaded for guests.
Added the MiniTopicGet, GlobalCount and CountInTopic methods to AttachmentStore.
Added the MiniAttachment struct.
Split the mod floaters out into their own template to reduce duplication.
Removed a couple of redundant ParseForms.

Added the common.skipUntilIfExistsOrLine function.
Added the NotFoundJS and NotFoundJSQ functions.
Added the lastReplyID and attachCount columns to the topics table.
2018-12-27 15:42:41 +10:00
Azareal 52c8be4173 Variables which are computed multiple times in templates should only be computed once now.
Enabled the Watchdog Goroutine.
Moved a couple of parser tests into their own file.
Eliminated the hard-coded URLs in TestParser()
Refactored the alert system so that a specific actor is only loaded once rather than once for each alert. This isn't a problem in practice due to the user cache, but it might be on high traffic sites.
Don't run HandleServerSync() on single server setups.
Don't load the user in GetTopicUser(), if the topic creator is the current user.
Fixed a bug in the template generator where endloop nodes were being pushed instead of endif ones.
2018-11-22 17:21:43 +10:00
Azareal 9f273a99f5 Trying to reduce the amount of UserCheck() boilerplate in the routes.
Reduced the amount of boilerplate in routes with renderTemplate()
Reduced the amount of boilerplate in routes with ParseSEOURL()
Removed some dated commented bits of code.
Used StashConfig in a few more places in the benchmarks to reduce the amount of boilerplate.

Renamed the pre_render_forum_list hook to pre_render_forums.
Renamed the pre_render_topic_list hook to pre_render_topics.
Renamed a few benchmark variables to simplify the code.
2018-11-12 19:23:36 +10:00
Azareal 76cfcb509b Moved the phrase logic to the phrases package.
Removed some initialisation boilerplate from the test code.
De-duplicated some of the common portions of the benchmarks.
Added miscinit to reduce the amount of initialisation boilerplate in the tests and to better catch initialisation errors.
Added a profile benchmark.
2018-11-01 16:43:56 +10:00
Azareal bf851bd9fc We now use Go 1.11 modules. This should help with build times, deployment and development, although it does mean that the minimum requirement for Gosora has been bumped up from Go 1.10 to Go 1.11
Added support for dyntmpl to the template system.
The Account Dashboard now sort of uses dyntmpl, more work needed here.
Renamed the pre_render_view_topic hook to pre_render_topic.
Added the GetCurrentLangPack() function.
Added the alerts_no_new_alerts phrase.
Added the account_level_list phrase.

Refactored the route rename logic in the patcher to cut down on the amount of boilerplate.
Added more route renames to the patcher. You will need to run the patcher / updater in this commit.
2018-10-27 13:40:36 +10:00
Azareal 876ae4e245 Refactored the plugin system to use a hook table. This should help to reduce the probability of data races and strange bugs, as-well as helping to abstract certain details, so future changes are less likely to break things.
Fixed the missing background for the create topic non-JS page in Nox.
The non-JS create topic page now has a localised title.
2018-10-21 23:54:32 +10:00
Azareal 4d75c543d2 Refactored most of the string-string tests to reduce the amount of boilerplate. 2018-10-08 14:38:51 +10:00
Azareal f721780c0d Refactored some of the reply tests.
Added some topic post count tests.
Added a very simple action post test.

Changed the signature of *Topic.CreateActionReply to take an integer rather than a *User.
2018-10-08 14:15:06 +10:00
Azareal 2acf4e1568 Added simple tests for the modlogs and adminlogs. 2018-10-08 12:51:59 +10:00
Azareal 650a8a9be1 Added tests for the topic methods and topic creation.
Added a few more cases to TestWordCount.
2018-10-07 20:46:49 +10:00
Azareal ebbfa7d247 Bumped up the version of MariaDB on Travis.
Replaced a couple of expects with expectNilErrs so we don't lose the original errors messages in those tests.
Fixed a couple more MySQL default value issues.
2018-10-07 00:02:52 +10:00
Azareal 0b44d69efc The alert list can be localised now.
Removed a bit more boilerplate in the unit tests.
Fixed a bug where the alert list wouldn't load.
2018-10-05 17:41:28 +10:00
Azareal be66ac4c8d Added tests for the word counter. 2018-10-04 19:01:07 +10:00
Azareal f517fc2e65 More user test refactoring.
Added a utfmb4 username test.
2018-10-04 14:59:14 +10:00
Azareal beb2d99469 Refactored the user tests to reduce the amount of boilerplate.
Refactored BuildAlert to call into a function rather than building the alert strings itself.
Added a couple of unicode related unit tests.
2018-10-04 12:58:01 +10:00
Azareal e9645c07bd Added support for simple named mentions.
Added a GetByName method to the UserStore.
Added eight mention tests.

Added the tryStepBackward function, might get removed.
Removed some superfluous commented debug statements.
2018-09-20 16:31:09 +10:00
Azareal 47d1010a53 Added the AddHashLinkType function so that plugins can add custom hash link types in an efficient manner.
Moved the hashLinkMap, etc. out of ParseMessage so that we can make them more pluggable.
The first word in usernames can no longer be purely numeric.
Added some ID mention tests.
2018-09-20 14:36:50 +10:00
Azareal f6b889b53b # is now allowed in URLs.
Added a few hashlink tests.
2018-09-20 12:58:06 +10:00
Azareal 5d4013f500 Probe out this failing test case. 2018-09-20 11:42:45 +10:00
Azareal 5a189e7180 We can probably be looser with ParseMessage than with PreparseMessage as it handles these edge cases for us. 2018-09-20 11:37:50 +10:00
Azareal ed481fb75b The parser handles these ones not the pre-parser. 2018-09-20 11:28:21 +10:00
Azareal 138a97d69b Added URL parser tests. 2018-09-20 11:11:44 +10:00
Azareal 01a692ab5b Added the word filter store and moved the word filter routes into the route package.
Added tests for the word filter store.
Added qgen.NewAcc() to reduce the amount of boilerplate needed for creating an accumulator.
Exposed the RecordError method on the accumulator.
Added an Add method to PluginList and removed AddPlugin() in favour of that.

More panel buttons on Nox should be styled now.
Added the panel_update_button_text phrase for future use.

More errors might be caught in the thumbnailer now.
Removed ls from .travis.yml, it was there for debugging Code Climate.
2018-08-04 21:46:36 +10:00
Azareal 8e81f922ea Added some new test cases to catch more things and to see if the statistics on Code Climate change.
Added more TODO ideas for changes.
Removed an unused field from LanguagePack.
2018-07-31 14:02:09 +10:00
Azareal 7691078ce5 Fixed a bug in AddHook where the indices of the hooks would be off by one.
RemoveHook now panics under conditions which should normally never happen, but which when it does, gives off a far more useful message.
Changed the order of the conditional after BypassActive in PluginsDeactivate, so the error message will show up now.
The deactivation handler is optional again for plugins.

Added more tests for the plugin system.
2018-07-29 23:02:48 +10:00
Azareal 50d5be6f32 Moved the plugin manager to the routes package.
Added many, many tests for the plugin system.
Refactored some of the plugin system queries.

Fixed a bug where prepared statements would build up and crash Gosora.
Removed the inline CSS from the plugin rows.
2018-07-29 20:54:12 +10:00
Azareal c640a73afd Fixed a crash bug in the post preparser.
Moved tryStepForward out of PreparseMessage()
Added another test for PreparseMessage()
2018-06-30 14:34:07 +10:00
Azareal bf40d61474 Live Topic List should work properly now with replies too, not just new topics.
Tweaked the visuals for the live topic list on Cosora. More to come with this.
Nox Theme is now present on the theme selector, although it's still under construction.

Improved SEO for social media.
Added the topic_list tmpl phrase prefix.
Added the topic_list.changed_topics phrase.
Added a few more PreparseMessage tests.
Session cookies should now be deleted after you logout, not just blanked.
2018-06-30 13:40:50 +10:00
Azareal 65ceaef4ea Tightened the preparser up a little and wrote more tests to cover more bases.
Green is a little misleading, as we Gosora doesn't call home to check for new versions yet.
2018-06-26 14:54:20 +10:00
Azareal 6eb3429c25 Added i as an alias for em in the HTML parser.
b is now an alias for strong in the HTML parser rather than being it's own thing.
Fixed a bug where tags weren't being closed.
Fixed a bug where the right entities weren't being written all the time.

Added tests for the preparser.
2018-06-26 12:30:29 +10:00
Azareal 1308027c34 This should do it 2018-06-17 18:12:39 +10:00
Azareal 2d7f302768 Build artifacts are now cleaned up on Windows too.
Tests should be a lot less noisy now.

Fixed a bug where BulkGetMap didn't return any users if you opted out of using a memory cache for the user store.
Used new() in a few more places.
Fixed a test which didn't work properly.
Tweaked the panel_pages_no_pages phrase.
2018-06-06 16:13:55 +10:00
Azareal a5f5f4af7e Added the Page Manager for faster and easier custom page creation.
Added the PageStore.

Renamed account_own_edit.html to account_own_edit_password.html
Renamed custom-page.html to custom_page.html
Renamed the pre_render_custom_page hook to pre_render_tmpl_page.
Added a new pre_render_custom_page hook, not to be confused with the previous one.
Renamed the pre_render_account_own_edit_critical hook to pre_render_account_own_edit_password.
Moved the report forum ID into a constant.
Renamed todaysReportCount to topicsTopicCountByForum and made it more generic.
Renamed panel-menu.html to panel_menu.html
Renamed panel-inner-menu.html to panel_inner_menu.html
Removed an irrelevant editable_parent in a no results row.
Fixed the profile page loading the wrong profile.css
Fixed a bug where the last poster avatar would break on the forum page.
Added the AddNotice method to *Header.
Greatly simplified many of the page struct definitions.
Added the ErrorPage page struct and refactored the error pages to use it.
Added the BasePanelPage page struct and refactored the panel page structs to use it.
Tweaked the DefaultHeader function to set the user on the spot rather than after the fact.
Simplified AccountEditAvatarSubmit into a redirect.
Add the addElement closure in the control panel dashboard to reduce the amount of complexity.
Tweaked LogWarning to better handle nils.

Added the account_username phrase.
Added the account_avatar phrase.
Added the account_email phrase.
Added the panel_pages phrase.
Added the panel_pages_edit phrase.
Added the panel_page_created phrase.
Added the panel_page_updated phrase.
Added the panel_page_deleted phrase.
Added the account_menu_security phrase.
Added the panel_menu_pages phrase.
Added the panel_pages_head phrase.
Added the panel_pages_edit_button_aria phrase.
Added the panel_pages_delete_button_aria phrase.
Added the panel_pages_no_pages phrase.
Added the panel_pages_create_head phrase.
Added the panel_pages_create_name phrase.
Added the panel_pages_create_name_placeholder phrase.
Added the panel_pages_create_title phrase.
Added the panel_pages_create_title_placeholder phrase.
Added the panel_pages_create_body_placeholder phrase.
Added the panel_pages_create_submit_button phrase.
Added the panel_pages_edit_head phrase.
Added the panel_pages_name phrase.
Added the panel_pages_title phrase.
Added the panel_pages_edit_update_button phrase.

Began work on two-factor authentication.
Made more progress with the Nox Theme.
2018-06-06 10:21:22 +10:00
Azareal 4d6a7bfda1 You can now change someone's group again.
The background no longer randomly vanishes on Shadow.
Fixed the small margins on the paginator on Shadow.
Tweaked the padding for the paginator in the Control Panel on Shadow.
The footer is no longer 100% wide on Shadow.
Fixed a misplaced ':' in Shadow.
Added the BlankProfileReply function for tests.
Tests now run once more.
Made it easier to trace test errors which use recordMustExist and recordMustNotExist.

Added tests for profile reply deletion.
Added tests for GeneratePassword in addition to the existing ones for BcryptGeneratePassword.
Added tests for Auth.Authenticate.
Added tests for Auth.CreateSession.

Added a contributor convention for highly unstable builds.
This can be considered a stable build.
2018-05-28 16:27:12 +10:00