Commit graph

1467 commits

Author SHA1 Message Date
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
Tobias Bernard
4413d22e3d big emoji: change font size to 3em 2018-12-13 12:45:55 +01:00
Alexandre Franke
a4f09bdd41 rust: stop depending on nightly for fmt 2018-12-13 10:14:59 +00:00
Alexandre Franke
93472c1a4a message: catch more emoji combinations 2018-12-13 09:39:56 +00:00
Julian Sparber
61916e3868 App: reenable devel style 2018-12-12 18:53:25 +01:00
Alejandro Domínguez
764d399335 Get avatar thumbnails cropped from server 2018-12-12 16:12:36 +01:00
Julian Sparber
0ce3e63e33 App: don't allow App::new() to fail 2018-12-12 15:20:43 +01:00
Julian Sparber
4f6d546830 sticker: remove code for sticker #239 2018-12-12 15:20:43 +01:00
Julian Sparber
1d89fdf85d app: show ErrorDialog (if possible) when app fails to start 2018-12-12 15:20:43 +01:00
Julian Sparber
4818ca1e03 ErrorDialog: show dialog on top of current active window 2018-12-12 15:20:43 +01:00
Julian Sparber
6b43f61394 App: store weak pointer to AppOp 2018-12-12 15:20:43 +01:00
Julian Sparber
c910aad9d7 app: add workarond for GTK::Application::present() 2018-12-12 15:20:43 +01:00
Julian Sparber
383d8865f8 autocomplete: close autocomplete popover on esc 2018-12-12 15:20:43 +01:00
Julian Sparber
29a77d6ec6 refactor: Add back action to go to previous view
This uses a store to keep track of the AppStates, so the user can go
back to the previous state by clicking the back button or press Escape.
2018-12-12 15:20:43 +01:00
Julian Sparber
253ed04e90 message: connect image row directly to action
This connects the image row directly to the action to open the media
viewer, this way the action doesn't need to be passed to message.rs.
FIX: button press on images don't close the left click menu
2018-12-12 15:20:43 +01:00
Julian Sparber
0d42618161 refactor App and add WeakApp
This cleans up App and addes the possibility to have a weak reference to
the App. It's heavily inspired by the example application written by
Slomo: https://github.com/sdroege/rustfest-rome18-gtk-gst-workshop
2018-12-12 15:20:43 +01:00
Daniel García Moreno
1a91866e17 Update Cargo.lock with cargo update 2018-12-12 11:53:14 +01:00
Daniel García Moreno
420e64931a Use letter-avatar from crates.io 2018-12-12 11:34:29 +01:00
Alexandre Franke
35d4beeba9 Merge branch 'wip/big-emojis' into 'master'
message: Make emoji-only messages, big

Closes #367

See merge request World/fractal!291
2018-12-11 17:03:04 +00:00
Daniel Garcia Moreno
9a178de8e4 Merge branch 'master' into 'master'
Trim spaces on Matrix ID/Alias on Join Room window

See merge request World/fractal!302
2018-12-11 11:22:49 +00:00
Alejandro Domínguez
111e81a48c Trim spaces on Matrix ID/Alias on Join Room window 2018-12-11 11:40:26 +01:00
Rafael Fontenelle
93648eb8d3 Update Brazilian Portuguese translation 2018-12-11 00:50:27 +00:00
Zeeshan Ali
6c599708f0 message: Make emoji-only messages, big
Just like most chat apps do these days.

Fixes #367.
2018-12-09 22:53:21 +01:00
Zeeshan Ali
8b39ce1f2e fractal-gtk: Bump regex requirement to 1.1.0
We'll need the latest regex in a following patch for emoji matching.
2018-12-09 22:53:21 +01:00
Piotr Drąg
94b084f4ec Update Polish translation 2018-12-09 11:15:15 +00:00
Daniel Garcia Moreno
e610fb6078 Merge branch 'patch-1' into 'master'
Don't translate the default text of in-app notification

See merge request World/fractal!300
2018-12-09 08:45:48 +00:00