Commit graph

1492 commits

Author SHA1 Message Date
Alejandro Domínguez
ff7744efc0 Use .unwrap_or_default() instead of .unwrap_or() where possible 2019-01-06 17:48:37 +01:00
Alejandro Domínguez
043e7f5d44 Call String::new() instead of String::from("") or "".to_string() 2019-01-06 17:26:12 +01:00
Alejandro Domínguez
09894a81b6 Fix warning: unused mut 2019-01-06 04:13:33 +00:00
Alejandro Domínguez
280d585a25 Reformat Cargo.toml 2019-01-06 04:13:32 +00:00
Alejandro Domínguez
36b090533b Remove redundant uses 2019-01-06 04:13:32 +00:00
Alejandro Domínguez
84b7026b2f Upgrade to Rust 2018 2019-01-06 04:13:32 +00:00
Julian Sparber
4205a6a980 rooms: cache rooms only when the roomlist is cleared 2019-01-05 15:29:15 +00:00
Jordan Petridis
5dae373c85
meson: remove dependency on libsecret
This was added by accident, the secret-serivce crate is pure rust
and does not depend upon libsecret.
2019-01-05 16:01:15 +02:00
Jordan Petridis
e78f36c25c
meson: remove dependency on gstreamer-bad-video-1.0
This has been moved to gst-base now.
b9e15fddb1
2019-01-05 15:46:56 +02:00
Julian Sparber
78dfdc1e97 room: open default room when avaible 2019-01-02 22:54:18 +01:00
Julian Sparber
0ea988a0f3 refactor: simplify how rooms are added to the roomlist
This removes many clones and loops which where not needed.
2019-01-02 22:54:18 +01:00
Julian Sparber
f32f9cee64 refactor: pass rooms to set_rooms by value 2019-01-02 22:54:18 +01:00
Alejandro Domínguez
0bd8a9f6ba Fixes unchecked bug in e52fca475c 2019-01-02 18:35:38 +01:00
Alejandro Domínguez
e52fca475c Backend: Use lazy_static! for Regex evaluation. Closes #391 2018-12-29 22:56:12 +01:00
Alexandre Franke
30809bccd1 Update French translation 2018-12-29 18:56:38 +00:00
Jordi Mas
4a8de6a5bb Update Catalan translation 2018-12-29 18:52:25 +01:00
Alexandre Franke
4df848370c Fix mentions of World since we moved 2018-12-28 12:44:30 +01:00
Rafael Fontenelle
4003f6d515 Update Brazilian Portuguese translation 2018-12-25 18:33:55 +00:00
Piotr Drąg
3cbbad2ec5 Update Polish translation 2018-12-24 14:39:43 +01:00
Tobias Bernard
aa9b48cad3 Invite Dialogs: minor visual fixes
- Fix the search results not expanding
- Fix the spacing around the searchbar

The two UI files are identical except for some labels and IDs and should
be merged
2018-12-24 09:53:34 +00:00
Julian Sparber
13ccd74276 roomhistory: fix date format in day divider 2018-12-23 15:43:38 +00:00
Zeeshan Ali
f701ea559c fractal-matrix-api: Drop a redundant conversion
This fixes this errors from clippy:

```
warning: identical conversion
  --> fractal-matrix-api/src/backend/sync.rs:53:32
   |
53 |         params.push(("filter", String::from(filter)));
   |                                ^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `filter`
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#identity_conversion
```

Related: #370
2018-12-23 10:50:10 +00:00
Zeeshan Ali
5295964b6a fractal-matrix-api: Don't call a function in Result::unwrap() arg
This fixes this errors from clippy:

```
warning: use of `unwrap_or` followed by a call to `new`
  --> fractal-matrix-api/src/backend/room.rs:80:30
   |
80 |                       avatar = util::get_room_avatar(&baseu, &tk, &userid, &roomid)
   |  ______________________________^
81 | |                         .unwrap_or(String::from(""));
   | |_________________________________________________^ help: try this: `util::get_room_avatar(&baseu, &tk, &userid, &roomid).unwrap_or_default()`
   |
   = note: #[warn(clippy::or_fun_call)] on by default
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#or_fun_call
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
7152795796 fractal-matrix-api: Use char type for single char patterns
This fixes this errors from clippy:

```
error: single-character string constant used as pattern
   --> fractal-matrix-api/src/backend/media.rs:119:30
    |
