Merge remote-tracking branch 'origin/master' into secondary_database

Conflicts:
	src/database/level/main.js
v1.18.x
psychobunny 11 years ago
commit 74674c8494

1
.gitignore vendored

@ -25,3 +25,4 @@ pidfile
# templates
/public/templates
/public/sounds

@ -8,6 +8,7 @@ source_lang = en_GB
trans.ar = public/language/ar/category.json
trans.cs = public/language/cs/category.json
trans.de = public/language/de/category.json
trans.en_US = public/language/en_US/category.json
trans.en@pirate = public/language/en@pirate/category.json
trans.es = public/language/es/category.json
trans.et = public/language/et/category.json
@ -38,6 +39,7 @@ source_lang = en_GB
trans.ar = public/language/ar/login.json
trans.cs = public/language/cs/login.json
trans.de = public/language/de/login.json
trans.en_US = public/language/en_US/login.json
trans.en@pirate = public/language/en@pirate/login.json
trans.es = public/language/es/login.json
trans.et = public/language/et/login.json
@ -67,6 +69,7 @@ source_lang = en_GB
trans.ar = public/language/ar/recent.json
trans.cs = public/language/cs/recent.json
trans.de = public/language/de/recent.json
trans.en_US = public/language/en_US/recent.json
trans.en@pirate = public/language/en@pirate/recent.json
trans.es = public/language/es/recent.json
trans.et = public/language/et/recent.json
@ -96,6 +99,7 @@ source_lang = en_GB
trans.ar = public/language/ar/unread.json
trans.cs = public/language/cs/unread.json
trans.de = public/language/de/unread.json
trans.en_US = public/language/en_US/unread.json
trans.en@pirate = public/language/en@pirate/unread.json
trans.es = public/language/es/unread.json
trans.et = public/language/et/unread.json
@ -125,6 +129,7 @@ source_lang = en_GB
trans.ar = public/language/ar/footer.json
trans.cs = public/language/cs/footer.json
trans.de = public/language/de/footer.json
trans.en_US = public/language/en_US/footer.json
trans.en@pirate = public/language/en@pirate/footer.json
trans.es = public/language/es/footer.json
trans.et = public/language/et/footer.json
@ -154,6 +159,7 @@ source_lang = en_GB
trans.ar = public/language/ar/modules.json
trans.cs = public/language/cs/modules.json
trans.de = public/language/de/modules.json
trans.en_US = public/language/en_US/modules.json
trans.en@pirate = public/language/en@pirate/modules.json
trans.es = public/language/es/modules.json
trans.et = public/language/et/modules.json
@ -183,6 +189,7 @@ source_lang = en_GB
trans.ar = public/language/ar/register.json
trans.cs = public/language/cs/register.json
trans.de = public/language/de/register.json
trans.en_US = public/language/en_US/register.json
trans.en@pirate = public/language/en@pirate/register.json
trans.es = public/language/es/register.json
trans.et = public/language/et/register.json
@ -212,6 +219,7 @@ source_lang = en_GB
trans.ar = public/language/ar/user.json
trans.cs = public/language/cs/user.json
trans.de = public/language/de/user.json
trans.en_US = public/language/en_US/user.json
trans.en@pirate = public/language/en@pirate/user.json
trans.es = public/language/es/user.json
trans.et = public/language/et/user.json
@ -241,6 +249,7 @@ source_lang = en_GB
trans.ar = public/language/ar/global.json
trans.cs = public/language/cs/global.json
trans.de = public/language/de/global.json
trans.en_US = public/language/en_US/global.json
trans.en@pirate = public/language/en@pirate/global.json
trans.es = public/language/es/global.json
trans.et = public/language/et/global.json
@ -270,6 +279,7 @@ source_lang = en_GB
trans.ar = public/language/ar/notifications.json
trans.cs = public/language/cs/notifications.json
trans.de = public/language/de/notifications.json
trans.en_US = public/language/en_US/notifications.json
trans.en@pirate = public/language/en@pirate/notifications.json
trans.es = public/language/es/notifications.json
trans.et = public/language/et/notifications.json
@ -299,6 +309,7 @@ source_lang = en_GB
trans.ar = public/language/ar/reset_password.json
trans.cs = public/language/cs/reset_password.json
trans.de = public/language/de/reset_password.json
trans.en_US = public/language/en_US/reset_password.json
trans.en@pirate = public/language/en@pirate/reset_password.json
trans.es = public/language/es/reset_password.json
trans.et = public/language/et/reset_password.json
@ -328,6 +339,7 @@ source_lang = en_GB
trans.ar = public/language/ar/users.json
trans.cs = public/language/cs/users.json
trans.de = public/language/de/users.json
trans.en_US = public/language/en_US/users.json
trans.en@pirate = public/language/en@pirate/users.json
trans.es = public/language/es/users.json
trans.et = public/language/et/users.json
@ -357,6 +369,7 @@ source_lang = en_GB
trans.ar = public/language/ar/language.json
trans.cs = public/language/cs/language.json
trans.de = public/language/de/language.json
trans.en_US = public/language/en_US/language.json
trans.en@pirate = public/language/en@pirate/language.json
trans.es = public/language/es/language.json
trans.et = public/language/et/language.json
@ -386,6 +399,7 @@ source_lang = en_GB
trans.ar = public/language/ar/pages.json
trans.cs = public/language/cs/pages.json
trans.de = public/language/de/pages.json
trans.en_US = public/language/en_US/pages.json
trans.en@pirate = public/language/en@pirate/pages.json
trans.es = public/language/es/pages.json
trans.et = public/language/et/pages.json
@ -415,6 +429,7 @@ source_lang = en_GB
trans.ar = public/language/ar/topic.json
trans.cs = public/language/cs/topic.json
trans.de = public/language/de/topic.json
trans.en_US = public/language/en_US/topic.json
trans.en@pirate = public/language/en@pirate/topic.json
trans.es = public/language/es/topic.json
trans.et = public/language/et/topic.json

