Commit Graph

88 Commits

Author SHA1 Message Date
Azareal f4337536dc Quick reply now takes you to your post rather than the first page of the topic.
Added the LastPage function.
2018-12-28 17:12:14 +10:00
Azareal 4813403fbb Posts should now be properly rendered after an inline edit.
Moved uploadAttachment and deleteAttachment from route/topic.go to route/attachments.go

Fixes #47
2018-12-28 12:08:35 +10:00
Azareal bf2af0ae96 Laid the foundations for better reply attachments.
The attachment manager introduced in the previous patch is now properly localised.

Repurposed AttachmentStore.CountInTopic as a more general CountIn method.
Added an & entity in attachment URLs so that the characters don't get mutated into something weird.
Tried to make the linebreaks a little glitchy in the inline editor, we have a better solution in a mind soon!
Fixed a bug where replies used .ContentHTML instead of .Content which led to a lot of HTML getting in the way of reply edits.
Fixed a bug where reply attachments used the topicID rather than the replyID for their originID entries.
Fixed a bug where the topic attachment counts weren't getting incremented.

Added the topic.select_button_test, topic.copy_button_test and topic.upload_button_test phrases.

Added the attachCount column to the replies table. This commit requires you to run the patcher / updater.
2018-12-27 19:12:30 +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 543ad8a018 Added the login log.
Added a better paginator for view topic.
The last post on the topic list and forum pages now link to the last page of a topic for quicker navigation.
The Account Manager now utilises dyntmpl in more areas.
More tooltips.
Tweaked the colour for the validated emails in the Email Manager so it looks nicer on dark themes.
Moved some inline styles from the Email Manager into the stylesheets and removed obsolete ones.
Added the mixed BenchmarkTopicGuestAdminRouteParallelWithRouter benchmark.
The bad route benchmark should no longer abort when erroring, something which doesn't make sense as it's always expected to error.
Reduce a bit more boilerplate with renderTemplate()
Added the *CTemplateSet.addText method and used it to optimise the generated templates a tiny bit more.
The forums route now has guest and member variants generated for it.
Turned the experimental template optimisation back on for more data.

Added the routes.AccountLogins route.

Added the account_logins phrase.
Added the account_menu_logins phrase.
Added the account_logins_head phrase.
Added the account_logins_success phrase.
Added the account_logins_failure phrase.

You need to run the patcher / updater for this commit.
2018-12-17 14:58:55 +10:00
Azareal dc974cf72b Improved mobile usability for Nox in the topic list, profiles, account manager and control panel. More to come.
Fixed a bug in the template generator where fragment indices would sometimes become negative.
Forum pages are now considered to be part of /forums/ instead of /topics/ in the menu tab highlighter.
Fixed a bug in the forum page in Nox where the forum options weren't aligned to the right.
Switched out a couple of {{if ne .CurrentUser.ID 0}}s for {{if .CurrentUser.Loggedin}}s
Moved the filter opt separator into it's own DOM node for easier styling.

Added the quick_topic.create_topic_button_short phrase.
Added the topic_list.moderate_short phrase.
2018-12-08 16:49:14 +10:00
Azareal 99012e8961 Replaced RunThemeTemplate and GetThemeTemplate with methods on *Theme and refactored their implementations to make them more predictable.
Added the Elapsed1 route timer.
2018-12-08 10:45:27 +10:00
Azareal a20078d83b Revamped the IP Search Page for Nox.
Revamped the Word Filter Manager for Nox.
Revamped the Setting Manager for Nox and Cosora.
Upped the number of items in the User Manager.
Upped the number of items in the Group Manager.
Upped the number of items in the Page Manager.
Swap a fmt.Println for a DebugLog in hold.ScanItem.
EQCSS.js should ignore panel.css in Cosora now.
Added the lang template function for stylesheet templates to reduce the amount of boilerplate.
Localised a couple of spots in the Nox Theme which got overlooked.
Tweaked the grid CSS for Nox.
The Control Panel Dashboard items now change colour in Nox like in the other themes.
Use Site.Host instead of req.Host for www redirects for security reasons.
Removed a superfluous function call in WriterIntercept.WriteHeader.
Tweaked several bits and pieces of CSS like the padding on a few items in the Forum Editor.

