Giter VIP home page Giter VIP logo

yaga's Introduction

YAGA for Vanilla 3.3 and up

This is a fork of the great YAGA (Yet Another Gamification Application) for Vanilla forums by @hgtonight. All of the original credit goes to him.

https://github.com/hgtonight/Application-Yaga

Installation

This is a plugin. Please install it to plugins/yaga and enable it through the Vanilla dashboard.

If you have the original YAGA application installed:

  • Disable the old application first.
  • Make sure you remove the folder applications/yaga entirely before enabling the new plugin. If the old folder still exists, Vanilla will autoload wrong classes and the plugin will not work.
  • Delete the addon cache cache/addon.php
  • Unpack this plugin to plugins/yaga and enable it in the dashboard.

Upon installation, all tables and data will be converted automatically. You may need to run utility/structure twice.

If you are upgrading from YAGA 2.0.x or earlier, also run dba/counts once (tick "Recalculate Reaction.Latest").

yaga's People

Contributors

bleistivt avatar domingoruiz avatar r-j avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

r-j pioc92

yaga's Issues

Fatal Error in Gdn_Controller.fetchView();

Hi bleistivt,
i installed your yaga plugin,
when i clic on a badge on https://dev.routeur4g.fr/yaga/badges i have this error:

syntax error, unexpected ''span'' (T_CONSTANT_ENCAPSED_STRING), expecting ')'
The error occurred on or near: /home/planning/sites/dev.routeur4g.fr/plugins/yaga/views/yaga/badgedetail.php
26: Gdn::translate('Yaga.Badge.Earned').' '.
27: wrap(
28: //$dateFormatter->formatDate($userBadgeAward->DateInserted, true),
29: Gdn_Format::date($userBadgeAward->DateInserted, 'html')
30: 'span',
31: ['class' => 'DateReceived']
32: ),
33: 'div',
34: ['class' => 'EarnedThisBadge']
Backtrace:
[/home/planning/sites/dev.routeur4g.fr/library/core/class.controller.php:1386] Gdn_Controller->fetchView();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.pluggable.php:217] Gdn_Controller->xRender();
[/home/planning/sites/dev.routeur4g.fr/plugins/yaga/controllers/class.yagacontroller.php:188] Gdn_Pluggable->__call();
[/home/planning/sites/dev.routeur4g.fr/plugins/yaga/controllers/class.yagacontroller.php:147] YagaController->badgeDetail();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.dispatcher.php:872] YagaController->badges();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.dispatcher.php:289] Gdn_Dispatcher->dispatchController();
[/home/planning/sites/dev.routeur4g.fr/index.php:29] Gdn_Dispatcher->dispatch();

Remove/Move globals

This includes:

  • global functions from Vanilla (a lot has already been replaced)
  • The global Yaga factory class
  • utility & render functions

In order not to break more plugins, the public API should stay as is and parts should be aliased, not removed entirely.

Randomly Get Disabled

Yaga Plugin Randomly Get Disabled Most Happens When Clicking Through Reaction Settings Of Yaga, This Happens on Vanilla Version 2023.013

Summary of reactions (Grouping?)

At the moment it seems it's only possible to individually list each reaction. This can get pretty lengthy and challenging to see how many reactions each emoji got.

Is there any plans on being able to summarise/group reactions, like Github does?

πŸ‘ (4), ❀ (1)

Maybe there should be settings for "Start grouping at: X reactions" along with a "Show up to X usernames"

Dependency injection

Use the DI container more, search for Yaga static calls that could be replaced.

Integrate Yaga in APIv2

It would be nice to have namespaced APIv2 controllers for all frontend actions:

  • GET "best" content of all flavours
    • GET yaga-best/all
    • GET yaga-best/recent
    • GET yaga-best/reactions/{id}
    • GET yaga-best-users/{id}/reactions/{reactionID}
    • GET yaga-best-users/{id}/best
    • GET yaga-best-users/{id}/totals
  • GET available actions/totals
    • GET users/{id} {yaga-reactions: [...]}
    • GET comments {yaga-actions: [...]}
    • GET discussions {yaga-actions: [...]}
  • GET reactions for content (extend comment/discussion API)
    • GET comments {yaga-reactions: [...]}
    • GET discussions {yaga-reactions: [...]}
    • GET yaga-reactions/activity/{id}
    • GET yaga-reactions/comment/{id}
    • GET yaga-reactions/discussion/{id}
    • GET yaga-reactions/{type}/{id}
  • PUT, DELETE a reaction (reacting to content)
    • PUT yaga-reactions/{type}/{id}/{actionID}
    • DELETE yaga-reactions/{type}/{id}/{actionID}
  • GET a users badges
    • GET users/{id} {yaga-badges: [...]}
    • GET yaga-badges/users/{id}
  • GET all recent awards of a badge
    • GET yaga-badges/{id}
  • PUT, DELETE a badge award (un-/awarding a badge)
    • PUT yaga-badges/users/{id}/{badgeID}
    • DELETE yaga-badges/users/{id}/{badgeID}
  • GET leaderboard
    • GET yaga-leaderboard/{timeslot}
  • GET a users rank (extend profile/me API)
    • GET profile/me {yaga-ranks: [...]}
    • GET yaga-ranks/users/{id}
  • PUT, DELETE a users rank
    • PUT yaga-ranks/users/{id}/{rankID}
    • DELETE yaga-ranks/users/{id}/{rankID}

