Просмотр исходного кода

[RN] Fix calendar alerts when case sensitive URLs are used

master
Zoltan Bettenbuk 7 лет назад
Родитель
Сommit
cc6e04ddf8

+ 18
- 0
react/features/base/connection/functions.js Просмотреть файл

@@ -52,6 +52,24 @@ export function getURLWithoutParams(url: URL): URL {
52 52
     return url;
53 53
 }
54 54
 
55
+/**
56
+ * Gets a URL string without hash and query/search params from a specific
57
+ * {@code URL}.
58
+ *
59
+ * @param {URL} url - The {@code URL} which may have hash and query/search
60
+ * params.
61
+ * @returns {string}
62
+ */
63
+export function getURLWithoutParamsNormalized(url: URL): string {
64
+    const urlWithoutParams = getURLWithoutParams(url).href;
65
+
66
+    if (urlWithoutParams) {
67
+        return urlWithoutParams.toLowerCase();
68
+    }
69
+
70
+    return '';
71
+}
72
+
55 73
 /**
56 74
  * Converts a specific id to jid if it's not jid yet.
57 75
  *

+ 8
- 3
react/features/calendar-sync/components/ConferenceNotification.native.js Просмотреть файл

@@ -8,7 +8,7 @@ import {
8 8
 import { connect } from 'react-redux';
9 9
 
10 10
 import { appNavigate } from '../../app';
11
-import { getURLWithoutParams } from '../../base/connection';
11
+import { getURLWithoutParamsNormalized } from '../../base/connection';
12 12
 import { getLocalizedDateFormatter, translate } from '../../base/i18n';
13 13
 import { Icon } from '../../base/font-icons';
14 14
 import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
@@ -223,7 +223,11 @@ class ConferenceNotification extends Component<Props, State> {
223 223
             const now = Date.now();
224 224
 
225 225
             for (const event of _eventList) {
226
-                if (event.url !== _currentConferenceURL) {
226
+                const eventUrl = getURLWithoutParamsNormalized(
227
+                    new URL(event.url)
228
+                );
229
+
230
+                if (eventUrl !== _currentConferenceURL) {
227 231
                     if ((!eventToShow
228 232
                         && event.startDate > now
229 233
                         && event.startDate < now + ALERT_MILLISECONDS)
@@ -275,7 +279,8 @@ export function _mapStateToProps(state: Object) {
275 279
     return {
276 280
         _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
277 281
         _currentConferenceURL:
278
-            locationURL ? getURLWithoutParams(locationURL)._url : '',
282
+            locationURL
283
+                ? getURLWithoutParamsNormalized(locationURL) : '',
279 284
         _eventList: state['features/calendar-sync'].events
280 285
     };
281 286
 }

Загрузка…
Отмена
Сохранить