Added the topic_list.moderate phrase.
Added the panel_word_filters_to phrase.
2018-12-06 21:09:10 +10:00
Azareal 27fb79d4d5 Fixed a bug where forums inheriting from the group didn't appear on the forum list and the topic list.
Cleaned up the logic in preRoute slightly.
Reordered the logic in preRoute so that the CSP is set for the PreError too.
Clear a user's cached data when their IP changes.
Hide the comment header when there aren't any comments.
2018-11-29 17:27:17 +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 e67009d4e3 Move ShowAttachment into it's own file. 2018-11-20 14:07:36 +10:00
Azareal 352a262866 Only cache public attachments in the browser and CDNs.
The browser might overrule it anyway, if it's really obvious that it should be cached.
This is mainly so Cloudflare, etc. don't serve sensitive documents to guests.
2018-11-20 14:00:32 +10:00
Azareal 4759ec9c4c The settings should be validated properly now when they're updated.
Added more features to RouteError and RouteErrorImpl to help in suppressing sensitive information.
Refactored the setting update logic, so the settings are reloaded all at once rather than updated individually.
Renamed the router variables in the generated router to r to reduce the number of characters we have to type there.
Renamed some of the r variables in the generated router to req for consistency sake.
2018-11-13 16:51:34 +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 f5a0e3386b Action posts can now be localised.
Tweaked the updating instructions.
2018-10-27 14:55:53 +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 218070fceb Added the DisableJSAntispam config.json setting. 2018-10-16 20:02:51 +10:00
Azareal c15f02396a Fixed a bug where a user's tag can get desynced with their group. 2018-10-14 16:16:42 +10:00
Azareal 34b8d8dc3c Fixed a bug where group permissions didn't update until Gosora was restarted.
The profile titles can now be localised.
The profile owner tag can now be localised.

Added some changes I forgot to push in the previous commit.
2018-10-14 16:09:25 +10:00
Azareal aabfbe3622 Highlight the currently active zone in the menu for Nox.
Replaced the Level Progress widget in the Account Dashboard with a similar progressbar to the one in the level progress page.
2018-10-14 15:08:44 +10:00
Azareal 05ab585d41 Added the level list page.
Levels can now be localised individually.
Added the level template function.
Fixed the padding on alerts without avatars.
The level data is now in it's own block in the profiles.
Removed three level phrases and replaced them with the new Level API.
2018-10-10 17:33:51 +10:00
Azareal de78268b20 Added level progress indicators, still WIP.
Fixed a bug where GetLevelScore wouldn't work and simplified it slightly.
Removed the account_dash_next_level phrase.
Added the account_dash_level phrase.
2018-10-08 15:34:25 +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 b02175d7ae Localised the errors in /routes/panel/groups.go
Fixed a typo in a group manager phrase.
2018-10-03 20:10:55 +10:00
Azareal a365e42dcf Added a missing panel_ prefix for a template and added a couple more error phrases. 2018-10-02 17:20:55 +10:00
Azareal 0039b9c851 Reduced the amount of boilerplate in panel.Dashboard.
Localised a few things in panel.Dashboard.

Added the GetTmplPhrasef function.
2018-10-02 16:56:24 +10:00
Azareal 6634f3f64b All the control panel routes have been moved to /routes/panel/ now.
Moved the software version to common.go for better accessibility.
2018-10-02 15:03:20 +10:00
Azareal b2e97e47c1 Moved the last control panel theme manager route into /routes/panel/
Added the UpdateDefaultTheme function.