The old controller methods should be stripped of their functionality and call the new API.

Better pagers for "best" content

This fork has moved aggregation of "best" content to the database (before, everything was fetched and then aggregated by PHP, often hitting memory limits).

Getting the right count however would require a complex count query, which has been omitted for performance reasons, leading "prev/next" pagers being shown.

Once #1 is implemented, the total count can be more easily calculated and full pagers should be shown for all "best" content.

The "YagaController" object does not have a "xActionModel" method

Hi bleistivt!

i tried vanilla 4.0-rc1 on a local environment and when i tried to yaga export configuration, i have a fatal error
The "YagaController" object does not have a "xActionModel" method

The error occurred on or near: C:\projets\vanilla2020\discussions\library\core\class.pluggable.php 190: // Make sure that $ActualMethodName exists before continuing: 191: if (!method_exists($this, $actualMethodName)) { 192: // Make sure that a plugin is not handling the call 193: if (!Gdn::pluginManager()->hasNewMethod($className, $referenceMethodName)) { 194: throw new \BadMethodCallException( 195: "The \"$className\" object does not have a \"$actualMethodName\" method.", 196: 501 197: ); 198: } Backtrace: [C:\projets\vanilla2020\discussions\plugins\yaga\controllers\class.yagacontroller.php:346] Gdn_Pluggable->__call(); [C:\projets\vanilla2020\discussions\plugins\yaga\controllers\class.yagacontroller.php:254] YagaController->_exportData(); [C:\projets\vanilla2020\discussions\library\core\class.dispatcher.php:933] YagaController->export(); [C:\projets\vanilla2020\discussions\library\core\class.dispatcher.php:335] Gdn_Dispatcher->dispatchController(); [C:\projets\vanilla2020\discussions\index.php:29] Gdn_Dispatcher->dispatch();

Hope this help!

I tried to do it on my production forum and i have a "something wrong error" too!

migration of yaga ->badges svg have the old path!

The migration doesn't change the path of badges

/applications/yaga/design/images/default_badges.svg#anniversary-2

instead of

/plugins/yaga/design/images/default_badges.svg#anniversary-2

So img of badges is broken!

Using own reaction icons is not intuitive

As far as I can tell the list of reactions is hard coded into ActionController->edit(). If you know some CSS you can see that with defining your custom css class you would be able to use your own icon as a reaction. But you need to know that, there is no hint at all.

I would suggest to open the reaction edit/add view not a a popup but as a full view so that you can make use of the helpAsset() helper function in order to give a short example.

  • Upload your image into the /uploads folder
  • Create a css style either in your custom theme or with the Pockets plugin or the CSSEdit plugin
  • Put the name in the Css Class field

That might be too bloated and maybe putting that as an additional pargraph below the edit/add form control would be better. Eventually that could come with an example

General code formatting & cleanup

Most of this should be done, but there may still be wrong indents or casing somewhere.

Some model functions may also be unused and can be removed.

Anonymous reactions permission

Would be awesome if there was a new permission which allowed users to react anonymously.

Default display:

billy πŸ‘   bob πŸ‘ 

Yaga.Reactions.Anonymous once enabled anyone in that Role with that permission enabled it will hide their username and avatar and show a count of those reactions:

(2) πŸ‘ 

Better caching for "best" content

With an active cache, only the guest version is currently cached but also shown to logged in users once generated, hiding protected content for those who should see it.

error on /dba/counts BadgeAwardModel

Hi,
when i make a /dba/counts, i have an error on
Recalculate BadgeAward.CountBadges

Too few arguments to function BadgeAwardModel::__construct() , 0 passed in /MYSITE/discussions/applications/dashboard/models/class.dbamodel.php on line 49 and exactly 1 expected

no content in best

Hi bleistivt.
i haven't any content in the best section.
I only have the filter menu but when i click on items in the menu, no content appears at all!
It's not new but i have users of my forum who ask me why there is no content to show!

https://routeur4g.fr/discussions/best

i tried different themes but it's not theme related.

Thanks

Reactions unnoticed

Hi, Thanks for your hard work.

Reactions on its own is a powerful tool for engagement and encouragement. It is already doing its job in YAGA. The only blind spot is that people might not actually notice an appreciation they received.

Would it be possible to have notifications made available for reactions ? I understand that too many notifications can be bad. If it is not wrong mentioning another platform, Discourse follows a grouping system for Notifications based on 4 likes in this thread or 5 like by person B.

In the end, I think the grouping of notification flood is more or less like how Windows groups Firefox and Chrome windows in the taskbar.

Apart from that, there is scope for disabling Notifications in settings so that when a webmaster feels that Notifications in YAGA is not good for their platform, they can turn it off completely.

Export fails

