Commit Graph

66 Commits

Author SHA1 Message Date
David Taylor 79ad0860a2
FIX: Cleanup PresenceChannel instances when composer closed (#14741)
I was previously relying on `this.isDestroying` returning `true` during `willDestroyElement`. This was an incorrect assumption.

This commit refactors the logic into an explicit `cleanup` function, and also adds some cleanup for empty keys in the `subscribedProxy` array
2021-10-27 15:17:10 +01:00
David Taylor b57b079ff2
DEV: Update discourse-presence plugin to use new PresenceChannel system (#14519)
This removes all custom controllers and redis/messagebus logic from discourse-presence, and replaces it with core's new PresenceChannel system.

All functionality should be retained. This implementation should scale much better to large numbers of users, reduce the number of HTTP requests made by clients, and reduce the volume of messages on the MessageBus.

For more information on PresenceChannel, see 31db8352
2021-10-21 12:42:46 +01:00
David Taylor 5eb4e642a6
DEV: Rename discourse-presence endpoints and messagebus channels (#14089)
We are working to introduce a general core API for presence, which will clash with this plugin's `/presence` namespace

This commit introduces no functional change. There may be a slight interruption in discourse-presence functionality during a deploy of this commit.
2021-08-19 13:04:31 +01:00
Penar Musaraj f9bb6399e0
DEV: Remove SCSS color vars fallbacks (#13035)
They are no longer needed.
2021-05-12 08:56:15 -04:00
Kris 984d87f30c
UX: stop presence indicator hop, space consistency (#12797) 2021-04-22 16:11:47 -04:00
Osama Sayegh bd709c89a7
FIX: Unsubscribe from topic presence when navigating between topics (#12198)
This PR fixes a bug where if you navigate from topic to another one (via suggested topics, notifications etc.), the previous topic is not unsubscribed from presence manager, which means if you visit lots of topics all the subscriptions will accumulate and can cause rate limit errors.

This bug is exposed by the loading slider we're currently experimenting with on Meta because we no longer have an intermediate state when navigating between topics which means the `willDestroyElement` hook that's responsible for unsubscribing is not called.
2021-02-24 23:14:38 +03:00
Roman Rizzi bbe5d8d5cf
DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
Gerhard Schlager 7adf71a203
Fix i18n issues reported on Crowdin (#10925)
* Pluralize `discourse_narrative_bot.dice.not_enough_dice`
  The number of dice requires a pluralized string.
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/278/en-ar#51346

* Always use "two-factor" instead of "second factor" or "two factor"
  Using different terms for the same thing is quite confusing.
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-nl#40096

* Remove whitespace before ellipsis for consistency
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-nl#53978

* Remove unused strings from locale file

* Correct grammar in `site_settings.review_media_unless_trust_level`
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#54018

* Correct grammar in `reviewables.reasons.contains_media`
  Fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#54020

* Correct grammar in user notifications
  It also adds a link to the /about page in order to give the user a clue who the site admins are.
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#54084

* Use "log in" instead of "login" when it's a verb
  This fixes multiple issues:
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-nl#40940
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#47858
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-nl#49458

* Replace "Github" with "GitHub"

* Remove "discourse.org" from title of 503 error page

* Replace weirdly formatted multi line string

* Pluralize `js.composer.group_mentioned_limit`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41158

* Remove unused string and pluralize `js.topic.feature_topic.confirm_pin_globally`
  This kinda fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42114 as `js.topic.feature_topic.confirm_pin` wasn't used anymore.

* Pluralize `js.user.second_factor_backup.remaining_codes`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40054

* Pluralize `js.composer.error.tags_missing`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41184

* Pluralize `js.post.errors.too_many_dragged_and_dropped_files`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42408

* Remove unused `js.posts_long` and `js.likes_long`
  This fixes the following issues in an unexpected way:
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42974
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#42994

* Pluralize `js.bootstrap_mode_enabled`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#38726

* Remove unused `long_form` from `post_action_types`
  This more or less fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-ar#47158

* Pluralize `js.presence.replying` and `js.presence.replying`
  This fixes the following issues:
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/282/en-ar#51588
  * https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/282/en-ar#51590

* Pluralize `js.user.second_factor_backup.manage`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40044

* Stop using concatenated strings for "Recently Used Devices"
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#40308

* Pluralize `js.category_row.topic_count`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41056

* Pluralize `js.select_kit.invalid_selection_length`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41072

* Pluralize `js.notifications.membership_request_consolidated`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-ar#41416
2020-10-16 15:24:58 +02:00
jbrw ac31fe8321
FEATURE - SiteSetting to disable user option to hide their profiles and presences (#10885)
* FEATURE - SiteSetting to disable user option to hide their profiles and presences
2020-10-09 17:18:44 -04:00
Joffrey JAFFEUX e6821fbaae
DEV: fixes linting of hbs files in core plugins (#10820) 2020-10-05 14:42:36 +02:00
Joffrey JAFFEUX 4b94af077d
DEV: linting of discourse-presence (#10722) 2020-09-22 17:20:00 +02:00
David Taylor d84dee4519
FIX: Account for different composer 'edit' states in discourse-presence (#10631)
Previously we were manually comparing the composer 'action' to the REPLY and EDIT constants. This meant that other forms of editing (e.g. shared drafts) were not included. This commit changes the presence logic to use the existing composer computed variables.
2020-09-10 10:52:51 +01:00
Joffrey JAFFEUX bf88410126
DEV: apply coding standards to plugins (#10594) 2020-09-04 13:51:53 +02:00
Penar Musaraj 89209985c8
FIX: Update colors for presence plugin 2020-08-07 15:02:36 -04:00
Guo Xiang Tan a849bdf0c9
FIX: Don't publish typing presence if composer isn't opened.
Hitting cancel on composer will set composer's reply and title to null
causing our observer to fire.
2020-05-14 12:52:10 +08:00
Guo Xiang Tan c5ef465179
DEV: Avoid relative paths when importing in plugins. 2020-05-14 10:05:16 +08:00
Guo Xiang Tan 623920f13d
FEATURE: Introduce a staff only override key for discourse-presence.
Merge remote-tracking branch 'origin/coding-standards'
This uses the composer as a bridge for other plugins.
2020-05-13 14:13:31 +08:00
Guo Xiang Tan ca8d11635c
Add missing export in 15e32dc1af. 2020-05-13 13:57:12 +08:00
Guo Xiang Tan 15e32dc1af
FIX: Composer presence shows user as editing when replying. 2020-05-13 13:41:03 +08:00
Guo Xiang Tan aa40a07d73
FIX: Throttle typing function in discourse-presence. 2020-05-13 13:31:06 +08:00
Guo Xiang Tan b299f5f491 DEV: Use Ember.Service over manually registering a factory.
Follow up to 9e827eb420
2020-05-06 09:24:49 +08:00
tshenry b8b1cbbfb9
UX: Improve second factor UI (#9526)
This will make a few minor improvements to the second factor user interface. Highlights include:

- Using the site's title to prefix the backup code filename. If non-ascii characters are detected, then prefix "discourse" instead.
- Add icons and change the text on some of the buttons for better clarity and consistency
- Add an education link to the security key modal
2020-05-05 11:05:25 +10:00
Guo Xiang Tan 9e827eb420
DEV: Refactor presence manager to deal with multiple composer states.
This change amends it so we use a static service to keep track of
the typing presence.

It correct various edge cases the initial implementation had

- Faster close messages
- When composing on topic 1 and viewing topic 2 we had incorrect
  presence
- Changing a running composer to reply as new topic or reply to a
  differet topic would not correctly shift presence

Authored by tgxworld, with contributions by sam
2020-05-01 11:37:03 +10:00
Guo Xiang Tan ae54a33719
FIX: discourse-presence breaks composer for users. 2020-04-29 15:29:29 +08:00
Guo Xiang Tan 197d0332e6
DEV: Missing import. 2020-04-29 13:48:31 +08:00
Guo Xiang Tan 8b3b5d1474
DEV: Disable `discourse-presence` in Ember test env. 2020-04-29 13:39:19 +08:00
Sam Saffron 2045f51312
FIX: correctly account for direct replies with presence
followup to 301a0fa5, we were not checking the action so we
were publishing some messages from composers we did not intend to
2020-04-29 15:23:17 +10:00
Alan Guo Xiang Tan 301a0fa54e
FEATURE: Redesign discourse-presence to track state on the client side. (#9487)
Before this commit, the presence state of users were stored on the
server side and any updates to the state meant we had to publish the
entire state to the clients. Also, the way the state of users were
stored on the server side meant we didn't have a way to differentiate
between replying users and whispering users.

In this redesign, we decided to move the tracking of users state to the client
side and have the server publish client events instead. As a result of
this change, we're able to remove the number of opened connections
needed to track presence and also reduce the payload that is sent for
each event.

At the same time, we've also improved on the restrictions when publishing message_bus messages. Users that
do not have permission to see certain events will not receive messages
for those events.
2020-04-29 14:48:55 +10:00
Jarek Radosz 5037b80c9c
Merge imports from the same module (#9144) 2020-03-09 17:38:37 +01:00
Jarek Radosz 48ba65f406
DEV: Clean up Ember imports (#8979)
Includes:
* Import `computed` helpers
* Import `@ember/application`
* Import `isBlank` from `@ember/utils`
* Import `A` from `@ember/array`
* Import `EmberArray` from `@ember/array`
* Import `ArrayProxy` from `@ember/array/proxy`
* Import `warn` from `@ember/debug`
* Import `EmberObject` from `@ember/object`
* Import `Application` from `@ember/application`
* Import `EmberRouter` from `@ember/routing/router`
* Import `isPresent` from `@ember/utils`
* Import `computed` from `@ember/object`
* Import `guidFor` from `@ember/object`
* Import `isArray` from `@ember/array`
* Import `TextField` from `@ember/component`
* Import `TextArea` from `@ember/component`
* Import `Promise` from `rsvp`
* Import `Evented` from `@ember/object/evented`
* Replace deprecated `ember-addons/ember-computed-decorators` imports
2020-03-06 23:49:28 +01:00
Penar Musaraj 6be685ac67 DEV: Find/replace deprecated decorators 2020-02-19 11:49:56 -05:00
Jarek Radosz fe588cc7f8
DEV: Fix function prototype deprecations (#8681)
* DEV: Fix the function prototype observers deprecation

DEPRECATION: Function prototype extensions have been deprecated, please migrate from function(){}.observes('foo') to observer('foo', function() {}). [deprecation id: function-prototype-extensions.observes] See https://deprecations.emberjs.com/v3.x/#toc_function-prototype-extensions-observes for more details.

* DEV: Fix the function prototype event listeners deprecation

DEPRECATION: Function prototype extensions have been deprecated, please migrate from function(){}.on('foo') to on('foo', function() {}). [deprecation id: function-prototype-extensions.on] See https://deprecations.emberjs.com/v3.x/#toc_function-prototype-extensions-on for more details.

* DEV: Simplify `default as` imports

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2020-01-16 18:56:53 +01:00
Robin Ward 8d34f4bbd9 Revert "Revert Ember.run refactors"
This reverts commit fcb1ca52f9.
2019-10-30 09:48:24 -04:00
Robin Ward fcb1ca52f9 Revert Ember.run refactors
This reverts commit 5ca60fcb6b.
2019-10-29 17:10:47 -04:00
Robin Ward 5ca60fcb6b REFACTOR: Use imports for `Ember.run` 2019-10-29 15:31:56 -04:00
Robin Ward a8a76198b1 REFACTOR: Remove `Ember.Component` global variable
Use imports instead.
2019-10-23 12:30:52 -04:00
Joe 27f7bd4273
UX: adjusts RTL composer presence avatar alignment
context: https://meta.discourse.org/t/user-is-typing-misaligned-and-mixed-with-reply-choices-with-rtl/127963

This commit adds a temporary fix for presence avatar overlap in the composer for RTL.

More context on TMP here: https://meta.discourse.org/t/moving-the-voting-box-to-the-right-side-of-the-screen/126752
2019-09-09 20:47:29 +08:00
Joffrey JAFFEUX b98b994fe7
apply prettier on plugins (#7605) 2019-05-27 11:06:11 +02:00
Joffrey JAFFEUX bfea922167
DEV: global s/this.get\("(\w+)"\)/this.$1 (#7592) 2019-05-27 10:15:39 +02:00
Penar Musaraj e50e4b6cc6 Make Prettier happy 2019-04-08 12:03:41 -04:00
Tarek Khalil 5957991340 FIX: Remove quoted post text and block realtime replies from ignored users (#7336) 2019-04-08 17:44:42 +02:00
Kris 5f75da6f61 FIX: Prensence was overlapping with full-screen icon 2019-01-10 21:02:02 -05:00
Joffrey JAFFEUX f9648de897
DEV: upgrades from Ember 2.13 to Ember 3.5.1 (#6808)
Co-Authored-By: Bianca Nenciu <nbianca@users.noreply.github.com>
Co-Authored-By: David Taylor <david@taylorhq.com>
2019-01-10 11:06:01 +01:00
Kris c09a407f65 composer alignment fixes 2018-11-13 11:12:58 -05:00
Joe a552a39f53
UX: presence-users overlaps with composer toggles 2018-10-15 16:25:28 +08:00
Robin Ward a566ed42ae FEATURE: Option to disable user presence and profile
This allows users who are privacy conscious to disable the presence
features of the forum as well as their public profile.
2018-10-10 17:34:33 -04:00
Joffrey JAFFEUX 60ff0e9b8c
missing prettified files 2018-06-15 18:42:20 +02:00
Joffrey JAFFEUX 174d392e5a
DEV: adds prettier (#5956)
Run `prettier --write "app/assets/stylesheets/**/*.scss" "plugins/**/*.scss"` after making sure you installed it with `yarn`

It's recommended to configure your editor to run prettier on file save.
2018-06-08 11:49:31 +02:00
Sam 8b62b59b2e FIX: in some cases we subscribed to an invalid channel
in some very rare cases we would publish and empty payload causing
messagebus corruption

this broke all navigation
2018-04-30 12:13:55 +10:00
Joffrey JAFFEUX ea812ea05d
FIX: regression preventing the display of `replying...` in the composer 2018-03-05 18:51:57 +01:00