Renamed panelRenderTemplate to renderTemplate.
Renamed panelSuccessRedirect to successRedirect.
Reduced the amount of boilerplate in panel.GroupsEdit with renderTemplate.
Renamed the pre_render_panel_edit_group hook to pre_render_panel_group_edit.
Reduced the amount of boilerplate in panel.GroupsEditPerms with renderTemplate.
Renamed the pre_render_panel_edit_group_perms hook to pre_render_panel_group_edit_perms.

Fixed a bug where the active status for themes didn't get loaded at start-up.
Fixed a theoretical deadlock in NewThemeList.
Updated CONTRIBUTING.md
2018-10-02 14:09:17 +10:00
Azareal 750c0ff442 Moved all but one of the control panel theme routes into /routes/panel/ 2018-10-01 00:43:46 +10:00
Azareal dea74eb32a Localised the registration errors. 2018-09-30 19:48:31 +10:00
Azareal d675b2720f Began localising the id_must_be_integer and url_id_must_be_integer error pages.
Fixed the punctuation on a couple of registration errors, these will be localised too soon enough.
Removed a bit of boiletplate in groups.go with buildBasePage.
2018-09-30 10:42:33 +10:00
Azareal 322a46bcb5 Moved the control panel group routes into /routes/panel/
Added the Update, UpdatePerms and CopyPtr methods to *Group.
2018-09-30 10:08:27 +10:00
Azareal 859ed2c730 Finished the Most Viewed Page for Nox.
Added three phrases for topic_list.
Moved the topic_middle_inside suffix phrases from the CSS files into the template proper.
Removed a newline in topic_middle_inside and used flex instead.
The link_select drop-down is now only visible when someone clicks on the link.
Tweaked the .topic_forum line height for Cosora.
Tweaked the .topic_view_count font size for Cosora.
2018-09-26 17:46:30 +10:00
Azareal 15b3ad07fa Try to eliminate some of these debug comments. 2018-09-24 09:42:17 +10:00
Azareal a1403d495d Let's see how we can best do this o-o 2018-09-20 18:56:50 +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 39adc2e606 Per-topic views are now visible in the topic pages for the Nox Theme.
The parent forum of a topic is now visible on the topic pages for the Cosora and Nox Themes.
Added basic styling for polls to the Nox Theme.
Improved the styling for topic title editing in the Nox Theme.
2018-08-30 20:31:21 +10:00
Azareal 465d5c7835 The Topic page is nearly done for Nox, just the buttons and a few little things now.
Fixed the paginator in the Nox Panel.
Eliminated a redundant class="" in the registration logs when the registration is a success.

Part-way through fixing the analytics page header.
2018-08-30 15:53:21 +10:00
Azareal 0d96f4efac Use the correct mimetype for SQL backups. 2018-08-22 16:37:36 +10:00
Azareal 8f7cda9378 Don't double-compress avatars.
Gzip is now disabled for static files when the gains don't justify the costs.
Moved StopServerChan and StoppedServer to package common.
Added some disabled profiling code.
2018-08-22 11:32:07 +10:00
Azareal 9e8f455bbb Added resource utilisation data to the Debug Page. 2018-08-16 15:27:26 +10:00
Azareal f2b210248a Only load Chartist when we actually have a chart on the page. 2018-08-13 22:37:53 +10:00
Azareal 4c86c0a042 Fixed gzip in /static/
The me endpoint is no longer served for guests.
2018-08-13 22:01:27 +10:00
Azareal 317ab8856b Move towards loading the important scripts asynchronously.
Removed the client's reliance on the server's Site.URL setting.
2018-08-13 11:53:16 +10:00
Azareal a9a1d667c0 Added the /api/me/ API endpoint.
Moved a script block into an API endpoint.
Split the gigantic switch in ServeHTTP into it's own function.
Scripts should load more efficiently now.
2018-08-12 01:53:42 +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