119 |         let name = url.split("/").last().unwrap_or_default();
    |                              ^^^ help: try using a char instead: `'/'`
    |
    = note: `-D clippy::single-char-pattern` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#single_char_pattern
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
b93f1e4420 fractal-matrix-api: More idiomatic if/else assignments
This fixes these errors from clippy:

```
error: `if _ { .. } else { .. }` is an expression
   --> fractal-matrix-api/src/util.rs:525:5
    |
525 | /     let path: String;
526 | |
527 | |     if thumb {
528 | |         params.push(("width", format!("{}", w)));
...   |
533 | |         path = format!("download/{}/{}", server, media);
534 | |     }
    | |_____^ help: it is more idiomatic to write: `let path = if thumb { ..; $ crate :: fmt :: format ( format_args ! ( $ ( $ arg ) * ) ) } else { $ crate :: fmt :: format ( format_args ! ( $ ( $ arg ) * ) ) };`
    |
    = note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#useless_let_if_seq
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
01068ad752 fractal-matrix-api: Remove length comparisons to zero
This fixes some errors from clippy about needless length comparison to 0:

```
error: length comparison to zero
   --> fractal-matrix-api/src/util.rs:483:27
    |
483 |     if array.is_none() || array.unwrap().len() == 0 {
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `array.unwrap().is_empty()`
    |
    = note: `-D clippy::len-zero` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#len_zero
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
2ab29cfe69 fractal-matrix-api: Don't pass by value unnecessarily
This patch fixes a big bunch of 'unnecessary pass by value' errors from clippy:

```
error: this argument is passed by value, but not consumed in the function body
   --> fractal-matrix-api/src/util.rs:340:9
    |
340 |     tk: String,
    |         ^^^^^^
    |
    = note: `-D clippy::needless-pass-by-value` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#needless_pass_by_value
help: consider changing the type to
    |
340 |     tk: &str,
    |         ^^^^
help: change `tk.clone()` to
    |
357 |                 tk.to_string(),
    |                 ^^^^^^^^^^^^^^
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
d3d5f91cd8 fractal-matrix-api: Drop unit closure
Fixing clippy error:

```
error: called `map(f)` on an Option value where `f` is a unit closure
   --> fractal-matrix-api/src/util.rs:248:17
    |
248 | /                 fread["content"]["event_id"]
249 | |                     .as_str()
250 | |                     .map(|ev| r.add_receipt_from_fully_read(userid, ev));
    | |________________________________________________________________________^
    |
    = note: `-D clippy::option-map-unit-fn` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#option_map_unit_fn
help: try this
    |
248 |                 if let Some(ev) = fread["content"]["event_id"]
249 |                     .as_str() { r.add_receipt_from_fully_read(userid, ev) }
    |

```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
903ee29aea fractal-matrix-api: Drop redundant function call
Fixing clippy error:

```
error: called `filter(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(p)` instead.
   --> fractal-matrix-api/src/util.rs:243:34
    |
243 |               if let Some(fread) = evs
    |  __________________________________^
244 | |                 .into_iter()
245 | |                 .filter(|x| x["type"] == "m.fully_read")
246 | |                 .next()
    | |_______________________^
    |
    = note: `-D clippy::filter-next` implied by `-D warnings`
    = note: replace `filter(|x| x["type"] == "m.fully_read").next()` with `find(|x| x["type"] == "m.fully_read")`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#filter_next
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
ae52f0e5bb fractal-matrix-api: Drop redundant pattern matching
Fixing clippy error:

```
error: redundant pattern matching, consider using `is_some()`
   --> fractal-matrix-api/src/util.rs:223:24
    |
223 |                   if let Some(_) = tag["content"]["tags"]["m.favourite"].as_object() {
    |  _________________-      ^^^^^^^
224 | |                     r.fav = true;
225 | |                 }
    | |_________________- help: try this: `if tag["content"]["tags"]["m.favourite"].as_object().is_some()`
    |
    = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#redundant_pattern_matching

```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
4d34eed4ab fractal-matrix-api: Drop redundant closures
Fixing clippy error:

```
error: redundant closure found
   --> fractal-matrix-api/src/util.rs:219:60
    |
219 |         r.prev_batch = timeline["prev_batch"].as_str().map(|s| String::from(s));
    |                                                            ^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `String::from`
    |
    = note: `-D clippy::redundant-closure` implied by `-D warnings`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#redundant_closure
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
14e7d2fcf5 fractal-matrix-api: Drop redundant field initializations
Fixing clippy error:

```
error: redundant field names in struct initialization
  --> fractal-matrix-api/src/backend/mod.rs:47:13
   |
47 |             tx: tx,
   |             ^^^^^^ help: replace it with: `tx`
   |
   = note: `-D clippy::redundant-field-names` implied by `-D warnings`
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#redundant_field_names

error: redundant field names in struct initialization
  --> fractal-matrix-api/src/model/room.rs:37:13
   |
37 |             id: id,
   |             ^^^^^^ help: replace it with: `id`
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#redundant_field_names

error: redundant field names in struct initialization
  --> fractal-matrix-api/src/model/room.rs:38:13
   |
38 |             name: name,
   |             ^^^^^^^^^^ help: replace it with: `name`
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#redundant_field_names
```

Related: #370
2018-12-23 10:50:09 +00:00
Zeeshan Ali
bdadb58c52 fractal-matrix-api: Don't loop for unwrapping Option
Fixing clippy error:

```
error: for loop over `dataevs.as_array()`, which is an `Option`. This is more readably written as an `if let` statement.
   --> fractal-matrix-api/src/util.rs:221:19
    |
221 |         for ev in dataevs.as_array() {
    |                   ^^^^^^^^^^^^^^^^^^
    |
    = note: #[deny(clippy::for_loop_over_option)] on by default
    = help: consider replacing `for ev in dataevs.as_array()` with `if let Some(ev) = dataevs.as_array()`
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#for_loop_over_option
```

Related: #370
2018-12-23 10:50:09 +00:00
Hubert Figuière
2c1cf4b6d0 flatpak: Update git URL for fractal 2018-12-22 14:52:38 -05:00
Alexandre Franke
0ff5924445 Update README 2018-12-22 19:53:12 +01:00
Daniel García Moreno
5c0f17a42c Release 4.0.0 2018-12-22 11:19:34 +01:00
Jordan Petridis
79b3a87234
Flatpak: include the .git suffix in the libhandy uri
This is required to work with older versions of git
2018-12-21 18:35:51 +02:00
Daniel García Moreno
9a13a32f46 Beta release 3.99.1
See #396
2018-12-20 15:51:59 +01:00
Alexandre Franke
899583c34c release: mention header bar in notes 2018-12-19 12:17:31 +00:00
Tobias Bernard
607853e868 Update screenshot for 4.0 2018-12-18 21:49:22 +00:00
Daniel García Moreno
4af4ff4073 media-viewer: disconnect the keypress signal on unmap
We were storing the signal_id, but we never disconnect that handler so
it worked the first time and then we were getting all key events and
future widgets creation doesn't work.

This patch disconnect the signal just when the widget gets unmapped, as
we create a new widget when we open the media-viewer again.

Fix #402
2018-12-18 19:12:37 +00:00
Piotr Drąg
f6d0b79fa3 Update Polish translation 2018-12-18 18:45:21 +01:00
Alexandre Franke
a8dec5f8bd release: write release notes 2018-12-18 07:41:05 +00:00
Daniel García Moreno
211a15a780 Remove code inside debug_assert macro
Code inside debug_assert! is not called in release mode. In release mode
all the debug_assert! is omitted so the code inside never runs.

https://doc.rust-lang.org/std/macro.debug_assert.html

I've moved all the code inside the debug_assert! call to outside and
assign to a variable so the assert is done in development version but
doesn't affects to the release version at all.
2018-12-17 18:14:08 +00:00
Giovanni Grieco
62f076a1b8 Add Shift+Enter shortcut in shortcuts window
This fixes issue #401
2018-12-15 16:43:18 +01:00
Daniel García Moreno
b4dc4d2b6f Beta release 3.99.0
See #396
2018-12-14 19:46:41 +01:00
Daniel García Moreno
c0971cdc90 Check if active_room is some to avoid early return
The room order wasn't updated and the room name wasn't bold when you
receive a message without a room selected because if active_room is
None, the `?` operator will return the function and the moveup and
set_bold functions never get called.

Fix #394
2018-12-14 11:25:16 +00:00
Julian Sparber
ab013749e2 sidebar: clenup code for room selection 2018-12-13 18:02:47 +01:00
Julian Sparber
0a686c5eaa sidebar: select room when open it via the notification 2018-12-13 17:41:27 +01:00
Julian Sparber
5ff067eb2e sidebar: unselect row when changing rooms, fix #385 2018-12-13 17:06:38 +01:00