@ -119,7 +119,6 @@ function start() {
require('./src/database').init(function(err) {
meta.configs.init(function () {
var templates = require('./public/src/templates'),
translator = require('./public/src/translator'),
webserver = require('./src/webserver'),
sockets = require('./src/socket.io'),
plugins = require('./src/plugins'),
@ -131,7 +130,6 @@ function start() {
if (schema_ok || nconf.get('check-schema') === false) {
sockets.init(webserver.server);
plugins.init();
translator.loadServer();
nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path'));
nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-vanilla/templates'));

@ -43,6 +43,7 @@
"nodebb-widget-essentials": "~0.0.21",
"nodebb-theme-vanilla": "~0.0.19",
"nodebb-theme-lavender": "~0.0.25",
"nodebb-plugin-soundpack-default": "~0.1.0",
"less": "~1.6.3",
"daemon": "~1.1.0",
"underscore": "~1.6.0",

@ -7,5 +7,7 @@
"outgoing_link": "Outgoing Link",
"outgoing_link_message": "You are now leaving",
"continue_to": "Continue to",
"return_to": "Return to "
"return_to": "Return to ",
"new_notification": "New Notification",
"you_have_unread_notifications": "You have unread notifications."
}

@ -1,5 +1,5 @@
{
"topic-post": "You have successfully posted.",
"authentication-successful": "Authentication Successful"
"authentication-successful": "Authentication Successful",
"settings-saved": "Settings saved!"
}

@ -57,6 +57,14 @@
"thread_tools.restore": "Restore Topic",
"thread_tools.restore_confirm": "Are you sure you want to restore this thread?",
"topic_lock_success": "Topic has been successfully locked.",
"topic_unlock_success": "Topic has been successfully unlocked.",
"topic_pin_success": "Topic has been successfully pinned.",
"topic_unpin_success": "Topic has been successfully unpinned.",
"topic_move_success": "This topic has been successfully moved to %1",
"post_delete_confirm": "Are you sure you want to delete this post?",
"post_restore_confirm": "Are you sure you want to restore this post?",
"post_delete_error": "Could not delete this post!",
@ -74,6 +82,7 @@
"loading_more_posts": "Loading More Posts",
"move_topic": "Move Topic",
"move_post": "Move Post",
"post_moved": "Post moved!",
"fork_topic": "Fork Topic",
"topic_will_be_moved_to": "This topic will be moved to the category",
"fork_topic_instruction": "Click the posts you want to fork",

@ -0,0 +1,12 @@
{
"new_topic_button": "New Topic",
"no_topics": "<strong>There are no topics in this category.</strong><br />Why don't you try posting one?",
"posts": "posts",
"views": "views",
"posted": "posted",
"browsing": "browsing",
"no_replies": "No one has replied",
"replied": "replied",
"last_edited_by": "last edited by",
"share_this_category": "Share this category"
}

@ -0,0 +1,7 @@
{
"stats.online": "Online",
"stats.users": "Users",
"stats.topics": "Topics",
"stats.posts": "Posts",
"success": "success"
}

@ -0,0 +1,55 @@
{
"home": "Home",
"search": "Search",
"buttons.close": "Close",
"403.title": "Access Denied",
"403.message": "You seem to have stumbled upon a page that you do not have access to. Perhaps you should <a href='/login'>try logging in</a>?",
"404.title": "Not Found",
"404.message": "You seem to have stumbled upon a page that does not exist. Return to the <a href='/'>home page</a>.",
"500.title": "Internal error.",
"500.message": "Oops! Looks like something went wrong!",
"register": "Register",
"login": "Login",
"please_log_in": "Please Log In",
"logout": "Logout",
"posting_restriction_info": "Posting is currently restricted to registered members only, click here to log in.",
"welcome_back": "Welcome Back ",
"you_have_successfully_logged_in": "You have successfully logged in",
"save_changes": "Save Changes",
"close": "Close",
"pagination": "Pagination",
"header.admin": "Admin",
"header.recent": "Recent",
"header.unread": "Unread",
"header.popular": "Popular",
"header.users": "Users",
"header.chats": "Chats",
"header.notifications": "Notifications",
"header.search": "Search",
"header.profile": "Profile",
"notifications.loading": "Loading Notifications",
"chats.loading": "Loading Chats",
"motd.welcome": "Welcome to NodeBB, the discussion platform of the future.",
"previouspage": "Previous Page",
"nextpage": "Next Page",
"alert.success": "Success",
"alert.error": "Error",
"alert.banned": "Banned",
"alert.banned.message": "You are banned you will be logged out!",
"alert.unfollow": "You are no longer following %1!",
"alert.follow": "You are now following %1!",
"posts": "Posts",
"views": "Views",
"posted": "posted",
"in": "in",
"norecentposts": "No Recent Posts",
"norecenttopics": "No Recent Topics",
"recentposts": "Recent Posts",
"recentips": "Recently Logged In IPs",
"online": "Online",
"away": "Away",
"dnd": "Do not Disturb",
"invisible": "Invisible",
"offline": "Offline",
"privacy": "Privacy"
}

@ -0,0 +1,5 @@
{
"name": "English (United States)",
"code": "en_US",
"dir": "ltr"
}

@ -0,0 +1,10 @@
{
"login": "Login",
"username": "Username / Email",
"password": "Password",
"remember_me": "Remember Me?",
"forgot_password": "Forgot Password?",
"alternative_logins": "Alternative Logins",
"failed_login_attempt": "Failed login attempt, please try again.",
"login_successful": "You have successfully logged in!"
}

@ -0,0 +1,6 @@
{
"chat.chatting_with": "Chat with <span id=\"chat-with-name\"></span>",
"chat.placeholder": "type chat message here, press enter to send",
"chat.send": "Send",
"chat.no_active": "You have no active chats."
}

@ -0,0 +1,10 @@
{
"title": "Notifications",
"no_notifs": "You have no new notifications",
"see_all": "See all Notifications",
"back_to_home": "Back to NodeBB",
"outgoing_link": "Outgoing Link",
"outgoing_link_message": "You are now leaving",
"continue_to": "Continue to",
"return_to": "Return to "
}

@ -0,0 +1,15 @@
{
"home": "Home",
"unread": "Unread Topics",
"popular": "Popular Topics",
"recent": "Recent Topics",
"users": "Registered Users",
"notifications": "Notifications",
"user.edit": "Editing \"%1\"",
"user.following": "People %1 Follows",
"user.followers": "People who Follow %1",
"user.posts": "Posts made by %1",
"user.topics": "Topics created by %1",
"user.favourites": "%1's Favorite Posts",
"user.settings": "User Settings"
}

@ -0,0 +1,7 @@
{
"title": "Recent",
"day": "Day",
"week": "Week",
"month": "Month",
"no_recent_topics": "There are no recent topics."
}

@ -0,0 +1,18 @@
{
"register": "Register",
"help.email": "By default, your email will be hidden from the public.",
"help.username_restrictions": "A unique username between %1 and %2 characters. Others can mention you with @<span id='yourUsername'>username</span>.",
"help.minimum_password_length": "Your password's length must be at least %1 characters.",
"email_address": "Email Address",
"email_address_placeholder": "Enter Email Address",
"username": "Username",
"username_placeholder": "Enter Username",
"password": "Password",
"password_placeholder": "Enter Password",
"confirm_password": "Confirm Password",
"confirm_password_placeholder": "Confirm Password",
"register_now_button": "Register Now",
"alternative_registration": "Alternative Registration",
"terms_of_use": "Terms of Use",
"agree_to_terms_of_use": "I agree to the Terms of Use"
}

@ -0,0 +1,14 @@
{
"reset_password": "Reset Password",
"update_password": "Update Password",
"password_changed.title": "Password Changed",
"password_changed.message": "<p>Password successfully reset, please <a href=\"/login\">log in again</a>.",
"wrong_reset_code.title": "Incorrect Reset Code",
"wrong_reset_code.message": "The reset code received was incorrect. Please try again, or <a href=\"/reset\">request a new reset code</a>.",
"new_password": "New Password",
"repeat_password": "Confirm Password",
"enter_email": "Please enter your <strong>email address</strong> and we will send you an email with instructions on how to reset your account.",
"enter_email_address": "Enter Email Address",
"password_reset_sent": "Password Reset Sent",
"invalid_email": "Invalid Email / Email does not exist!"
}

@ -0,0 +1,93 @@
{
"topic": "Topic",
"topics": "Topics",
"topic_id": "Topic ID",
"topic_id_placeholder": "Enter topic ID",
"no_topics_found": "No topics found!",
"no_posts_found": "No posts found!",
"profile": "Profile",
"posted_by": "Posted by",
"chat": "Chat",
"notify_me": "Be notified of new replies in this topic",
"quote": "Quote",
"reply": "Reply",
"edit": "Edit",
"delete": "Delete",
"restore": "Restore",
"move": "Move",
"fork": "Fork",
"banned": "banned",
"link": "Link",
"share": "Share",
"tools": "Tools",
"flag": "Flag",
"bookmark_instructions": "Click here to return to your last position or close to discard.",
"flag_title": "Flag this post for moderation",
"flag_confirm": "Are you sure you want to flag this post?",
"flag_success": "This post has been flagged for moderation.",
"deleted_message": "This thread has been deleted. Only users with thread management privileges can see it.",
"following_topic.title": "Following Topic",
"following_topic.message": "You will now be receiving notifications when somebody posts to this topic.",
"not_following_topic.title": "Not Following Topic",
"not_following_topic.message": "You will no longer receive notifications from this topic.",
"login_to_subscribe": "Please register or log in in order to subscribe to this topic.",
"markAsUnreadForAll.success": "Topic marked as unread for all.",
"watch": "Watch",
"watch.title": "Be notified of new replies in this topic",
"share_this_post": "Share this Post",
"thread_tools.title": "Thread Tools",
"thread_tools.markAsUnreadForAll": "Mark Unread",
"thread_tools.pin": "Pin Topic",
"thread_tools.unpin": "Unpin Topic",
"thread_tools.lock": "Lock Topic",
"thread_tools.unlock": "Unlock Topic",
"thread_tools.move": "Move Topic",
"thread_tools.fork": "Fork Topic",
"thread_tools.delete": "Delete Topic",
"thread_tools.delete_confirm": "Are you sure you want to delete this thread?",
"thread_tools.restore": "Restore Topic",
"thread_tools.restore_confirm": "Are you sure you want to restore this thread?",
"post_delete_confirm": "Are you sure you want to delete this post?",
"post_restore_confirm": "Are you sure you want to restore this post?",
"post_delete_error": "Could not delete this post!",
"post_restore_error": "Could not restore this post!",
"load_categories": "Loading Categories",
"disabled_categories_note": "Disabled Categories are greyed out",
"confirm_move": "Move",
"confirm_fork": "Fork",
"favourite": "Favorite",
"favourites": "Favorites",
"favourites.not_logged_in.title": "Not Logged In",
"favourites.not_logged_in.message": "Please log in in order to favorite this post",
"favourites.has_no_favourites": "You don't have any favorites, favorite some posts to see them here!",
"vote.not_logged_in.title": "Not Logged In",
"vote.not_logged_in.message": "Please log in in order to vote",
"vote.cant_vote_self.title": "Invalid Vote",
"vote.cant_vote_self.message": "You cannot vote for your own post",
"loading_more_posts": "Loading More Posts",
"move_topic": "Move Topic",
"move_post": "Move Post",
"fork_topic": "Fork Topic",
"topic_will_be_moved_to": "This topic will be moved to the category",
"fork_topic_instruction": "Click the posts you want to fork",
"fork_no_pids": "No posts selected!",
"fork_success": "Succesfully forked topic!",
"reputation": "Reputation",
"posts": "Posts",
"composer.title_placeholder": "Enter your topic title here...",
"composer.write": "Write",
"composer.preview": "Preview",
"composer.help": "Help",
"composer.discard": "Discard",
"composer.submit": "Submit",
"composer.replying_to": "Replying to",
"composer.new_topic": "New Topic",
"composer.uploading": "uploading...",
"composer.thumb_url_label": "Paste a topic thumbnail URL",
"composer.thumb_title": "Add a thumbnail to this topic",
"composer.thumb_url_placeholder": "http://example.com/thumb.png",
"composer.thumb_file_label": "Or upload a file",
"composer.thumb_remove": "Clear fields",
"composer.drag_and_drop_images": "Drag and Drop Images Here",
"composer.upload_instructions": "Upload images by dragging & dropping them."
}

@ -0,0 +1,9 @@
{
"title": "Unread",
"no_unread_topics": "There are no unread topics.",
"load_more": "Load More",
"mark_as_read": "Mark as Read",
"selected": "Selected",
"all": "All",
"topics_marked_as_read.success": "Topics marked as read!"
}

@ -0,0 +1,55 @@
{
"banned": "Banned",
"offline": "Offline",
"username": "User Name",
"email": "Email",
"fullname": "Full Name",
"website": "Website",
"location": "Location",
"age": "Age",
"joined": "Joined",
"lastonline": "Last Online",
"profile": "Profile",
"profile_views": "Profile views",
"reputation": "Reputation",
"posts": "Posts",
"favourites": "Favorites",
"followers": "Followers",
"following": "Following",
"signature": "Signature",
"gravatar": "Gravatar",
"birthday": "Birthday",
"chat": "Chat",
"follow": "Follow",
"unfollow": "Unfollow",
"change_picture": "Change Picture",
"edit": "Edit",
"uploaded_picture": "Uploaded Picture",
"upload_new_picture": "Upload New Picture",
"current_password": "Current Password",
"change_password": "Change Password",
"change_password_error": "Invalid Password!",
"change_password_error_wrong_current": "Your current password is not correct!",
"change_password_error_length": "Password too short!",
"change_password_error_match": "Passwords must match!",
"change_password_error_privileges": "You are not have the rights to change this password.",
"change_password_success": "Your password is updated!",
"confirm_password": "Confirm Password",
"password": "Password",
"upload_picture": "Upload picture",
"upload_a_picture": "Upload a picture",
"image_spec": "You may only upload PNG, JPG, or GIF files",
"max": "max.",
"settings": "Settings",
"show_email": "Show My Email",
"has_no_follower": "This user doesn't have any followers :(",
"follows_no_one": "This user isn't following anyone :(",
"has_no_posts": "This user didn't post anything yet.",
"has_no_topics": "This user didn't post any topics yet.",
"email_hidden": "Email Hidden",
"hidden": "hidden",
"paginate_description": "Paginate topics and posts instead of using infinite scroll.",
"topics_per_page": "Topics per Page",
"posts_per_page": "Posts per Page",
"notification_sounds": "Play a sound when you receive a notification."
}

@ -0,0 +1,9 @@
{
"latest_users": "Latest Users",
"top_posters": "Top Posters",
"most_reputation": "Most Reputation",
"online": "Online",
"search": "Search",
"enter_username": "Enter a username to search",
"load_more": "Load More"
}

@ -2,8 +2,8 @@
"title": "Non Lu",
"no_unread_topics": "Aucun sujet non lu.",
"load_more": "Charger la suite",
"mark_as_read": "Mark as Read",
"selected": "Selected",
"all": "All",
"topics_marked_as_read.success": "Topics marked as read!"
"mark_as_read": "Marquer comme Lu",
"selected": "Sélectionnés",
"all": "Tous",
"topics_marked_as_read.success": "Sujets marqués comme lus!"
}

@ -9,7 +9,7 @@
"user.following": "Personer %1 følger",
"user.followers": "Personer som følger %1",
"user.posts": "Innlegg laget av %1",
"user.topics": "Topics created by %1",
"user.topics": "Emner opprettet av %1",
"user.favourites": "%1 sine favoritt-innlegg",
"user.settings": "Brukerinnstillinger"
}

@ -1,8 +1,8 @@
{
"topic": "Emne",
"topics": "Emner",
"topic_id": "Topic ID",
"topic_id_placeholder": "Enter topic ID",
"topic_id": "Emne-ID",
"topic_id_placeholder": "Skriv emne-ID",
"no_topics_found": "Ingen emner funnet!",
"no_posts_found": "Ingen innlegg funnet!",
"profile": "Profil",
@ -23,8 +23,8 @@
"flag": "Rapporter",
"bookmark_instructions": "Klikk her for å returnere til din siste posisjon eller lukk for å forkaste.",
"flag_title": "Rapporter dette innlegget for granskning",
"flag_confirm": "Are you sure you want to flag this post?",
"flag_success": "This post has been flagged for moderation.",
"flag_confirm": "Er du sikker på at du vil rapportere dette innlegget?",
"flag_success": "Dette innlegget har blitt rapportert.",
"deleted_message": "Denne tråden har blitt slettet. Bare brukere med trådhåndterings-privilegier kan se den.",
"following_topic.title": "Følger tråd",
"following_topic.message": "Du vil nå motta varsler når noen skriver i denne tråden.",
@ -44,13 +44,13 @@
"thread_tools.move": "Flytt tråd",
"thread_tools.fork": "Forgren tråd",
"thread_tools.delete": "Slett tråd",
"thread_tools.delete_confirm": "Are you sure you want to delete this thread?",
"thread_tools.delete_confirm": "Er du sikker på at du vil slette denne tråden?",
"thread_tools.restore": "Gjenopprett tråd",
"thread_tools.restore_confirm": "Are you sure you want to restore this thread?",
"post_delete_confirm": "Are you sure you want to delete this post?",
"post_restore_confirm": "Are you sure you want to restore this post?",
"post_delete_error": "Could not delete this post!",
"post_restore_error": "Could not restore this post!",
"thread_tools.restore_confirm": "Er du sikker på at du vil gjenopprette denne tråden?",
"post_delete_confirm": "Er du sikker på at du vil slette dette innlegget?",
"post_restore_confirm": "Er du sikker på at du vil gjenopprette dette innlegget?",
"post_delete_error": "Kunne ikke slette dette innlegget!",
"post_restore_error": "Kunne ikke gjenopprette dette innlegget!",
"load_categories": "Laster kategorier",
"disabled_categories_note": "Deaktiverte kategorier er grået ut",
"confirm_move": "Flytt",

@ -2,8 +2,8 @@
"title": "Uleste",
"no_unread_topics": "Det er ingen uleste emner.",
"load_more": "Last mer",
"mark_as_read": "Mark as Read",
"selected": "Selected",
"all": "All",
"topics_marked_as_read.success": "Topics marked as read!"
"mark_as_read": "Marker som lest",
"selected": "Valgte",
"all": "Alle",
"topics_marked_as_read.success": "Emner merket som lest!"
}

@ -28,12 +28,12 @@
"upload_new_picture": "Last opp nytt bidle",
"current_password": "Gjeldende passord",
"change_password": "Endre passord",
"change_password_error": "Invalid Password!",
"change_password_error_wrong_current": "Your current password is not correct!",
"change_password_error_length": "Password too short!",
"change_password_error_match": "Passwords must match!",
"change_password_error_privileges": "You are not have the rights to change this password.",
"change_password_success": "Your password is updated!",
"change_password_error": "Ugyldig passord!",
"change_password_error_wrong_current": "Ditt gjeldende passord er ikke korrekt!",
"change_password_error_length": "Passord for kort!",
"change_password_error_match": "Passordene må samsvare!",
"change_password_error_privileges": "Du har ikke rettigheter til å endre dette passordet.",
"change_password_success": "Passordet ditt ble oppdatert!",
"confirm_password": "Bekreft passord",
"password": "Passord",
"upload_picture": "Last opp bilde",
@ -45,7 +45,7 @@
"has_no_follower": "Denne brukeren har ingen følgere :(",
"follows_no_one": "Denne brukeren følger ingen :(",
"has_no_posts": "Denne brukeren har ikke skrevet noe enda.",
"has_no_topics": "This user didn't post any topics yet.",
"has_no_topics": "Denne brukeren har ikke skrevet noen emner enda.",
"email_hidden": "E-post skjult",
"hidden": "skjult",
"paginate_description": "Paginer tråder og innlegg istedet for å bruke uendelig skrolling.",

@ -2,8 +2,8 @@
"title": "Nieprzeczytane",
"no_unread_topics": "Nie masz żadnych nieprzeczytanych wątków.",
"load_more": "Więcej",
"mark_as_read": "Mark as Read",
"selected": "Selected",
"all": "All",
"topics_marked_as_read.success": "Topics marked as read!"
"mark_as_read": "Oznacz jako przeczytane",
"selected": "Wybrane",
"all": "Wszystkie",
"topics_marked_as_read.success": "Wątki zostały oznaczone jako przeczytane!"
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,82 +1,76 @@
'use strict';
/* globals define, ajaxify, app, utils, socket, translator*/
define(['forum/accountheader'], function(header) {
var Account = {};
var Account = {},
yourid,
theirid,
isFollowing;
Account.init = function() {
header.init();
var yourid = ajaxify.variables.get('yourid'),
theirid = ajaxify.variables.get('theirid'),
isFollowing = ajaxify.variables.get('isFollowing');
$(document).ready(function() {
var username = $('.account-username').html();
app.enterRoom('user/' + theirid);
utils.addCommasToNumbers($('.account .formatted-number'));
utils.makeNumbersHumanReadable($('.account .human-readable-number'));
$('.user-recent-posts img').addClass('img-responsive');
var followBtn = $('#follow-btn');
var unfollowBtn = $('#unfollow-btn');
var chatBtn = $('#chat-btn');
if (yourid !== theirid && yourid !== "0") {
if (isFollowing) {
followBtn.addClass('hide');
unfollowBtn.removeClass('hide');
} else {
followBtn.removeClass('hide');
unfollowBtn.addClass('hide');
}
chatBtn.removeClass('hide');
} else {
followBtn.addClass('hide');
unfollowBtn.addClass('hide');
chatBtn.addClass('hide');
}
yourid = ajaxify.variables.get('yourid');
theirid = ajaxify.variables.get('theirid');
isFollowing = ajaxify.variables.get('isFollowing');
app.enterRoom('user/' + theirid);
processPage();
followBtn.on('click', function() {
socket.emit('user.follow', {
uid: theirid
}, function(err) {
if(err) {
return app.alertError('There was an error following' + username + '!');
}
followBtn.addClass('hide');
unfollowBtn.removeClass('hide');
app.alertSuccess('[[global:alert.follow, ' + username + ']]');
});
return false;
});
unfollowBtn.on('click', function() {
socket.emit('user.unfollow', {
uid: theirid
}, function(err) {
if(err) {
return app.alertError('There was an error unfollowing ' + username + '!');
}
followBtn.removeClass('hide');
unfollowBtn.addClass('hide');
app.alertSuccess('[[global:alert.unfollow, ' + username + ']]');
});
return false;
});
chatBtn.on('click', function() {
app.openChat(username, theirid);
});
socket.on('user.isOnline', Account.handleUserOnline);
socket.emit('user.isOnline', theirid, Account.handleUserOnline);
updateButtons();
$('#follow-btn').on('click', function() {
return toggleFollow('follow');
});
$('#unfollow-btn').on('click', function() {
return toggleFollow('unfollow');
});
$('#chat-btn').on('click', function() {
app.openChat($('.account-username').html(), theirid);
});
socket.on('user.isOnline', handleUserOnline);
socket.emit('user.isOnline', theirid, handleUserOnline);
};
Account.handleUserOnline = function(err, data) {
function processPage() {
utils.addCommasToNumbers($('.account .formatted-number'));
utils.makeNumbersHumanReadable($('.account .human-readable-number'));
$('.user-recent-posts img').addClass('img-responsive');
}
function updateButtons() {
var isSelfOrNotLoggedIn = yourid === theirid || yourid === '0';
$('#follow-btn').toggleClass('hide', isFollowing || isSelfOrNotLoggedIn);
$('#unfollow-btn').toggleClass('hide', !isFollowing || isSelfOrNotLoggedIn);
$('#chat-btn').toggleClass('hide', isSelfOrNotLoggedIn);
}
function toggleFollow(type) {
socket.emit('user.' + type, {
uid: theirid
}, function(err) {
if(err) {
return app.alertError(err.message);
}
$('#follow-btn').toggleClass('hide', type === 'follow');
$('#unfollow-btn').toggleClass('hide', type === 'unfollow');
app.alertSuccess('[[global:alert.' + type + ', ' + $('.account-username').html() + ']]');
});
return false;
}
function handleUserOnline(err, data) {
if (err) {
return app.alertError(err.message);
}
var onlineStatus = $('.account-online-status');
if(parseInt(ajaxify.variables.get('theirid'), 10) !== parseInt(data.uid, 10)) {
@ -89,7 +83,7 @@ define(['forum/accountheader'], function(header) {
.attr('data-original-title', translated);
});
};
}
return Account;
});

@ -23,14 +23,14 @@ define(['forum/accountheader'], function(header) {
socket.emit('user.saveSettings', settings, function(err) {
if (err) {
return app.alertError('There was an error saving settings!');
return app.alertError(err.message);
}
app.alertSuccess('Settings saved!');
app.alertSuccess('[[success:settings-saved]]');
});
return false;
});
socket.emit('user.getSettings', function(err, settings) {
for (var setting in settings) {
if (settings.hasOwnProperty(setting)) {

@ -37,13 +37,17 @@ define(['uploader'], function(uploader) {
}
function select_icon(el) {
var selected = el.attr('class').replace(' fa-2x', '');
var selected = el.attr('class').replace('fa-2x', '').replace('fa', '').replace(/\s+/g, '');
$('#icons .selected').removeClass('selected');
if (selected === '') {
selected = 'fa-doesnt-exist';
}
if (selected) {
$('#icons .' + selected).parent().addClass('selected');
$('#icons .fa-icons .fa.' + selected).parent().addClass('selected');
}
bootbox.confirm('<h2>Select an icon.</h2>' + document.getElementById('icons').innerHTML, function(confirm) {
bootbox.confirm('<h2>Select an icon.</h2>' + $('#icons').html(), function(confirm) {
if (confirm) {
var iconClass = $('.bootbox .selected').children(':first').attr('class');
@ -51,6 +55,9 @@ define(['uploader'], function(uploader) {
// remove the 'fa ' from the class name, just need the icon name itself
var categoryIconClass = iconClass.replace('fa ', '');
if(categoryIconClass === 'fa-doesnt-exist') {
categoryIconClass = '';
}
el.val(categoryIconClass);
el.attr('value', categoryIconClass);
@ -122,7 +129,7 @@ define(['uploader'], function(uploader) {
ajaxify.loadTemplate('admin/categories', function(adminCategories) {
var html = $(templates.parse(templates.getBlock(adminCategories, 'categories'), {categories: [data]}));
html.find('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker);
$('#entry-container').append(html);

@ -414,13 +414,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools',
$('.topic-main-buttons .post_reply').attr('disabled', locked).html(locked ? 'Locked <i class="fa fa-lock"></i>' : 'Reply');
if (alert) {
app.alert({
'alert_id': 'thread_lock',
type: 'success',
title: 'Thread ' + (locked ? 'Locked' : 'Unlocked'),
message: 'Thread has been successfully ' + (locked ? 'locked' : 'unlocked'),
timeout: 5000
});
app.alertSuccess(locked ? '[[topic:topic_lock_success]]' : '[[topic:topic_unlock_success]]');
}
thread_state.locked = locked ? '1' : '0';
@ -450,13 +444,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools',
$('.pin_thread').html(translated);
if (alert) {
app.alert({
'alert_id': 'thread_pin',
type: 'success',
title: 'Thread ' + (pinned ? 'Pinned' : 'Unpinned'),
message: 'Thread has been successfully ' + (pinned ? 'pinned' : 'unpinned'),
timeout: 5000
});
app.alertSuccess(pinned ? '[[topic:topic_pin_success]]' : '[[topic:topic_unpin_success]]');
}
thread_state.pinned = pinned ? '1' : '0';
});

@ -90,7 +90,7 @@ define(function() {
}
function showNoPostsSelected() {
translator.get('topic:fork_no_pids', function(translated) {
translator.translate('[[topic:fork_no_pids]]', function(translated) {
forkModal.find('#fork-pids').html(translated);
});
}

@ -71,10 +71,10 @@ define(function() {
}, function(err) {
modal.modal('hide');
if(err) {
return app.alertError('This topic could not be moved to ' + targetCategoryLabel + '.<br />Please try again later');
return app.alertError(err.message);
}
app.alertSuccess('This topic has been successfully moved to ' + targetCategoryLabel);
app.alertSuccess('[[topic:topic_move_success, ' + targetCategoryLabel + ']]');
});
}

@ -163,7 +163,7 @@ define(['composer', 'share'], function(composer, share) {
tid: tid
}, function(err) {
if(err) {
return translator.translate('[[topic:post_' + action + '_error]]', app.alertError);
app.alertError('[[topic:post_' + action + '_error]]');
}
});
}
@ -218,7 +218,7 @@ define(['composer', 'share'], function(composer, share) {
$('#topicId').val('');
app.alertSuccess('Post moved!');
app.alertSuccess('[[topic:post_moved]]');
});
}
@ -230,9 +230,8 @@ define(['composer', 'share'], function(composer, share) {
if(err) {
return app.alertError(err.message);
}
translator.translate('[[topic:flag_success]]', function(message) {
app.alertSuccess(message);
});
app.alertSuccess('[[topic:flag_success]]');
});
}
});

@ -29,7 +29,7 @@ define(['forum/recent'], function(recent) {
}
socket.emit('topics.markTidsRead', tids, function(err) {
if(err) {
return app.alertError('There was an error marking topics read!');
return app.alertError(err.message);
}
doneRemovingTids(tids);
@ -39,7 +39,7 @@ define(['forum/recent'], function(recent) {
$('#markAllRead').on('click', function() {
socket.emit('topics.markAllRead', function(err) {
if(err) {
return app.alertError('There was an error marking topics read!');
return app.alertError(err.message);
}
app.alertSuccess('[[unread:topics_marked_as_read.success]]');
@ -68,7 +68,7 @@ define(['forum/recent'], function(recent) {
socket.emit('topics.markCategoryTopicsRead', cid, function(err) {
if(err) {
return app.alertError('There was an error marking topics read!');
return app.alertError(err.message);
}
doneRemovingTids(tids);
@ -157,9 +157,18 @@ define(['forum/recent'], function(recent) {
}
function createCategoryLink(category) {
var link = $('<li role="presentation" class="category" data-cid="' + category.cid + '"><a role="menuitem" href="#"><i class="fa fa-fw ' + category.icon + '"></i> ' + category.name + '</a></li>');
$('.markread .dropdown-menu').append(link);
var link = $('<a role="menuitem" href="#"></a>');
if (category.icon) {
link.append('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name);
} else {
link.append(category.name);
}
$('<li role="presentation" class="category" data-cid="' + category.cid + '"></li>')
.append(link)
.appendTo($('.markread .dropdown-menu'));
}
return Unread;

@ -25,7 +25,7 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) {
chatsListEl.empty();
if (!chats.length) {
translator.get('modules:chat.no_active', function(str) {
translator.translate('[[modules:chat.no_active]]', function(str) {
$('<li />')
.addClass('no_active')
.html('<a href="#">' + str + '</a>')

@ -95,8 +95,8 @@ define(['sounds'], function(sound) {
app.alert({
alert_id: 'new_notif',
title: 'New notification',
message: 'You have unread notifications.',
title: '[[notifications:new_notification]]',
message: '[[notifications:you_have_unread_notifications]]',
type: 'warning',
timeout: 2000
});

@ -1,106 +1,74 @@
"use strict";
/* global define, socket */
/* global define, socket, config */
define(['buzz'], function(buzz) {
var Sounds = {};
Sounds.initialised = false;
Sounds.loaded = {};
Sounds.mapping = {};
Sounds.init = function(callback) {
var ready = false,
onComplete = function() {
Sounds.initialised = true;
if (typeof callback === 'function') {
callback();
}
};
loadFiles(function() {
if (ready) {
onComplete();
} else {
ready = true;
}
});
var loadedSounds = {};
var eventSoundMapping = {};
var files = {};
loadMapping(function() {
if (ready) {
onComplete();
} else {
ready = true;
}
});
loadFiles();
// Listen for reload message
socket.on('event:sounds.reloadMapping', function() {
loadMapping();
});
};
loadMapping();
socket.on('event:sounds.reloadMapping', loadMapping);
var loadFiles = function(callback) {
function loadFiles() {
socket.emit('modules.sounds.getSounds', function(err, sounds) {
if (err) {
return console.log('[sounds] Could not initialise!');
}
for(var name in sounds) {
if (sounds.hasOwnProperty(name)) {
var path = sounds[name];
Sounds.loaded[name] = new buzz.sound(path);
}
}
callback();
files = sounds;
});
};
}
var loadMapping = function(callback) {
function loadMapping() {
socket.emit('modules.sounds.getMapping', function(err, mapping) {
Sounds.mapping = mapping;
if (typeof callback === 'function') {
callback();
if (err) {
return console.log('[sounds] Could not load sound mapping!');
}
eventSoundMapping = mapping;
});
};
}
function isSoundLoaded(fileName) {
return loadedSounds[fileName];
}
function loadFile(fileName, callback) {
if (isSoundLoaded(fileName)) {
return callback();
}
loadedSounds[fileName] = new buzz.sound(files[fileName]);
callback();
}
Sounds.play = function(name) {
if (!config.notificationSounds) {
return;
}
var ready = function() {
if (Sounds.mapping[name] && Sounds.loaded[Sounds.mapping[name]]) {
Sounds.loaded[Sounds.mapping[name]].play();
} else {
console.log('[sounds] Not found:', name);
}
};
if (!this.initialised) {
this.init(ready);
} else {
ready();
}
Sounds.playFile(eventSoundMapping[name]);
};
Sounds.playFile = function(fileName) {
var ready = function() {
if (Sounds.loaded[fileName]) {
Sounds.loaded[fileName].play();
} else {
console.log('[sounds] Not found:', name);
}
};
if (!this.initialised) {
this.init(ready);
function play() {
if (loadedSounds[fileName]) {
loadedSounds[fileName].play();
} else {
console.log('[sounds] Not found:', fileName);
}
}
if (isSoundLoaded(fileName)) {
play();
} else {
ready();
loadFile(fileName, play);
}
};
Sounds.init();
return Sounds;
});

@ -2,18 +2,13 @@
"use strict";
/*global RELATIVE_PATH, config*/
/*
* TODO:
* user side settings for preferred language
*/
var translator = {},
files = {
loaded: {},
loading: {},
callbacks: {} // could be combined with "loading" in future.
},
isServer = false;
};
module.exports = translator;
@ -64,7 +59,7 @@
});
// Add directional code if necessary
translator.get('language:dir', function(value) {
translator.translate('[[language:dir]]', function(value) {
if (value) {
$('html').css('direction', value).attr('data-dir', value);
}
@ -72,44 +67,16 @@
}
};
translator.get = function (key, callback) {
var parsedKey = key.split(':'),
languageFile = parsedKey[0];
parsedKey = parsedKey[1];
translator.load(languageFile, function (languageData) {
if (callback) {
callback(languageData[parsedKey]);
}
return languageData[parsedKey];
});
};
translator.mget = function (keys, callback) {
var async = require('async');
function getKey(key, callback) {
translator.get(key, function(value) {
callback(null, value);
});
}
async.map(keys, getKey, callback);
};
translator.translate = function (data, callback) {
if (!data) {
return callback(data);
return callback(data);
}
function insertLanguage(text, key, value, variables) {
if (value) {
for (var i = 1, ii = variables.length; i < ii; i++) {
var variable = variables[i].replace(']]', '');
value = ('' + value).replace('%' + i, variable);
value = value.replace('%' + i, variable);
}
text = text.replace(key, value);
@ -124,32 +91,35 @@
var keys = data.match(/\[\[.*?\]\]/g),
loading = 0;
for (var key in keys) {
if (keys.hasOwnProperty(key)) {
keys[key] = '' + keys[key];
var variables = keys[key].split(/[,][?\s+]/);
if (!keys) {
return callback(data);
}
var parsedKey = keys[key].replace('[[', '').replace(']]', '').split(':');
if (!(parsedKey[0] && parsedKey[1])) {
continue;
}
for (var i=0; i<keys.length; ++i) {
var key = keys[i];
var languageFile = parsedKey[0];
parsedKey = ('' + parsedKey[1]).split(',')[0];
if (files.loaded[languageFile]) {
data = insertLanguage(data, keys[key], files.loaded[languageFile][parsedKey], variables);
} else {
loading++;
(function (languageKey, parsedKey, languageFile, variables) {
translator.load(languageFile, function (languageData) {
data = insertLanguage(data, languageKey, languageData[parsedKey], variables);
loading--;
checkComplete();
});
}(keys[key], parsedKey, languageFile, variables));
key = '' + key;
var variables = key.split(/[,][?\s+]/);
}
var parsedKey = key.replace('[[', '').replace(']]', '').split(':');
if (!(parsedKey[0] && parsedKey[1])) {
continue;
}
var languageFile = parsedKey[0];
parsedKey = ('' + parsedKey[1]).split(',')[0];
if (files.loaded[languageFile]) {
data = insertLanguage(data, key, files.loaded[languageFile][parsedKey], variables);
} else {
loading++;
(function (languageKey, parsedKey, languageFile, variables) {
translator.load(languageFile, function (languageData) {
data = insertLanguage(data, languageKey, languageData[parsedKey], variables);
loading--;
checkComplete();
});
}(key, parsedKey, languageFile, variables));
}
}
@ -160,17 +130,14 @@
callback(data);
}
}
};
translator.clearLoadedFiles = function() {
files.loaded = {};
files.loading = {};
};
translator.load = function (filename, callback) {
if (isServer === true) {
if (callback) {
callback(files.loaded[filename]);
}
return files.loaded[filename];
}
if (files.loaded[filename] && !files.loading[filename]) {
if (callback) {
@ -182,11 +149,10 @@
files.callbacks[filename].push(callback);
}
} else {
var timestamp = new Date().getTime(); //debug
files.loading[filename] = true;
$.getJSON(RELATIVE_PATH + '/language/' + config.defaultLang + '/' + filename + '.json?v=' + timestamp, function (language) {
load(filename, function(language) {
files.loaded[filename] = language;
if (callback) {
@ -202,38 +168,39 @@
}
};
translator.loadServer = function () {
isServer = true;
function load(filename, callback) {
if ('undefined' !== typeof window) {
loadClient(filename, callback);
} else {
loadServer(filename, callback);
}
}
var utils = require('./utils.js'),
Meta = require('../../src/meta'),
function loadClient(filename, callback) {
var timestamp = new Date().getTime();
$.getJSON(config.relative_path + '/language/' + config.defaultLang + '/' + filename + '.json?v=' + timestamp, callback);
}
function loadServer(filename, callback) {
var fs = require('fs'),
path = require('path'),
fs = require('fs'),
winston = require('winston'),
language = Meta.config.defaultLang || 'en_GB';
meta = require('../../src/meta'),
language = meta.config.defaultLang || 'en_GB';
if (!fs.existsSync(path.join(__dirname, '../language', language))) {
winston.warn('[translator] Language \'' + Meta.config.defaultLang + '\' not found. Defaulting to \'en_GB\'');
winston.warn('[translator] Language \'' + meta.config.defaultLang + '\' not found. Defaulting to \'en_GB\'');
language = 'en_GB';
}
utils.walk(path.join(__dirname, '../language', language), function (err, data) {
for (var d in data) {
if (data.hasOwnProperty(d)) {
// Only load .json files
if (path.extname(data[d]) === '.json') {
files.loaded[path.basename(data[d]).replace('.json', '')] = require(data[d]);
} else {
if (process.env.NODE_ENV === 'development') {
winston.warn('[translator] Skipping language file: ' + path.relative(path.join(__dirname, '../language'), data[d]));
}
}
}
fs.readFile(path.join(__dirname, '../language', language, filename + '.json'), function(err, data) {
if (err) {
return winston.error(err.message);
}
callback(JSON.parse(data.toString()));
});
};
}
if ('undefined' !== typeof window) {
window.translator = module.exports;

@ -156,7 +156,7 @@ adminController.groups.get = function(req, res, next) {
};
adminController.sounds.get = function(req, res, next) {
meta.sounds.getLocal(function(err, sounds) {
meta.sounds.getFiles(function(err, sounds) {
sounds = Object.keys(sounds).map(function(name) {
return {
name: name

@ -50,6 +50,10 @@ apiController.getConfig = function(req, res, next) {
}
user.getSettings(req.user.uid, function(err, settings) {
if (err) {
return next(err);
}
config.usePagination = settings.usePagination;
config.topicsPerPage = settings.topicsPerPage;
config.postsPerPage = settings.postsPerPage;

@ -79,6 +79,4 @@ module.exports = function(db, module) {
module.expireAt = function(key, timestamp, callback) {
// <__<
};
return module;
};

@ -8,7 +8,6 @@ var fs = require('fs'),
User = require('./user'),
Plugins = require('./plugins'),
Meta = require('./meta'),
Translator = require('../public/src/translator'),
templates = require('../public/src/templates'),
app = {},

@ -2,8 +2,7 @@ var async = require('async'),
db = require('./database'),
posts = require('./posts'),
user = require('./user'),
translator = require('./../public/src/translator');
user = require('./user');
(function (Favourites) {
"use strict";

@ -8,6 +8,8 @@ var fs = require('fs'),
_ = require('underscore'),
less = require('less'),
fork = require('child_process').fork,
rimraf = require('rimraf'),
mkdirp = require('mkdirp'),
utils = require('./../public/src/utils'),
translator = require('./../public/src/translator'),
@ -64,7 +66,7 @@ var fs = require('fs'),
// this might be a good spot to add a hook
if (field === 'defaultLang') {
translator.loadServer();
translator.clearLoadedFiles();
}
});
},
@ -366,7 +368,42 @@ var fs = require('fs'),
/* Sounds */
Meta.sounds = {};
Meta.sounds.getLocal = function(callback) {
Meta.sounds.init = function() {
var soundsPath = path.join(__dirname, '../public/sounds');
plugins.fireHook('filter:sounds.get', [], function(err, filePaths) {
if (err) {
winston.error('Could not initialise sound files:' + err.message);
}
// Clear the sounds directory
async.series([
function(next) {
rimraf(soundsPath, next);
},
function(next) {
mkdirp(soundsPath, next);
}
], function(err) {
if (err) {
winston.error('Could not initialise sound files:' + err.message);
}
// Link paths
async.each(filePaths, function(filePath, next) {
fs.symlink(filePath, path.join(soundsPath, path.basename(filePath)), 'file', next);
}, function(err) {
if (!err) {
winston.info('[sounds] Sounds OK');
} else {
winston.error('[sounds] Could not initialise sounds: ' + err.message);
}
});
});
});
};
Meta.sounds.getFiles = function(callback) {
// todo: Possibly move these into a bundled module?
fs.readdir(path.join(__dirname, '../public/sounds'), function(err, files) {
var localList = {};

@ -1,7 +1,6 @@
"use strict";
var templates = require('./../../public/src/templates'),
translator = require('./../../public/src/translator'),
utils = require('./../../public/src/utils'),
meta = require('./../meta'),
plugins = require('./../plugins'),

@ -151,7 +151,7 @@ middleware.buildHeader = function(req, res, next) {
function(next) {
controllers.api.getConfig(req, res, function(err, config) {
res.locals.config = config;
next();
next(err);
});
},
function(next) {
@ -163,9 +163,7 @@ middleware.buildHeader = function(req, res, next) {
});
});
}
], function(err) {
next(err);
});
], next);
};
middleware.renderHeader = function(req, res, callback) {
@ -253,7 +251,7 @@ middleware.renderHeader = function(req, res, callback) {
async.parallel([
function(next) {
translator.get('pages:' + path.basename(req.url), function(translated) {
translator.translate('[[pages:' + path.basename(req.url) + ']]', function(translated) {
var metaTitle = templateValues.metaTags.filter(function(tag) {
return tag.name === 'title';
});

@ -29,7 +29,7 @@ var async = require('async'),
if (exists) {
db.sortedSetRank('uid:' + uid + ':notifications:read', nid, function(err, rank) {
db.getObjectFields('notifications:' + nid, ['nid', 'from', 'text', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
db.getObjectFields('notifications:' + nid, ['nid', 'from', 'text', 'importance', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
notification.read = rank !== null ? true:false;
if (notification.from) {
@ -74,6 +74,7 @@ var async = require('async'),
var defaults = {
text: '',
path: null,
importance: 5,
datetime: Date.now(),
uniqueId: utils.generateUUID()
};
@ -84,6 +85,7 @@ var async = require('async'),
}
db.incrObjectField('global', 'nextNid', function(err, nid) {
data.nid = nid;
db.setAdd('notifications', nid);
db.setObject('notifications:' + nid, data, function(err, status) {
if (!err) {
@ -103,25 +105,26 @@ var async = require('async'),
x;
Notifications.get(nid, null, function(notif_data) {
for (x = 0; x < numUids; x++) {
if (parseInt(uids[x], 10) > 0) {
(function(uid) {
remove_by_uniqueId(notif_data.uniqueId, uid, function() {
async.each(uids, function(uid, next) {
if (parseInt(uid, 10) > 0) {
checkReplace(notif_data.uniqueId, uid, notif_data, function(replace) {
if (replace) {
db.sortedSetAdd('uid:' + uid + ':notifications:unread', notif_data.datetime, nid);
websockets.in('uid_' + uid).emit('event:new_notification', notif_data);
}
if (callback) {
callback(true);
}
});
})(uids[x]);
if (callback) {
callback(true);
}
});
}
}
});
});
};
function remove_by_uniqueId(uniqueId, uid, callback) {
function checkReplace(uniqueId, uid, newNotifObj, callback) {
var replace = false, matched = false;
async.parallel([
function(next) {
db.getSortedSetRange('uid:' + uid + ':notifications:unread', 0, -1, function(err, nids) {
@ -129,9 +132,13 @@ var async = require('async'),
async.each(nids, function(nid, next) {
Notifications.get(nid, uid, function(nid_info) {
if (nid_info && nid_info.uniqueId === uniqueId) {
db.sortedSetRemove('uid:' + uid + ':notifications:unread', nid);
matched = true;
if ((nid_info.importance || 5) >= newNotifObj.importance) {
replace = true;
db.sortedSetRemove('uid:' + uid + ':notifications:unread', nid);
}
}
next();
});
}, function(err) {
@ -148,9 +155,13 @@ var async = require('async'),
async.each(nids, function(nid, next) {
Notifications.get(nid, uid, function(nid_info) {
if (nid_info && nid_info.uniqueId === uniqueId) {
db.sortedSetRemove('uid:' + uid + ':notifications:read', nid);
matched = true;
if ((nid_info.importance || 5) >= newNotifObj.importance) {
replace = true;
db.sortedSetRemove('uid:' + uid + ':notifications:read', nid);
}
}
next();
});
}, function(err) {
@ -163,7 +174,11 @@ var async = require('async'),
}
], function(err) {
if (!err) {
callback(true);
if (replace === false && matched === false) {
replace = true;
}
callback(replace);
}
});
}

@ -54,14 +54,8 @@ module.exports = function(app, middleware, controllers) {
});
app.get('/test', function(req, res) {
var groups = require('../groups');
groups.list({
showAllGroups: true
}, function(err, groups) {
res.json(200, groups);
});
// res.send(200);
require('../meta').sounds.init();
res.send(200);
});
});
};

@ -224,7 +224,7 @@ SocketModules.notifications.mark_all_read = function(socket, data, callback) {
/* Sounds */
SocketModules.sounds.getSounds = function(socket, data, callback) {
// Read sounds from local directory
meta.sounds.getLocal(callback);
meta.sounds.getFiles(callback);
};
SocketModules.sounds.getMapping = function(socket, data, callback) {

@ -42,6 +42,13 @@ if(nconf.get('ssl')) {
notifications.init();
user.startJobs();
// Preparation dependent on plugins
plugins.ready(function() {
meta.js.minify(app.enabled('minification'));
meta.css.minify();
meta.sounds.init();
});
async.series({
themesData: meta.themes.get,
currentThemeData: function(next) {
@ -89,12 +96,6 @@ if(nconf.get('ssl')) {
winston.info('Using ports 80 and 443 is not recommend; use a proxy instead. See README.md');
}
// Front-end assets
plugins.ready(function() {
meta.js.minify(app.enabled('minification'));
meta.css.minify();
});
module.exports.server = server;
module.exports.init = function () {
server.on("error", function(err){

@ -295,7 +295,7 @@ describe('Test database', function() {
}
function getSortedSetRevRangeByScore(callback) {
db.getSortedSetRevRangeByScore('sortedSet2', +Infinity, 100, 0, 100, function(err, data) {
db.getSortedSetRevRangeByScore('sortedSet3', 0, 10, Infinity, 100, function(err, data) {
callback(err, {'getSortedSetRevRangeByScore': data});
});
}

Loading…
Cancel
Save