Just trying to export my yaga config (badges, ranks, reactions all checked).
I have this fatal error.
Thanks
I tried to make a utiliy/structure for database correction but everything is ok

Unknown column 'Level' in 'order clause' The error occurred on or near: /home/planning/sites/routeur4g.fr/discussions/library/database/class.database.php 403: // If we get here then the pdo statement prepared properly. 404: break; 405: 406: } catch (Gdn_UserException $uex) { 407: trigger_error($uex->getMessage(), E_USER_ERROR); 408: } catch (Exception $ex) { 409: list($state, $code, $message) = $pDO->errorInfo(); 410: 411: // If the error code is consistent with a disconnect, attempt to retry Backtrace: /home/planning/sites/routeur4g.fr/discussions/library/database/class.database.phpPHP::gdn_ErrorHandler(); [/home/planning/sites/routeur4g.fr/discussions/library/database/class.database.php:407] PHP::trigger_error(); [/home/planning/sites/routeur4g.fr/discussions/library/database/class.sqldriver.php:1707] Gdn_Database->query(); [/home/planning/sites/routeur4g.fr/discussions/library/database/class.sqldriver.php:664] Gdn_SQLDriver->query(); [/home/planning/sites/routeur4g.fr/discussions/library/core/class.model.php:560] Gdn_SQLDriver->get(); [/home/planning/sites/routeur4g.fr/discussions/plugins/yaga/models/class.rankmodel.php:43] Gdn_Model->get(); [/home/planning/sites/routeur4g.fr/discussions/plugins/yaga/controllers/class.yagacontroller.php:356] RankModel->get(); [/home/planning/sites/routeur4g.fr/discussions/plugins/yaga/controllers/class.yagacontroller.php:254] YagaController->_exportData(); [/home/planning/sites/routeur4g.fr/discussions/library/core/class.dispatcher.php:872] YagaController->export(); [/home/planning/sites/routeur4g.fr/discussions/library/core/class.dispatcher.php:289] Gdn_Dispatcher->dispatchController(); [/home/planning/sites/routeur4g.fr/discussions/index.php:29] Gdn_Dispatcher->dispatch(); Variables in local scope: [sql] 'select * from GDN_YagaRank YagaRankorder byLevel asc' [inputParameters] array ( ) [options] array ( 'Type' => 'select', 'Slave' => NULL, 'ReturnType' => 'DataSet', ) [returnType] 'DataSet' [tries] 2 [try] 0 [pDO] array ( ) [pDOStatement] false [state] '42S22' [code] 1054 [message] 'Unknown column \'Level\' in \'order clause\'' [uex] array ( )

Activity page with leaderboard doesn’t work

Hi,
myforum.com/activy doesn’t work if i enable the leaderboard:

`Fatal Error in LeaderBoardModule.FetchView();

Could not find a leaderboard view for the LeaderBoardModule module in the dashboard application.
The error occurred on or near: /home/planning/sites/dev.routeur4g.fr/library/core/class.module.php
216: $viewPath = Gdn_FileSystem::exists($viewPaths);
217: }
218:
219: if ($viewPath === false) {
220: throw new Exception(errorMessage('Could not find a '.$view.' view for the '.$this->name().' module in the '.$applicationFolder.' application.', get_class($this), 'FetchView'), E_USER_ERROR);
221: }
222:
223: return $viewPath;
224: }
Backtrace:
[/home/planning/sites/dev.routeur4g.fr/library/core/class.module.php:122] Gdn_Module->fetchViewLocation();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.module.php:281] Gdn_Module->fetchView();
[/home/planning/sites/dev.routeur4g.fr/plugins/yaga/modules/class.leaderboardmodule.php:91] Gdn_Module->toString();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.controller.php:348] LeaderBoardModule->toString();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.controller.php:463] Gdn_Controller->addAsset();
[/home/planning/sites/dev.routeur4g.fr/plugins/yaga/class.yaga.plugin.php:644] Gdn_Controller->addModule();
[/home/planning/sites/dev.routeur4g.fr/plugins/yaga/class.yaga.plugin.php:644] YagaPlugin->activityController_render_before();
[/home/planning/sites/dev.routeur4g.fr/library/Garden/EventManager.php:278] PHP::call_user_func_array();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.pluginmanager.php:810] Garden\EventManager->fire();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.pluginmanager.php:768] Gdn_PluginManager->callEventHandler();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.pluggable.php:205] Gdn_PluginManager->callEventHandlers();
[/home/planning/sites/dev.routeur4g.fr/applications/dashboard/controllers/class.activitycontroller.php:158] Gdn_Pluggable->__call();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.dispatcher.php:872] ActivityController->index();
[/home/planning/sites/dev.routeur4g.fr/library/core/class.dispatcher.php:289] Gdn_Dispatcher->dispatchController();
[/home/planning/sites/dev.routeur4g.fr/index.php:29] Gdn_Dispatcher->dispatch();
`

BadgeAwardModel: Merge exists() & getAwards()

BadgeAwardModel::exists() is basically identical to the new function BadgeAwardModel::getAwards(). If the former one would use the cache (reliably), the latter could be removed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.