{"id":22045568,"url":"https://github.com/commanderfoo/proboards-profile-notifications","last_synced_at":"2025-03-23T14:16:53.442Z","repository":{"id":149743857,"uuid":"151455737","full_name":"CommanderFoo/ProBoards-Profile-Notifications","owner":"CommanderFoo","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-29T09:38:15.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T20:24:03.242Z","etag":null,"topics":["javascript","proboards"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CommanderFoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-03T17:51:48.000Z","updated_at":"2018-10-29T09:38:17.000Z","dependencies_parsed_at":"2023-04-25T03:39:00.598Z","dependency_job_id":null,"html_url":"https://github.com/CommanderFoo/ProBoards-Profile-Notifications","commit_stats":null,"previous_names":["commanderfoo/proboards-profile-notifications"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderFoo%2FProBoards-Profile-Notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderFoo%2FProBoards-Profile-Notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderFoo%2FProBoards-Profile-Notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommanderFoo%2FProBoards-Profile-Notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CommanderFoo","download_url":"https://codeload.github.com/CommanderFoo/ProBoards-Profile-Notifications/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245111881,"owners_count":20562511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","proboards"],"created_at":"2024-11-30T13:14:16.709Z","updated_at":"2025-03-23T14:16:53.412Z","avatar_url":"https://github.com/CommanderFoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Profile Notifications API 1.0.3\n===============================\n\nA plugin that creates an API which mimics the [ProBoards](https://www.proboards.com/) notifications system.\n\nThe plugin uses 1 super user key.  It would be possible to extend this to use multiple keys so more plugins can use it.  However, you would need to change the pruner to a [front multi key pruner](https://github.com/PopThosePringles/ProBoards-Yootil/blob/version-2/src/pruner.js).\n\nThe API is straight forward.\n\n```javascript\nlet user_id = parseInt(pb.data(\"user\").id, 10);\n\nprofile_notifications.api.create(user_id).notification(\"Hello World!\");\n```\n\nIf you need to know if the notification was successfully saved, then you can use the [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that is returned back.\n\n```javascript\nlet user_id = parseInt(pb.data(\"user\").id, 10);\n\nlet p = profile_notifications.api.create(user_id).notification(\"Hello World!\");\n\np.then(s =\u003e console.log(s)).catch(e =\u003e console.log(e));\n```\n\nThe way it works is simple.  We try to push a new item (the notification) to the key.  If there is no space, then the pruner takes over and [shifts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) items from the front of the key.  When there is space, it will then save the key.  Notifications that get pruned are then removed from [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to prevent old ids being kept around.\n\nThe reason for localStorage, is because we can't set a key on page load (when the user visits the notifications page), so we store them locally.  Since the notifications are just for the user, then this doesn't matter.\n\nThe plugin handles updating the balloon tip that appears in the navigation for \"Profile\".  It also handles updating the \"Notifications\" tab count.\n\nOn the notifications page a new content div is added above the existing notifications.  We can't join them unfortunately, as the ProBoards notifications are loaded in via AJAX when you load more.\n\nYou can change the amount of notifications that show in the `profile_notifications` class.\n\nThe building of the notifications list is performed in the `profile_notifications_display` class.  Here is where you would maybe tweak the look and any selectors that are not working due to custom templates.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommanderfoo%2Fproboards-profile-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommanderfoo%2Fproboards-profile-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommanderfoo%2Fproboards-profile-notifications/lists"}